[3620] | 1 | #!/bin/bash |
---|
[3719] | 2 | #MSUB -r WeightsMask # Job name |
---|
| 3 | #MSUB -o Out_WeightsMask # Standard output |
---|
| 4 | #MSUB -e Out_WeightsMask # Error output |
---|
[4159] | 5 | #MSUB -n 16 # Number of processors |
---|
[4186] | 6 | #MSUB -T 7200 # Time limit (seconds) |
---|
[3966] | 7 | #MSUB -q skylake |
---|
| 8 | #MSUB -p gen2212 |
---|
| 9 | #MSUB -m work |
---|
[3620] | 10 | |
---|
| 11 | ### =========================================================================== |
---|
| 12 | ### |
---|
[3719] | 13 | ### Creates interpolation weights between ORCA and atmosphere grids. |
---|
[3620] | 14 | ### Interpolates ORCA mask to atmosphere grid. |
---|
| 15 | ### Weight files are at OASIS-MCT format. |
---|
| 16 | ### |
---|
| 17 | ### Atmosphere grid may be lon/lat LMDZ or DYNAMICO icosahedron |
---|
[3627] | 18 | ### |
---|
| 19 | ### Documentation : https://forge.ipsl.jussieu.fr/igcmg/wiki/IPSLCM6/MOSAIX |
---|
[3620] | 20 | ### =========================================================================== |
---|
| 21 | ## |
---|
| 22 | ## Warning, to install, configure, run, use any of Olivier Marti's |
---|
| 23 | ## software or to read the associated documentation you'll need at least |
---|
| 24 | ## one (1) brain in a reasonably working order. Lack of this implement |
---|
| 25 | ## will void any warranties (either express or implied). |
---|
| 26 | ## O. Marti assumes no responsability for errors, omissions, |
---|
| 27 | ## data loss, or any other consequences caused directly or indirectly by |
---|
| 28 | ## the usage of his software by incorrectly or partially configured |
---|
| 29 | ## personal. |
---|
| 30 | ## |
---|
[3623] | 31 | ## SVN information |
---|
[3665] | 32 | # $Author$ |
---|
| 33 | # $Date$ |
---|
| 34 | # $Revision$ |
---|
| 35 | # $Id$ |
---|
[3632] | 36 | # $HeadURL$ |
---|
[4090] | 37 | # |
---|
[4317] | 38 | # CplModel=eORCA1.2xLMD144142 ; qsub -r ${CplModel} -o Out_${CplModel} -e Out_${CplModel} CreateWeightsMask.bash |
---|
| 39 | # CplModel=ORCA2.3xLMD9695 |
---|
| 40 | # CplModel=ORCA2.3xICO30 |
---|
| 41 | # CplModel=ORCA2.3xICO40 |
---|
| 42 | # CplModel=eORCA1.2xICO40 |
---|
| 43 | # CplModel=eORCA1.2xLMD256256 |
---|
| 44 | # CplModel=eORCA1.2xICO450 |
---|
| 45 | # CplModel=eORCA025.1xLMD256256 |
---|
[4195] | 46 | # |
---|
| 47 | |
---|
[4172] | 48 | set +vx |
---|
[3901] | 49 | export Bold=$(tput bold) |
---|
| 50 | export Unde=$(tput smul) ; export OffUnde=$(tput rmul) |
---|
| 51 | export Stou=$(tput smso) ; export OffStou=$(tput rmso) |
---|
| 52 | export Reve=$(tput rev ) |
---|
| 53 | couleurs=( "Black" "Blue" "Green" "Cyan" "Red" "Magenta" "Yellow" "White" ) |
---|
[4259] | 54 | for i in $(seq 0 7) ; do eval "export ${couleurs[$i]}=$(tput setf ${i})" ; done |
---|
[4186] | 55 | export Norm=$(tput sgr0) |
---|
[4172] | 56 | export Titre=${Bold}${Blue} |
---|
[3620] | 57 | |
---|
| 58 | ## |
---|
| 59 | ## Configuration |
---|
| 60 | ## =========================================================================== |
---|
[4159] | 61 | set -e |
---|
[3620] | 62 | |
---|
| 63 | # |
---|
[4317] | 64 | echo ${Titre}"Defines model"${Norm} |
---|
| 65 | # ================================= |
---|
| 66 | #CplModel=ORCA2.3xLMD9695 |
---|
| 67 | #CplModel=ORCA2.3xICO30 |
---|
| 68 | #CplModel=ORCA2.3xICO40 |
---|
| 69 | CplModel=eORCA1.2xLMD144142 |
---|
| 70 | #CplModel=eORCA1.2xLMD256256 |
---|
| 71 | #CplModel=eORCA1.2xICO40 |
---|
| 72 | #CplModel=eORCA1.2xICO450 |
---|
| 73 | #CplModel=eORCA025.1xLMD256256 |
---|
[3620] | 74 | |
---|
[4317] | 75 | Version="v3" ; Comment="Preliminary attempt - Do not trust !" |
---|
[3620] | 76 | |
---|
[4317] | 77 | # If available, get model name from job name |
---|
[4195] | 78 | if [[ X${SLURM_JOB_NAME} = X*ORC* || X${SLURM_JOB_NAME} = X*LMD* || X${SLURM_JOB_NAME} = X*ICO* ]] ; then |
---|
[4317] | 79 | CplModel=${SLURM_JOB_NAME} ; |
---|
[4195] | 80 | fi |
---|
[4317] | 81 | OCE=${CplModel//x*} ; ATM=${CplModel##*x} |
---|
[4195] | 82 | |
---|
[4186] | 83 | echo ${Titre}"ATM model : ${ATM}"${Norm} |
---|
| 84 | echo ${Titre}"OCE model : ${OCE}"${Norm} |
---|
[4195] | 85 | echo ${Titre}"Cpl model : ${CplModel}"${Norm} |
---|
[4172] | 86 | |
---|
[4186] | 87 | # Runoff parameter. atmCoastWidth and oceCoastWidth in grid points, searchRadius in km |
---|
| 88 | atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=600.0 |
---|
[4298] | 89 | runOff_atmQuantity=Quantity ; runOff_oceQuantity=Surfacic |
---|
[4172] | 90 | |
---|
[4298] | 91 | [[ ${ATM} = ICO* ]] && atmCoastWidth=0 # Parameter relevant for LMD rectilinear grid only |
---|
| 92 | [[ ${ATM} = LMD* ]] && atmCoastWidth=2 |
---|
| 93 | [[ ${OCE} = ORCA2.3 ]] && oceCoastWidth=1 |
---|
| 94 | [[ ${OCE} = eORCA1.2 ]] && oceCoastWidth=3 |
---|
| 95 | [[ ${OCE} = eORCA025* ]] && oceCoastWidth=1 |
---|
[4186] | 96 | |
---|
[4153] | 97 | # Default values, used to create ocean fraction on atmospheric grid |
---|
[4186] | 98 | DefaultValues=( Direction=o2a,oceGrid=t,atmGrid=t,Order=1st,Quantity=false,Renormalize=false,useArea=false,maskSrc=true,maskDst=false,Name=OceFrac ) |
---|
[3620] | 99 | |
---|
[4172] | 100 | ## List of weights to build |
---|
| 101 | ## ==================================================================================================================================== |
---|
| 102 | # |
---|
| 103 | # Each item in CommandList describes the properties of interpolation weights to generate. |
---|
[4159] | 104 | # White spaces separate analysis. No spaces in any analysis. |
---|
| 105 | # |
---|
[4172] | 106 | # Specific commands : 'Runoff', 'Calving' |
---|
| 107 | # |
---|
[4159] | 108 | # Keywords : |
---|
[4298] | 109 | # Direction : o2a for ocean to atmosphere, a2o for atmosphere to ocean. |
---|
| 110 | # Order : 1st or 2nd. |
---|
[4159] | 111 | # Quantity : true if integrated quantity over a grid box, false for flux (quantity / m^2) |
---|
[4298] | 112 | # or intensive value (temperature, salinity, sea-ice fraction, ...). |
---|
| 113 | # Renormalize : used when source grid is masked, to use values on non masked points only. |
---|
| 114 | # oceGrid : t, u or v point for NEMO C grid. |
---|
| 115 | # atmGrid : up to know, only t grid used in the atmosphere. |
---|
| 116 | # useArea : if true area from the model metrics is used. If false, areas are computed by XIOS from grid corners. |
---|
| 117 | # maskSrc : true to use the source grid mask, false to used all grid points. |
---|
| 118 | # maskDst : true to use the destination grid mask, false to use all grid points. |
---|
[4159] | 119 | # |
---|
[4259] | 120 | ## Classic cases for IPSLCM6 |
---|
| 121 | AtmOceFluxes=" Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=HeatWaterFluxes" # Heat and water fluxes |
---|
| 122 | OceAtmTemp=" Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=TempIceAlb" # Temperature, sea-ice fraction, albedo |
---|
| 123 | OceAtmTemp2nd=" Direction=o2a,Order=2nd,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=TempIceAlb" # Temperature, sea-ice fraction, albedo |
---|
| 124 | AtmOceStressU=" Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true,Name=WindStress" # Wind stress to NEMO U point |
---|
| 125 | AtmOceStressV=" Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=v,useArea=true,maskSrc=true,maskDst=true,Name=WindStress" # Wind stress to NEMO V point |
---|
| 126 | AtmOceQuantity=" Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=t,oceGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=Quantity" # e.g. runoff |
---|
[4298] | 127 | # For new parameterization |
---|
| 128 | AtmOceTemp=" Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=OceTemp" # e.g. T and S correction from DWL parametrization |
---|
[4259] | 129 | OceAtmFluxes=" Direction=o2a,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=OceAtmFluxes" # e.g. CO2 fluxes |
---|
[4298] | 130 | # Test to do with 2nd order |
---|
| 131 | AtmOceFluxes2nd="Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=HeatWaterFluxes" # Heat and water fluxes |
---|
[4259] | 132 | OceAtmFluxes2nd="Direction=o2a,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=OceAtmFluxes" # e.g. CO2 fluxes |
---|
[4317] | 133 | AtmOceTemp2nd=" Direction=o2a,Order=2nd,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=OceTemp" # e.g. T and S correction from DWL parametrization |
---|
[4159] | 134 | |
---|
[4259] | 135 | ## Creates the list |
---|
| 136 | |
---|
[4186] | 137 | # Standard list for IPSLCM6 |
---|
| 138 | #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} Runoff Calving Grids ) |
---|
[4172] | 139 | |
---|
[4259] | 140 | # More comprehensive list for IPSLCM6 with new features |
---|
[4317] | 141 | #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${AtmOceTemp} Runoff Calving Grids ) |
---|
[4172] | 142 | |
---|
[4259] | 143 | # With 2nd order |
---|
[4317] | 144 | CommandList=( ${AtmOceFluxes} ${AtmOceFluxes2nd} ${OceAtmTemp} ${OceAtmTemp2nd} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${OceAtmFluxes2nd} ${AtmOceTemp} ${AtmOceTemp2nd} Runoff Calving Grids ) |
---|
[4259] | 145 | |
---|
[4186] | 146 | # Debugs |
---|
| 147 | #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} Runoff Calving Grids ) |
---|
[4199] | 148 | #CommandList=( ${AtmOceFluxes} Runoff Calving Grids ) |
---|
[4317] | 149 | #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ) |
---|
[4259] | 150 | #CommandList=( Runoff ) |
---|
| 151 | #CommandList=( Runoff Calving Grids ) |
---|
[4186] | 152 | #CommandList=( Calving ) |
---|
| 153 | #CommandList=( Grids ) |
---|
[4172] | 154 | |
---|
[3620] | 155 | ## =========================================================================== |
---|
| 156 | ## |
---|
| 157 | ## You should not change anything below this line .... |
---|
| 158 | ## |
---|
| 159 | ## =========================================================================== |
---|
[4199] | 160 | Tag="MOSAIX" |
---|
[3620] | 161 | SUBMIT_DIR=$(pwd) |
---|
[4259] | 162 | FMT_XIOS=netcdf4 |
---|
[4159] | 163 | |
---|
| 164 | # Functions to handle command parameters |
---|
| 165 | # ====================================== |
---|
[4153] | 166 | function read_Command { |
---|
| 167 | # Decipher the command line to set bash variables |
---|
| 168 | local l_Debug="no" l_Element |
---|
| 169 | while [[ ${1} = -* ]] ; do |
---|
| 170 | case ${1} in |
---|
| 171 | ( -- ) shift ; break ;; |
---|
| 172 | ( -d | --debug ) l_Debug="true" ; shift ;; |
---|
| 173 | esac |
---|
| 174 | done |
---|
| 175 | local l_Command=${1} |
---|
[4159] | 176 | for l_Element in $(echo ${l_Command} | tr "," "\n" ) ; do |
---|
[4153] | 177 | [[ "X${l_Debug}" = "Xtrue" ]] && echo ${l_Element} |
---|
| 178 | eval export ${l_Element} |
---|
| 179 | done |
---|
| 180 | } |
---|
[3620] | 181 | |
---|
[4153] | 182 | function setValues { |
---|
[4317] | 183 | # Set default values |
---|
[4186] | 184 | read_Command "Direction=None,Order=None,Quantity=None,Renormalize=None,atmGrid=None,oceGrid=None,useArea=None,maskSrc=None,maskDst=None" |
---|
[4317] | 185 | # Read command line |
---|
[4186] | 186 | read_Command ${1} |
---|
| 187 | # |
---|
[4317] | 188 | oceGrid=${oceGrid,,} ; atmGrid=${atmGrid,,} # Model names to lower case |
---|
| 189 | OCEGRID=${oceGrid^^} ; ATMGRID=${atmGrid^^} # Model names to upper case |
---|
[4153] | 190 | |
---|
| 191 | case ${Order} in |
---|
| 192 | ( 1st ) numOrder=1 ;; |
---|
| 193 | ( 2nd ) numOrder=2 ;; |
---|
| 194 | esac |
---|
| 195 | case ${Renormalize} in |
---|
| 196 | ( true ) NormName=Normalized ;; |
---|
| 197 | ( false ) NormName=UnNormalized ;; |
---|
| 198 | esac |
---|
| 199 | case ${Quantity} in |
---|
| 200 | ( true ) QuantName=Integrated ;; |
---|
| 201 | ( false ) QuantName=Surfacic ;; |
---|
| 202 | esac |
---|
| 203 | case ${useArea} in |
---|
| 204 | ( true ) AreaName=Area ;; |
---|
| 205 | ( false ) AreaName=NoArea ;; |
---|
| 206 | esac |
---|
| 207 | |
---|
[4186] | 208 | if [[ "${Name}" != "None" ]] ; then |
---|
[4259] | 209 | FullName=${Name}_${Order}Order |
---|
[4186] | 210 | else |
---|
[4199] | 211 | FullName=${Order}Order_${NormName}_${QuantName}_${AreaName} |
---|
[4186] | 212 | fi |
---|
| 213 | |
---|
[4153] | 214 | case ${Direction} in |
---|
| 215 | ( o2a ) |
---|
[4159] | 216 | src=${oce} ; SRC=${OCE} ; srcGrid=${oceGrid} ; srcDomainType=${oceDomainType} ; SRCGRID=${OCEGRID} ; srcArea=area_grid_${OCEGRID} |
---|
| 217 | dst=${atm} ; DST=${ATM} ; dstGrid=${atmGrid} ; dstDomainType=${atmDomainType} ; DSTGRID=${ATMGRID} ; dstArea=aire |
---|
[4153] | 218 | ;; |
---|
| 219 | ( a2o ) |
---|
[4159] | 220 | src=${atm} ; SRC=${ATM} ; srcGrid=${atmGrid} ; srcDomainType=${atmDomainType} ; SRCGRID=${ATMGRID} ; srcArea=aire |
---|
| 221 | dst=${oce} ; DST=${OCE} ; dstGrid=${oceGrid} ; dstDomainType=${oceDomainType} ; DSTGRID=${OCEGRID} ; dstArea=area_grid_${OCEGRID} |
---|
[4153] | 222 | ;; |
---|
| 223 | esac |
---|
[4186] | 224 | echo ${Green}"${SRC} ${SRCGRID} toward ${DST} ${DSTGRID} - ${Order} Order - Normalize: ${Renormalize} - Quantity: ${QuantName} - Area: ${AreaName} "${Norm} |
---|
[4199] | 225 | echo ${Green}"FullName : ${FullName}"${Norm} |
---|
[4153] | 226 | } |
---|
[4186] | 227 | |
---|
[3620] | 228 | # |
---|
| 229 | # Defines computer |
---|
| 230 | # ================ |
---|
[3901] | 231 | if [[ $(hostname) = irene* ]] ; then arch=irene ; center=tgcc ; fi |
---|
[4153] | 232 | if [[ $(hostname) = lsce* ]] ; then arch=spip ; center=spip ; fi |
---|
[3734] | 233 | |
---|
[3620] | 234 | PROGRAM=$(basename ${0}) |
---|
| 235 | |
---|
| 236 | case ${arch} in |
---|
[4153] | 237 | ( irene ) |
---|
[3620] | 238 | set +vx |
---|
[4259] | 239 | set +e |
---|
[3966] | 240 | R_IN=$(ccc_home -u igcmg --cccwork)/IGCM |
---|
| 241 | TMPDIR=${CCCWORKDIR}/TMP |
---|
| 242 | SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}} |
---|
| 243 | PROGRAM=${BRIDGE_MSUB_REQNAME} |
---|
[4172] | 244 | MpiRun="time ccc_mprun" |
---|
[4195] | 245 | PyRun="time ccc_mprun -n 1" # Needed to force python to run on one process only |
---|
[4259] | 246 | #module purge |
---|
| 247 | source $(ccc_home -u igcmg)/MachineEnvironment/irene/env_irene |
---|
[4153] | 248 | source ${SUBMIT_DIR}/arch.env |
---|
[4259] | 249 | #module load nco |
---|
[4172] | 250 | module load python3 |
---|
[4153] | 251 | module load datadir/igcmg |
---|
[3966] | 252 | module list |
---|
[4259] | 253 | set -e |
---|
[3966] | 254 | ;; |
---|
[3734] | 255 | ( spip ) |
---|
| 256 | R_IN=${HOME}/Scratch/IGCM |
---|
| 257 | TMPDIR=${HOME}/Scratch/TMP |
---|
| 258 | SUBMIT_DIR=$(pwd) |
---|
[4172] | 259 | MpiRun="/opt/local/bin/mpirun -n 4" |
---|
| 260 | PyRun="time" |
---|
[3734] | 261 | ;; |
---|
[3901] | 262 | ( * ) exit -1 ;; |
---|
[3620] | 263 | esac |
---|
| 264 | |
---|
| 265 | set -x ; set -e |
---|
| 266 | |
---|
[4195] | 267 | mkdir -p ${TMPDIR}/${CplModel} || exit 1 |
---|
| 268 | cd ${TMPDIR}/${CplModel} || exit 1 |
---|
[4146] | 269 | rm -fr * |
---|
[3620] | 270 | |
---|
| 271 | # |
---|
| 272 | # Suffixes |
---|
| 273 | # --------------------------------------------------------------------------- |
---|
| 274 | |
---|
| 275 | case ${OCE} in |
---|
[4153] | 276 | ( *ORC* ) oce=orc ; oceDomainType=curvilinear ;; |
---|
[3620] | 277 | esac |
---|
[4159] | 278 | |
---|
[3620] | 279 | case ${ATM} in |
---|
[4153] | 280 | ( *dynamico* ) atm=ico ; atmDomainType=unstructured ;; |
---|
| 281 | ( *ICO* ) atm=ico ; atmDomainType=unstructured ;; |
---|
| 282 | ( *lmd* | *LMD* ) atm=lmd ; atmDomainType=rectilinear ;; |
---|
[3620] | 283 | esac |
---|
| 284 | |
---|
[4159] | 285 | case ${OCE} in # Periodicity type of ORCA grid |
---|
[4298] | 286 | ( ORCA2* ) OcePerio=4 ;; |
---|
[4172] | 287 | ( ORCA1* | eORCA1* ) OcePerio=6 ;; |
---|
[4298] | 288 | ( ORCA025* | eORCA025* ) OcePerio=6 ;; |
---|
[3723] | 289 | esac |
---|
[3620] | 290 | # |
---|
| 291 | |
---|
[4195] | 292 | cp ${SUBMIT_DIR}/bin/interpol.exe . |
---|
| 293 | cp ${SUBMIT_DIR}/*.py . |
---|
[4153] | 294 | cp ${SUBMIT_DIR}/iodef_atm_to_oce.xml . |
---|
| 295 | cp ${SUBMIT_DIR}/iodef_oce_to_atm.xml . |
---|
[3620] | 296 | |
---|
| 297 | cp ${R_IN}/OCE/NEMO/${OCE}/${OCE}_coordinates_mask.nc . |
---|
[3639] | 298 | cp ${R_IN}/ATM/GRID/${ATM}_grid.nc . |
---|
[3620] | 299 | |
---|
[4317] | 300 | # Soucis a corriger plus tard |
---|
| 301 | if [[ ${ATM} = LMD9695 ]] ; then |
---|
| 302 | cat <<EOF > toDouble.nco |
---|
| 303 | lat = double (lat) ; |
---|
| 304 | lon = double (lon) ; |
---|
| 305 | aire = double (aire) ; |
---|
| 306 | fract_oce = double (fract_oce) ; |
---|
| 307 | fract_sic = double (fract_sic) ; |
---|
| 308 | fract_oce_plus_sic = double (fract_oce_plus_sic) ; |
---|
| 309 | EOF |
---|
| 310 | ncap2 --history --overwrite --script-file toDouble.nco ${ATM}_grid.nc tmp_${ATM}_grid.nc |
---|
| 311 | mv tmp_${ATM}_grid.nc ${ATM}_grid.nc |
---|
| 312 | fi |
---|
[3620] | 313 | |
---|
[3912] | 314 | |
---|
[3901] | 315 | ## |
---|
[4172] | 316 | echo ${Titre}"NEMO T point towards ATM - 1st order"${Norm} |
---|
[3901] | 317 | ## =========================================================================== |
---|
[4153] | 318 | echo "Command parameters : ${Command}" |
---|
[4186] | 319 | setValues ${DefaultValues} |
---|
[3620] | 320 | |
---|
[4153] | 321 | cp iodef_oce_to_atm.xml iodef.xml |
---|
| 322 | |
---|
[4172] | 323 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="mask_src"]' -k name -v maskutil_T |
---|
| 324 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="area_src"]' -k name -v area_grid_T |
---|
| 325 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} |
---|
| 326 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} |
---|
| 327 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 |
---|
| 328 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v false |
---|
| 329 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false |
---|
| 330 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v false |
---|
| 331 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_src"]/field[@id="mask_source"]' -k name -v maskutil_T |
---|
| 332 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_src"]/field[@id="area_source"]' -k name -v area_grid_T |
---|
[4199] | 333 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName} |
---|
[4172] | 334 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${SRC} mask interpolated to ${DST}" |
---|
| 335 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType} |
---|
| 336 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType} |
---|
| 337 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t 1 |
---|
| 338 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} |
---|
| 339 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} |
---|
[4199] | 340 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.nc |
---|
[4172] | 341 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 |
---|
| 342 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t false |
---|
| 343 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t false |
---|
| 344 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t false |
---|
| 345 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false |
---|
| 346 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v false |
---|
| 347 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v false |
---|
[3620] | 348 | |
---|
[4199] | 349 | cp iodef.xml iodef_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.xml |
---|
[3901] | 350 | ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc |
---|
| 351 | ln -fs ${ATM}_grid.nc atm_grid.nc |
---|
[3620] | 352 | |
---|
[4172] | 353 | ${MpiRun} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} |
---|
| 354 | |
---|
[3620] | 355 | ## |
---|
[4172] | 356 | echo ${Titre}"Correct spurious values (extremes)"${Norm} |
---|
[3620] | 357 | ## =========================================================================== |
---|
| 358 | cat <<EOF > correction_masque.nco |
---|
| 359 | where (OceFrac < 0.00001 ) OceFrac=OceFrac.get_miss() ; |
---|
| 360 | where (OceFrac > 0.99999 ) OceFrac=1.0 ; |
---|
| 361 | OceFrac.delete_miss() ; |
---|
| 362 | // Fill masked values to land values |
---|
| 363 | where (OceFrac > 1.0 ) OceFrac=0.0 ; |
---|
| 364 | where (OceFrac < 0.0 ) OceFrac=0.0 ; |
---|
[4298] | 365 | OceMask = OceFrac ; |
---|
[3620] | 366 | EOF |
---|
[4199] | 367 | ncap2 --history --overwrite --script-file correction_masque.nco dia_t${oce}_to_t${atm}_${FullName}.nc tmp_dia_t${oce}_to_t${atm}_${FullName}.nc ; mv tmp_dia_t${oce}_to_t${atm}_${FullName}.nc dia_t${oce}_to_t${atm}_${FullName}.nc |
---|
| 368 | ncatted --history -a missing_value,OceFrac,d,,"" -a _FillValue,OceFrac,d,,"" dia_t${oce}_to_t${atm}_${FullName}.nc |
---|
[4298] | 369 | ncatted --history -a missing_value,OceMask,d,,"" -a _FillValue,OceMask,d,,"" dia_t${oce}_to_t${atm}_${FullName}.nc |
---|
| 370 | |
---|
[3620] | 371 | ## |
---|
[4298] | 372 | echo ${Titre}"Creates mask on ATM grid"${Norm} |
---|
[3620] | 373 | ## =========================================================================== |
---|
[4199] | 374 | cp dia_t${oce}_to_t${atm}_${FullName}.nc dia_t${oce}_to_t${atm}_${FullName}_mask.nc |
---|
[4298] | 375 | ncks --alphabetize --history --overwrite --variable OceFrac dia_t${oce}_to_t${atm}_${FullName}_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4317] | 376 | ncatted --history --attribute name,global,m,c,"${ATM}_grid_maskFrom_${OCE}.nc" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[3620] | 377 | |
---|
| 378 | cat <<EOF > creation_masque.nco |
---|
[4298] | 379 | Oce2AtmMask = OceMask ; |
---|
| 380 | where (OceMask > 0.0 ) Oce2AtmMask=1 ; |
---|
| 381 | where (OceMask <= 0.0 ) Oce2AtmMask=0 ; |
---|
[3620] | 382 | EOF |
---|
[4081] | 383 | |
---|
[4298] | 384 | ncap2 --history --overwrite --script-file creation_masque.nco dia_t${oce}_to_t${atm}_${FullName}.nc tmp_dia_${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 385 | ncks --overwrite --history --variable OceMask,OceFrac,Oce2AtmMask tmp_dia_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[3620] | 386 | |
---|
[4081] | 387 | if [[ $(ncdump -h ${ATM}_grid_maskFrom_${OCE}.nc | grep domain_dst | wc -l) -gt 0 ]] ; then |
---|
[4317] | 388 | echo "Change dimension names, and some attributes accordingly" |
---|
| 389 | ## =========================================================== |
---|
[4081] | 390 | case ${atm} in |
---|
| 391 | ( *ico* ) |
---|
[4088] | 392 | ncrename --history --dimension cell_domain_dst,cell ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 393 | ncrename --history --dimension nvertex_domain_dst,nvertex ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 394 | ncrename --history --variable lat_domain_dst,lat ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 395 | ncrename --history --variable lon_domain_dst,lon ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 396 | ncrename --history --variable bounds_lat_domain_dst,bounds_lat ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 397 | ncrename --history --variable bounds_lon_domain_dst,bounds_lon ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 398 | ncatted --history --attribute bounds,lat,m,c,"bounds_lat" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 399 | ncatted --history --attribute bounds,lon,m,c,"bounds_lon" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4081] | 400 | ;; |
---|
[4317] | 401 | ( *lmd* ) |
---|
| 402 | ncrename --history --variabl lon_domain_dst,lon ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 403 | ncrename --history --variable lat_domain_dst,lat ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 404 | ncrename --history --dimension lon_domain_dst,lon ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 405 | ncrename --history --dimension lat_domain_dst,lat ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4081] | 406 | ;; |
---|
| 407 | esac |
---|
| 408 | ncatted --history --attribute coordinates,OceFrac,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 409 | ncatted --history --attribute coordinates,OceMask,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4298] | 410 | ncatted --history --attribute coordinates,Oce2AtmMask,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4317] | 411 | |
---|
| 412 | ncatted --history --attribute long_name,OceFrac,c,c,"fraction of ocean in a grid cell" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 413 | ncatted --history --attribute units,OceFrac,c,c,"[0,1]" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 414 | ncatted --history --attribute long_name,OceMask,c,c,"fraction of ocean in a grid cell" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 415 | ncatted --history --attribute units,OceMask,c,c,"[0,1]" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 416 | ncatted --history --attribute long_name,Oce2AtmMask,c,c,"land mask" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 417 | ncatted --history --attribute units,Oce2AtmMask,c,c,"Land:0, Ocean:1" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4088] | 418 | |
---|
[4081] | 419 | fi |
---|
| 420 | |
---|
[4317] | 421 | ncks --history --alphabetize --append --variable aire atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 422 | ncatted --history --attribute units,aire,m,c,"m^2" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 423 | |
---|
[4081] | 424 | [[ ${atm} = *ico* ]] && ncks --alphabetize --history --append --variable bounds_lon,bounds_lat atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 425 | |
---|
[4298] | 426 | |
---|
| 427 | ## |
---|
[4199] | 428 | #echo ${Titre}"Creates mask of coastal OCE points"${Norm} |
---|
[3901] | 429 | ## =========================================================================== |
---|
[4199] | 430 | #${PyRun} python3 -u ComputeNemoCoast.py -n ${OcePerio} -i ${OCE}_coordinates_mask.nc # Creates OceCoastal |
---|
[4172] | 431 | |
---|
[3901] | 432 | ## |
---|
[4199] | 433 | #echo ${Titre}"Creates mask of coastal ATM points"${Norm} |
---|
[3901] | 434 | ## =========================================================================== |
---|
[4199] | 435 | #cat <<EOF > coastal.nco |
---|
| 436 | #AtmCoastal = OceFrac * 0.0 ; |
---|
| 437 | #where (OceFrac > 0.0 && OceFrac < 1.0 ) AtmCoastal = 1.0 ; |
---|
| 438 | #EOF |
---|
| 439 | #ncap2 --history --overwrite --script-file coastal.nco ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_coastal_maskFrom_${OCE}.nc |
---|
| 440 | #ncks --history --append --variable AtmCoastal ${ATM}_coastal_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 441 | #rm ${ATM}_coastal_maskFrom_${OCE}.nc |
---|
[4081] | 442 | |
---|
[3901] | 443 | ## |
---|
[4172] | 444 | echo ${Titre}"Other weights files"${Norm} |
---|
[3718] | 445 | ## =========================================================================== |
---|
[4153] | 446 | # Loop on commands |
---|
| 447 | for Command in ${CommandList[@]} |
---|
| 448 | do |
---|
| 449 | echo "Command parameters : ${Command}" |
---|
[4186] | 450 | setValues ${Command} |
---|
[4172] | 451 | if [[ ${Command} = "Runoff" ]] ; then okRunoff=yes ; continue ; fi |
---|
| 452 | if [[ ${Command} = "Calving" ]] ; then okCalving=yes ; continue ; fi |
---|
[4186] | 453 | if [[ ${Command} = "Grids" ]] ; then okGrids=yes ; continue ; fi |
---|
[4172] | 454 | |
---|
[4153] | 455 | ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc |
---|
[4298] | 456 | #ln -fs ${ATM}_grid.nc atm_grid.nc |
---|
| 457 | ln -fs ${ATM}_grid_maskFrom_${OCE}.nc atm_grid.nc |
---|
[4153] | 458 | |
---|
| 459 | case ${Direction} in |
---|
| 460 | ( o2a ) |
---|
| 461 | cp iodef_oce_to_atm.xml iodef.xml |
---|
[4082] | 462 | |
---|
[4317] | 463 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="mask_src"]' -k name -v maskutil_${DSTGRID} |
---|
[4298] | 464 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_dst"]/field[@id="mask_dst"]' -k name -v Oce2AtmMask |
---|
[4082] | 465 | |
---|
[4172] | 466 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_src"]/field[@id="mask_source"]' -k name -v maskutil_${SRCGRID} |
---|
| 467 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_src"]/field[@id="area_source"]' -k name -v area_grid_${SRCGRID} |
---|
[4298] | 468 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_dst"]/field[@id="mask_dest"]' -k name -v Oce2AtmMask |
---|
[4172] | 469 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_dst"]/field[@id="area_dest"]' -k name -v aire |
---|
[4153] | 470 | ;; |
---|
| 471 | ( a2o ) |
---|
| 472 | cp iodef_atm_to_oce.xml iodef.xml |
---|
[4082] | 473 | |
---|
[4298] | 474 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="mask_src"]' -k name -v Oce2AtmMask |
---|
[4172] | 475 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_dst"]/field[@id="mask_dst"]' -k name -v mask_${DSTGRID} |
---|
[4082] | 476 | |
---|
[4298] | 477 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_src"]/field[@id="mask_source"]' -k name -v Oce2AtmMask |
---|
[4172] | 478 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_src"]/field[@id="area_source"]' -k name -v aire |
---|
| 479 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_dst"]/field[@id="mask_dest"]' -k name -v mask_${DSTGRID} |
---|
| 480 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_dst"]/field[@id="area_dest"]' -k name -v area_grid_${DSTGRID} |
---|
[4153] | 481 | ;; |
---|
| 482 | esac |
---|
| 483 | |
---|
[4172] | 484 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} |
---|
| 485 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} |
---|
[4153] | 486 | |
---|
[4172] | 487 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} |
---|
| 488 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} |
---|
[4153] | 489 | |
---|
[4199] | 490 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.nc |
---|
[4172] | 491 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${numOrder} |
---|
| 492 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v ${Quantity} |
---|
| 493 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${Renormalize} |
---|
| 494 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v ${useArea} |
---|
[4153] | 495 | |
---|
[4199] | 496 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName} |
---|
[4172] | 497 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${SRC} mask interpolated to ${DST}" |
---|
| 498 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType} |
---|
| 499 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType} |
---|
| 500 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${Renormalize} |
---|
| 501 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${numOrder} |
---|
| 502 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t ${Quantity} |
---|
| 503 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t ${useArea} |
---|
[4153] | 504 | |
---|
[4199] | 505 | cp iodef.xml iodef_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.xml |
---|
[4172] | 506 | ${MpiRun} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} |
---|
[3719] | 507 | done |
---|
[4153] | 508 | |
---|
[3620] | 509 | ## |
---|
[4172] | 510 | echo ${Titre}"Add some metadata in file headers"${Norm} |
---|
[3620] | 511 | ## =========================================================================== |
---|
| 512 | |
---|
| 513 | NCO="$(ncks --version |& tail -1|sed 's/ncks //')" |
---|
[4172] | 514 | PYTHON_VER=$( python3 -c "import sys ; print (sys.version.split(' ')[0])" ) |
---|
[4199] | 515 | for InFile in $(ls *${oce}_to_*${atm}_*.nc *${atm}_to_*${oce}_*.nc ${ATM}_grid_maskFrom_${OCE}.nc 2> /dev/null) ; do |
---|
[3639] | 516 | ncatted --history \ |
---|
[3620] | 517 | --attribute LongName,global,d,, \ |
---|
| 518 | --attribute nco_openmp_thread_number,global,d,, \ |
---|
| 519 | --attribute Conventions,global,o,c,"CF-1.6" \ |
---|
| 520 | --attribute source,global,o,c,"IPSL Earth system model" \ |
---|
| 521 | --attribute group,global,o,c,"ICMC IPSL Climate Modelling Center" \ |
---|
| 522 | --attribute Institution,global,o,c,"IPSL https://www.ipsl.fr" \ |
---|
| 523 | --attribute Ocean,global,o,c,"${OCE} https://www.nemo-ocean.eu" \ |
---|
| 524 | --attribute Atmosphere,global,o,c,"${ATM} http://lmdz.lmd.jussieu.fr" \ |
---|
| 525 | --attribute production,global,o,c,"$(finger ${LOGNAME} | head -1 | awk '{print $4, $5}') " \ |
---|
| 526 | --attribute originalFiles,global,o,c,"${OCE}_coordinates_mask.nc ${ATM}_grid_mask.nc" \ |
---|
[4195] | 527 | --attribute associatedFiles,global,o,c,"grids_${CplModel}.nc areas_${CplModel}.nc masks_${CplModel}.nc" \ |
---|
[3620] | 528 | --attribute directory,global,o,c,"$(pwd)" \ |
---|
| 529 | --attribute description,global,o,c,"Fields needed by OASIS-MCT" \ |
---|
| 530 | --attribute title,global,o,c,"${InFile}.nc" \ |
---|
| 531 | --attribute Program,global,o,c,"Generated by ${PROGRAM}" \ |
---|
| 532 | --attribute timeStamp,global,o,c,"$(date)" \ |
---|
| 533 | --attribute HOSTNAME,global,o,c,"$(hostname)" \ |
---|
| 534 | --attribute LOGNAME,global,o,c,"$(whoami)" \ |
---|
| 535 | --attribute NCO,global,o,c,"NCO netCDF Operator ${NCO} http://nco.sourceforge.net" \ |
---|
[4172] | 536 | --attribute Python,global,o,c,"Python3 version ${PYTHON_VER}" \ |
---|
[3620] | 537 | --attribute OS,global,o,c,"$(uname -o)" \ |
---|
| 538 | --attribute release,global,o,c,"$(uname -r)" \ |
---|
| 539 | --attribute directory,global,o,c,"$(pwd)" \ |
---|
[3624] | 540 | --attribute description,global,o,c,"Generated with XIOS http://forge.ipsl.jussieu.fr/ioserver and MOSAIX https://forge.ipsl.jussieu.fr/igcmg/browser/TOOLS/MOSAIX" \ |
---|
[4090] | 541 | --attribute SVN_Author,global,o,c,'$Author$' \ |
---|
| 542 | --attribute SVN_Date,global,o,c,'$Date$' \ |
---|
| 543 | --attribute SVN_Revision,global,o,c,'$Revision$' \ |
---|
| 544 | --attribute SVN_Id,global,o,c,'$Id$' \ |
---|
[3620] | 545 | ${InFile} |
---|
| 546 | done |
---|
| 547 | ## |
---|
[4172] | 548 | echo ${Titre}"Update and complete weight files to fit OASIS requested format"${Norm} |
---|
[3620] | 549 | ## =========================================================================== |
---|
| 550 | cat <<EOF > add_dim.nco |
---|
| 551 | defdim("num_wgts",1) ; |
---|
| 552 | weight[n_weight, num_wgts] = weight ; |
---|
| 553 | EOF |
---|
| 554 | |
---|
[3719] | 555 | for rmpFile in rmp_*.nc ; do |
---|
[4199] | 556 | mv ${rmpFile} tmp_${rmpFile} |
---|
| 557 | ncap2 --history --script-file add_dim.nco tmp_${rmpFile} ${rmpFile} ; rm tmp_${rmpFile} |
---|
[3620] | 558 | |
---|
[3719] | 559 | ncrename --history --dimension n_weight,num_links ${rmpFile} |
---|
| 560 | ncrename --history --variable src_idx,src_address ${rmpFile} |
---|
| 561 | ncrename --history --variable dst_idx,dst_address ${rmpFile} |
---|
| 562 | ncrename --history --variable weight,remap_matrix ${rmpFile} |
---|
| 563 | case ${rmpFile} in |
---|
[4082] | 564 | ( *1storder* ) ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" ${rmpFile} ;; |
---|
| 565 | ( *2ndorder* ) ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 2nd order" ${rmpFile} ;; |
---|
[3620] | 566 | esac |
---|
[3719] | 567 | case ${rmpFile} in |
---|
[4082] | 568 | ( *_Normalized* ) ncatted --history --attribute map_method,global,o,c,"Normalization: true" ${rmpFile} ;; |
---|
| 569 | ( *_UnNormalized* ) ncatted --history --attribute map_method,global,o,c,"Normalization: false" ${rmpFile} ;; |
---|
[3719] | 570 | esac |
---|
[4082] | 571 | case ${rmpFile} in |
---|
| 572 | ( *Integrated* ) ncatted --history --attribute map_method,global,o,c,"Quantity: true" ${rmpFile} ;; |
---|
| 573 | ( *Surfacic* ) ncatted --history --attribute map_method,global,o,c,"Quantity: false" ${rmpFile} ;; |
---|
| 574 | esac |
---|
[3719] | 575 | ncatted --history --attribute conventions,global,o,c,"SCRIP" ${rmpFile} |
---|
| 576 | ncatted --history --attribute normalization,global,o,c,"none" ${rmpFile} |
---|
[3620] | 577 | |
---|
[3719] | 578 | case ${rmpFile} in |
---|
[3620] | 579 | ( rmp_*${oce}_to_t${atm}_* ) |
---|
[3639] | 580 | ncatted --history \ |
---|
[3620] | 581 | --attribute title,global,o,c,"Weights ${OCE} to ${ATM}" \ |
---|
[4153] | 582 | --attribute source_grid,global,o,c,"${oceDomainType}" \ |
---|
| 583 | --attribute dest_grid,global,o,c,"${atmDomainType}" \ |
---|
[3719] | 584 | ${rmpFile} |
---|
[3620] | 585 | ;; |
---|
| 586 | ( rmp_*${atm}_to_*${oce}_* ) |
---|
[3639] | 587 | ncatted --history \ |
---|
[3620] | 588 | --attribute title,global,o,c,"Weights ${ATM} to ${OCE}" \ |
---|
[4153] | 589 | --attribute source_grid,global,o,c,"${atmDomainType}" \ |
---|
| 590 | --attribute dest_grid,global,o,c,"${oceDomainType}" \ |
---|
[3719] | 591 | ${rmpFile} |
---|
[3620] | 592 | ;; |
---|
| 593 | esac |
---|
| 594 | done |
---|
| 595 | |
---|
[4186] | 596 | ls |
---|
[3620] | 597 | ## |
---|
[4172] | 598 | echo ${Titre}"Add missing variables in rmp files"${Norm} |
---|
[3639] | 599 | ## =========================================================================== |
---|
[4259] | 600 | for rmpFile in $(ls rmp_?${atm}_to_[tuv]${oce}_*.nc rmp_[tuv]${oce}_to_t${atm}_*.nc 2> /dev/null ) ; do |
---|
[3901] | 601 | echo ${rmpFile} |
---|
[3719] | 602 | a_to_o=false ; o_to_a=false |
---|
| 603 | case ${rmpFile} in |
---|
| 604 | ( rmp_?${oce}_to_?${atm}_*.nc ) o_to_a=true ;; |
---|
| 605 | ( rmp_?${atm}_to_?${oce}_*.nc ) a_to_o=true ;; |
---|
| 606 | esac |
---|
| 607 | |
---|
[3901] | 608 | for Grid in t u v o c ; do # Identify grids |
---|
| 609 | [[ ${rmpFile} = rmp_${Grid}${oce}_to_?${atm}_*.nc ]] && ogrid=${Grid} |
---|
| 610 | [[ ${rmpFile} = rmp_?${oce}_to_${Grid}${atm}_*.nc ]] && agrid=${Grid} |
---|
| 611 | [[ ${rmpFile} = rmp_${Grid}${atm}_to_?${oce}_*.nc ]] && agrid=${Grid} |
---|
| 612 | [[ ${rmpFile} = rmp_?${atm}_to_${Grid}${oce}_*.nc ]] && ogrid=${Grid} |
---|
[3719] | 613 | done |
---|
| 614 | OGRID=${ogrid^} |
---|
| 615 | AGRID=${agrid^} |
---|
[3639] | 616 | |
---|
[3719] | 617 | cat <<EOF >add_varoce.nco |
---|
[3639] | 618 | defdim ("src_grid_size" , \$x_grid_${OGRID}.size*\$y_grid_${OGRID}.size) ; |
---|
| 619 | defdim ("src_grid_corners", 4) ; |
---|
| 620 | defdim ("src_grid_rank" , 2) ; |
---|
| 621 | // |
---|
| 622 | src_grid_dims[src_grid_rank] = { \$y_grid_${OGRID}.size, \$x_grid_${OGRID}.size } ; |
---|
| 623 | // |
---|
| 624 | src_grid_center_lat [src_grid_size] = 0.0d ; |
---|
| 625 | src_grid_center_lon [src_grid_size] = 0.0d ; |
---|
| 626 | src_grid_center_lat (:) = nav_lat_grid_${OGRID}(:,:) ; |
---|
| 627 | src_grid_center_lon (:) = nav_lon_grid_${OGRID}(:,:) ; |
---|
| 628 | // |
---|
| 629 | src_grid_corner_lat [src_grid_size, src_grid_corners] = 0.0d ; |
---|
| 630 | src_grid_corner_lon [src_grid_size, src_grid_corners] = 0.0d ; |
---|
| 631 | src_grid_corner_lat(:,:) = bounds_lat_grid_${OGRID}(:,:,:) ; |
---|
| 632 | src_grid_corner_lon(:,:) = bounds_lon_grid_${OGRID}(:,:,:) ; |
---|
| 633 | // |
---|
| 634 | src_grid_imask [src_grid_size] = 0 ; |
---|
| 635 | src_grid_area [src_grid_size] = 0.0d ; |
---|
| 636 | src_grid_frac [src_grid_size] = 1.0d ; |
---|
| 637 | src_grid_imask (:) = 1 - mask_${OGRID}(:,:) ; |
---|
| 638 | src_grid_imask.int() ; |
---|
| 639 | src_grid_area (:) = area_grid_${OGRID}(:,:) ; |
---|
| 640 | EOF |
---|
| 641 | |
---|
[4146] | 642 | cp add_varoce.nco add_varoce_$(basename ${rmpFile} .nc)_o_to_a.nco |
---|
[4199] | 643 | [[ ${o_to_a} = true ]] && ncap2 --history --append --script-file add_varoce_$(basename ${rmpFile} .nc)_o_to_a.nco ${OCE}_coordinates_mask.nc ${rmpFile} |
---|
[3719] | 644 | sed --in-place "s/src_/dst_/g" add_varoce.nco |
---|
[4146] | 645 | cp add_varoce.nco add_varoce_$(basename ${rmpFile} .nc)_a_to_o.nco |
---|
[4199] | 646 | [[ ${a_to_o} = true ]] && ncap2 --history --append --script-file add_varoce_$(basename ${rmpFile} .nc)_a_to_o.nco ${OCE}_coordinates_mask.nc ${rmpFile} |
---|
[3719] | 647 | |
---|
| 648 | if [[ ${atm} = ico ]] ; then |
---|
| 649 | cat <<EOF >add_varatm.nco |
---|
[3639] | 650 | defdim ("dst_grid_size" , \$cell.size) ; |
---|
| 651 | defdim ("dst_grid_corners", 6) ; |
---|
| 652 | defdim ("dst_grid_rank" , 2) ; |
---|
| 653 | // |
---|
| 654 | dst_grid_dims[dst_grid_rank] = { \$cell.size, 1 } ; |
---|
| 655 | // |
---|
| 656 | dst_grid_center_lat [dst_grid_size] = 0.0d ; |
---|
| 657 | dst_grid_center_lon [dst_grid_size] = 0.0d ; |
---|
| 658 | dst_grid_center_lat (:) = lat(:) ; |
---|
| 659 | dst_grid_center_lon (:) = lon(:) ; |
---|
| 660 | // |
---|
| 661 | dst_grid_corner_lat [dst_grid_size, dst_grid_corners] = 0.0d ; |
---|
| 662 | dst_grid_corner_lon [dst_grid_size, dst_grid_corners] = 0.0d ; |
---|
| 663 | dst_grid_corner_lat(:,:) = bounds_lat(:,:) ; |
---|
| 664 | dst_grid_corner_lon(:,:) = bounds_lon(:,:) ; |
---|
| 665 | // |
---|
| 666 | dst_grid_imask [dst_grid_size] = 0 ; |
---|
| 667 | dst_grid_area [dst_grid_size] = 0.0d ; |
---|
| 668 | dst_grid_frac [dst_grid_size] = 1.0d ; |
---|
[4298] | 669 | dst_grid_imask (:) = 1 - Oce2AtmMask(:) ; |
---|
[3639] | 670 | dst_grid_imask.int() ; |
---|
| 671 | dst_grid_area (:) = aire(:) ; |
---|
[4259] | 672 | dst_grid_frac (:) = OceFrac(:) ; |
---|
[3639] | 673 | EOF |
---|
[4146] | 674 | cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco |
---|
[3719] | 675 | if [[ ${o_to_a} = true ]] ; then |
---|
[4199] | 676 | ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} |
---|
[3719] | 677 | ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc |
---|
| 678 | mv rmp_tmp.nc ${rmpFile} |
---|
| 679 | fi |
---|
[3718] | 680 | |
---|
[3719] | 681 | sed --in-place "s/dst_/src_/g" add_varatm.nco |
---|
[4146] | 682 | cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco |
---|
[3719] | 683 | if [[ ${a_to_o} = true ]] ; then |
---|
[4199] | 684 | ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} |
---|
[3719] | 685 | ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc |
---|
| 686 | mv rmp_tmp.nc ${rmpFile} |
---|
| 687 | fi |
---|
| 688 | fi |
---|
[3966] | 689 | |
---|
[3719] | 690 | if [[ ${atm} = lmd ]] ; then |
---|
| 691 | cat <<EOF >add_varatm.nco |
---|
[3639] | 692 | defdim ("dst_grid_size" , \$lon.size*\$lat.size) ; |
---|
| 693 | defdim ("dst_grid_corners", 4) ; |
---|
| 694 | defdim ("dst_grid_rank" , 2) ; |
---|
| 695 | // |
---|
| 696 | dst_grid_dims[dst_grid_rank] = { \$lat.size, \$lon.size } ; |
---|
| 697 | // |
---|
| 698 | dst_grid_center_lat [dst_grid_size] = 0.0d ; |
---|
| 699 | dst_grid_center_lon [dst_grid_size] = 0.0d ; |
---|
| 700 | lat0lon[lat,lon] = lat(:)+0*lon(:) ; |
---|
| 701 | lon0lat[lat,lon] = lon(:)+0*lat(:) ; |
---|
| 702 | dst_grid_center_lat (:) = lat0lon(:,:) ; |
---|
| 703 | dst_grid_center_lon (:) = lon0lat(:,:) ; |
---|
| 704 | // |
---|
| 705 | //dst_grid_corner_lat [dst_grid_size, dst_grid_corners] = 0.0d ; // Not available for LMDZ lon/lat grid |
---|
| 706 | //dst_grid_corner_lon [dst_grid_size, dst_grid_corners] = 0.0d ; |
---|
| 707 | //dst_grid_corner_lat(:,:) = bounds_lat(:,:) ; |
---|
| 708 | //dst_grid_corner_lon(:,:) = bounds_lon(:,:) ; |
---|
| 709 | // |
---|
| 710 | dst_grid_imask [dst_grid_size] = 0 ; |
---|
| 711 | dst_grid_area [dst_grid_size] = 0.0d ; |
---|
| 712 | dst_grid_frac [dst_grid_size] = 1.0d ; |
---|
[4298] | 713 | dst_grid_imask (:) = 1 - Oce2AtmMask(:,:) ; |
---|
[3639] | 714 | dst_grid_imask.int() ; |
---|
| 715 | dst_grid_area (:) = aire(:,:) ; |
---|
[4259] | 716 | dst_grid_frac (:) = OceFrac(:,:) ; |
---|
[3639] | 717 | EOF |
---|
[4146] | 718 | cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco |
---|
[3719] | 719 | if [[ ${o_to_a} = true ]] ; then |
---|
[4199] | 720 | ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} |
---|
[3719] | 721 | ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc |
---|
| 722 | mv rmp_tmp.nc ${rmpFile} |
---|
| 723 | fi |
---|
| 724 | |
---|
| 725 | sed --in-place "s/dst/src/g" add_varatm.nco |
---|
[4146] | 726 | cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco |
---|
[3719] | 727 | if [[ ${a_to_o} = true ]] ; then |
---|
[4199] | 728 | ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} |
---|
[3719] | 729 | ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc |
---|
| 730 | mv rmp_tmp.nc ${rmpFile} |
---|
| 731 | fi |
---|
| 732 | fi |
---|
[3639] | 733 | done |
---|
[3901] | 734 | ls -al ${OCE}_coordinates_mask.nc |
---|
[4097] | 735 | |
---|
[3639] | 736 | ## |
---|
[4186] | 737 | ## ============================================================================ |
---|
[4172] | 738 | echo ${Titre}"Creates and save auxiliary files for OASIS : grids.nc, areas.nc and masks.nc"${Norm} |
---|
[4186] | 739 | cp ${SUBMIT_DIR}/CreateOasisGrids.bash . |
---|
| 740 | bash CreateOasisGrids.bash --oce ${OCE} --atm ${ATM} |
---|
[4097] | 741 | |
---|
| 742 | |
---|
| 743 | ## |
---|
[4172] | 744 | echo ${Titre}"Runoff weights"${Norm} |
---|
[4097] | 745 | ## =========================================================================== |
---|
[4186] | 746 | if [[ "X${okRunoff}" = "Xyes" ]] ; then |
---|
[4195] | 747 | ${PyRun} python3 -u RunoffWeights.py --oce=${OCE} --atm=${ATM} \ |
---|
[4172] | 748 | --atmCoastWidth=${atmCoastWidth} --oceCoastWidth=${oceCoastWidth} --searchRadius=${searchRadius} \ |
---|
[4195] | 749 | --grids=grids_${CplModel}.nc --areas=areas_${CplModel}.nc --masks=masks_${CplModel}.nc \ |
---|
[4199] | 750 | --o2a=${ATM}_grid_maskFrom_${OCE}.nc --output=rmp_t${atm}_to_t${oce}_runoff_${runOff_atmQuantity}_to_${runOff_oceQuantity}.nc \ |
---|
| 751 | --fmt=${FMT_XIOS} \ |
---|
[4186] | 752 | --atmQuantity=${runOff_atmQuantity} --oceQuantity=${runOff_oceQuantity} |
---|
[4172] | 753 | fi |
---|
[4097] | 754 | |
---|
| 755 | ## |
---|
[4172] | 756 | echo ${Titre}"Calving weights"${Norm} |
---|
[3620] | 757 | ## =========================================================================== |
---|
[4172] | 758 | if [[ "X${okCalving}" = "Xyes" ]] ; then |
---|
| 759 | case ${OCE} in |
---|
[4298] | 760 | ( eORCA025* ) |
---|
[4186] | 761 | cp /ccc/work/cont003/gencmip6/deshayej/eORCA_R025_runoff_v1.2.nc . |
---|
[4199] | 762 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth.nc --fmt=${FMT_XIOS} \ |
---|
[4186] | 763 | --oce=${OCE} --atm=${ATM} --type=nosouth --dir=. |
---|
[4199] | 764 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg.nc --fmt=${FMT_XIOS} \ |
---|
[4186] | 765 | --oce=${OCE} --atm=${ATM} --type=iceberg --dir=. --repartition_file=eORCA_R025_runoff_v1.2.nc --repartition_var=Icb_flux |
---|
[4199] | 766 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf.nc --fmt=${FMT_XIOS} \ |
---|
[4186] | 767 | --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=. --repartition_file=eORCA_R025_runoff_v1.2.nc --repartition_var=sornfisf |
---|
[4172] | 768 | ;; |
---|
| 769 | |
---|
| 770 | ( eORCA1.2 ) |
---|
| 771 | cp ${R_IN}/OCE/NEMO/ORCA1_LIM3_PISCES/v3.6_stable/runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc . |
---|
[4199] | 772 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth.nc --fmt=${FMT_XIOS}\ |
---|
[4172] | 773 | --oce=${OCE} --atm=${ATM} --type=nosouth --dir=. |
---|
[4199] | 774 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg.nc --fmt=${FMT_XIOS}\ |
---|
[4172] | 775 | --oce=${OCE} --atm=${ATM} --type=iceberg --dir=. --repartition_file=runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc --repartition_var=Icb_flux |
---|
[4199] | 776 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf.nc --fmt=${FMT_XIOS}\ |
---|
[4172] | 777 | --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=. --repartition_file=runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc --repartition_var=sornfisf |
---|
| 778 | ;; |
---|
| 779 | |
---|
| 780 | ( * ) |
---|
[4199] | 781 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_full.nc --fmt=${FMT_XIOS} \ |
---|
[4172] | 782 | --oce=${OCE} --atm=${ATM} --type=full --dir=. |
---|
| 783 | ;; |
---|
| 784 | |
---|
| 785 | esac |
---|
| 786 | fi |
---|
| 787 | |
---|
| 788 | ## |
---|
[4199] | 789 | echo ${Titre}"Simplifies headers, add version and comment"${Norm} |
---|
[4172] | 790 | ## =========================================================================== |
---|
[4199] | 791 | for File in $(ls dia_*.nc rmp_*.nc ${ATM}_grid_maskFrom_${OCE}*.nc areas_${OCE}x${ATM}*.nc grids_${OCE}x${ATM}*.nc masks_${OCE}x${ATM}*.nc 2> /dev/null ) ; do |
---|
[4037] | 792 | ncatted --history --attribute history_of_appended_files,global,d,c,"" ${File} |
---|
[4199] | 793 | ncatted --history --attribute history,global,d,c,"" ${File} |
---|
[4172] | 794 | [[ "X${Comment}" != "X" ]] && ncatted --history --attribute Comment,global,o,c,"${Comment}" ${File} |
---|
| 795 | [[ "X${Version}" != "X" ]] && ncatted --history --attribute Version,global,o,c,"${Version}" ${File} |
---|
[4199] | 796 | [[ "X${Tag}" != "X" ]] && ncatted --history --attribute Version,global,o,c,"${Tag}" ${File} |
---|
| 797 | done |
---|
| 798 | |
---|
| 799 | ## |
---|
| 800 | echo ${Titre}"Rename rmp and dia files"${Norm} |
---|
| 801 | ## =========================================================================== |
---|
[4259] | 802 | for File in $(ls *${oce}*${atm}* *${atm}*${oce}* 2> /dev/null ); do |
---|
[3719] | 803 | NewFile=$(echo ${File} | sed -e "s/${atm}/${ATM}/" -e "s/${oce}/${OCE}/" ) |
---|
[4259] | 804 | mv ${File} ${NewFile} |
---|
[3620] | 805 | done |
---|
| 806 | |
---|
[4199] | 807 | ## |
---|
| 808 | echo ${Titre}"Add Tag"${Norm} |
---|
| 809 | ## =========================================================================== |
---|
| 810 | if [[ "X${Tag}" != "X" ]] ; then |
---|
| 811 | for File in $(ls dia_*.nc rmp_*.nc ${ATM}_grid_maskFrom_${OCE}*.nc areas_${OCE}x${ATM}*.nc grids_${OCE}x${ATM}*.nc masks_${OCE}x${ATM}*.nc 2> /dev/null ) ; do |
---|
| 812 | mv ${File} $(basename ${File} .nc)_${Tag}.nc |
---|
| 813 | done |
---|
[4186] | 814 | fi |
---|
[4199] | 815 | ## |
---|
| 816 | echo ${Titre}"Add Version"${Norm} |
---|
| 817 | ## =========================================================================== |
---|
| 818 | if [[ "X${Version}" != "X" ]] ; then |
---|
| 819 | for File in $(ls dia_*.nc rmp_*.nc ${ATM}_grid_maskFrom_${OCE}*.nc areas_${OCE}x${ATM}*.nc grids_${OCE}x${ATM}*.nc masks_${OCE}x${ATM}*.nc 2> /dev/null ) ; do |
---|
| 820 | mv ${File} $(basename ${File} .nc)_${Version}.nc |
---|
| 821 | done |
---|
| 822 | fi |
---|
| 823 | |
---|
| 824 | ## =========================================================================== |
---|
| 825 | echo ${Titre}"Save results"${Norm} |
---|
| 826 | ## =========================================================================== |
---|
| 827 | for File in $(ls dia_*.nc rmp_*.nc ${ATM}_grid_maskFrom_${OCE}*.nc areas_${OCE}x${ATM}*.nc grids_${OCE}x${ATM}*.nc masks_${OCE}x${ATM}*.nc 2> /dev/null ) ; do |
---|
| 828 | cp ${File} ${SUBMIT_DIR} |
---|
| 829 | done |
---|
[4172] | 830 | |
---|
[4199] | 831 | |
---|
[3620] | 832 | ## |
---|
[4172] | 833 | echo ${Titre}"Creates a README.txt file"${Norm} |
---|
[4090] | 834 | ## =========================================================================== |
---|
| 835 | [[ -f README.txt ]] && rm README.txt |
---|
[4298] | 836 | UUID=$(uuid) |
---|
[3620] | 837 | |
---|
[4090] | 838 | cat <<EOF > README.txt |
---|
| 839 | Files produced by CreateWeightsMask.bash and CreateOasisGrids.bash |
---|
| 840 | |
---|
| 841 | rmp_* are weights files |
---|
| 842 | dia_* are diagnostic files not needed for the coupler |
---|
[4195] | 843 | grids_${CplModel}.nc areas_${CplModel}.nc masks_${CplModel}.nc are auxiliary file needed by OASIS-MCT |
---|
[4090] | 844 | All files have the same uuid in the global attributes |
---|
| 845 | |
---|
| 846 | Description : Weigths and auxiliary files for coupling ${OCE} and ${ATM} needed by OASIS-MCT |
---|
| 847 | Conventions : CF-1.6 |
---|
| 848 | source : IPSL Earth system model |
---|
| 849 | group : ICMC IPSL Climate Modelling Center |
---|
| 850 | Institution : IPSL https://www.ipsl.fr |
---|
| 851 | Ocean : ${OCE} https://www.nemo-ocean.eu |
---|
| 852 | Atmosphere : ${ATM} http://lmdz.lmd.jussieu.fr |
---|
| 853 | production : $(finger ${LOGNAME} | head -1 | awk '{print $4, $5}') |
---|
| 854 | originalFiles : ${OCE}_coordinates_mask.nc ${ATM}_grid_mask.nc |
---|
[4195] | 855 | associatedFiles : grids_${CplModel}.nc areas_${CplModel}.nc masks_${CplModel}.nc |
---|
[4090] | 856 | directory : $(pwd) |
---|
| 857 | timeStamp : $(date) |
---|
| 858 | uuid : ${UUID} |
---|
| 859 | HOSTNAME : $(hostname) |
---|
| 860 | LOGNAME : $(whoami) |
---|
| 861 | NCO : NCO netCDF Operator ${NCO} http://nco.sourceforge.net |
---|
| 862 | Python version : ${PYTHON_VER} |
---|
| 863 | OS : $(uname -o) |
---|
| 864 | release : $(uname -r) |
---|
| 865 | hardware : $(uname -i) |
---|
[4091] | 866 | EOF |
---|
[4090] | 867 | |
---|
[4091] | 868 | echo 'SVN Information : ' >> README.txt |
---|
| 869 | echo '$Author$ ' >> README.txt |
---|
| 870 | echo '$Date$ ' >> README.txt |
---|
| 871 | echo '$Revision$ ' >> README.txt |
---|
| 872 | echo '$Id$ ' >> README.txt |
---|
| 873 | echo '$HeadURL$ ' >> README.txt |
---|
[4090] | 874 | |
---|
[4172] | 875 | echo ${Titre}"Compute checksums and add them to README"${Norm} |
---|
[4199] | 876 | # ------------------------------------------------------------ |
---|
[4091] | 877 | cat << EOF >> README.txt |
---|
[4090] | 878 | |
---|
[4159] | 879 | Files produced, with checksum produced by Unix command shasum (version $(shasum --version)) with default algorithm |
---|
[4090] | 880 | |
---|
| 881 | EOF |
---|
| 882 | |
---|
[4199] | 883 | for file in $(ls dia_*.nc rmp_*.nc ${ATM}_grid_maskFrom_${OCE}*.nc areas_${OCE}x${ATM}*.nc grids_${OCE}x${ATM}*.nc masks_${OCE}x${ATM}*.nc 2> /dev/null ) ; do |
---|
[4298] | 884 | ncatted --attribute uuid,global,o,c,"${UUID}" ${file} |
---|
[4090] | 885 | echo "$(shasum ${file})" >> README.txt |
---|
| 886 | done |
---|
| 887 | |
---|
| 888 | cat <<EOF >> README.txt |
---|
| 889 | |
---|
| 890 | ================= That's all folk's ! ======================== |
---|
| 891 | EOF |
---|
| 892 | |
---|
[4259] | 893 | if [[ "X${Version}" != "X" ]] ; then |
---|
| 894 | cp README.txt ${SUBMIT_DIR}/README_${CplModel}_MOSAIX_${Version}.txt |
---|
| 895 | else |
---|
| 896 | cp README.txt ${SUBMIT_DIR}/README_${CplModel}_MOSAIX.txt |
---|
| 897 | fi |
---|
[3620] | 898 | ## =========================================================================== |
---|
| 899 | ## |
---|
[4172] | 900 | echo ${Titre}" That's all folk's !!! "${Norm} |
---|
[3620] | 901 | ## |
---|
| 902 | ## =========================================================================== |
---|
| 903 | |
---|