Changeset 4172 for TOOLS/MOSAIX/CreateWeightsMask.bash
- Timestamp:
- 12/05/18 11:17:10 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/MOSAIX/CreateWeightsMask.bash
r4159 r4172 38 38 # $HeadURL$ 39 39 # 40 set +vx 40 41 export Bold=$(tput bold) 41 42 export Unde=$(tput smul) ; export OffUnde=$(tput rmul) … … 45 46 for i in $(seq 0 7 ) ; do eval "export ${couleurs[$i]}=$(tput setf $i)" ; done 46 47 export Norm=$(tput sgr0 ) 48 export Titre=${Bold}${Blue} 47 49 48 50 ## … … 52 54 53 55 # 54 # Defines models 56 echo ${Titre}"Defines models"${Norm} 55 57 # ============== 56 #OCE=ORCA2.358 OCE=ORCA2.3 57 59 #OCE=eORCA1.2 58 OCE=eORCA02560 #OCE=eORCA025 59 61 60 62 #ATM=ICO30 … … 63 65 ATM=LMD9695 64 66 #ATM=LMD144142 67 #ATM=LMD256256 68 69 # Runoff parameter (LMDZ grids only) 70 atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=1000.0 71 72 if [[ ${OCE} = ORCA2.3 && ${ATM} = LMD9695 ]] ; then atmCoastWidth=2 ; oceCoastWidth=1 ; searchRadius=1000.0 ; fi 73 if [[ ${OCE} = ORCA2.3 && ${ATM} = LMD144142 ]] ; then atmCoastWidth=2 ; oceCoastWidth=1 ; searchRadius=1000.0 ; fi 74 if [[ ${OCE} = eORCA1.2 && ${ATM} = LMD9695 ]] ; then atmCoastWidth=2 ; oceCoastWidth=3 ; searchRadius=1000.0 ; fi 75 if [[ ${OCE} = eORCA1.2 && ${ATM} = LMD144142 ]] ; then atmCoastWidth=2 ; oceCoastWidth=3 ; searchRadius=1000.0 ; fi 65 76 66 77 # Default values, used to create ocean fraction on atmospheric grid 67 78 DefaultValues=( Direction=o2a,oceGrid=t,atmGrid=t,Order=1st,Quantity=false,Renormalize=false,useArea=false,maskSrc=true,maskDst=false ) 68 79 69 # List of weights to build 70 CommandList=( \ 71 Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true \ 72 Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true \ 73 Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true \ 74 Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=v,useArea=true,maskSrc=true,maskDst=true \ 75 Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=c,oceGrid=t,useArea=true,maskSrc=true,maskDst=true \ 76 ) 77 78 # Each item in CommandList describes the property of interpolation weights to generate. 80 ## List of weights to build 81 ## ==================================================================================================================================== 82 # 83 # Each item in CommandList describes the properties of interpolation weights to generate. 79 84 # White spaces separate analysis. No spaces in any analysis. 85 # 86 # Specific commands : 'Runoff', 'Calving' 80 87 # 81 88 # Keywords : … … 85 92 # or intensive value (temperature, salinity, sea-ice fraction, ...) 86 93 # Renormalize : used when source grid is masked, to use values on non masked points only 87 # oceGrid : t, u or v point for OPAgrid94 # oceGrid : t, u or v point for NEMO C grid 88 95 # atmGrid : up to know, only t grid used in the atmosphere 89 96 # useArea : if true area from the model metrics is used. If false, areas are computed by XIOS from grid corners … … 91 98 # maskDst : true to use the destination grid mask, false to use all grid points 92 99 # 100 # Classic cases 101 AtmOceFluxes=" Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true" # Heat and water fluxes 102 OceAtmTemp=" Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true" # Temperature, sea-ice fraction, albedo 103 AtmOceStressU="Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true" # Wind stress to NEMO U point 104 AtmOceStressV="Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=v,useArea=true,maskSrc=true,maskDst=true" # Wind stress to NEMO V point 105 # Other cases 106 OceAtmFluxes=" Direction=o2a,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true" # e.g. CO2 fluxes 107 AtmOceTemp=" Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true" # e.g. T and S correction from DWL parametrization 108 AtmOceCoastal="Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=c,oceGrid=t,useArea=true,maskSrc=true,maskDst=true" # Runoff atm to oce, limited to oce coastal points 109 110 CommandList=( ${AtmOceFluxes} Runoff Calving ) 111 112 #CommandList=( Runoff Calving ) #\ 113 # Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true \ 114 # Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true \ 115 # Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true \ 116 # Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=v,useArea=true,maskSrc=true,maskDst=true \ 117 # Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=c,oceGrid=t,useArea=true,maskSrc=true,maskDst=true \ 118 # Calving \ 119 # Runoff \ 120 # ) 121 122 123 124 Comment="Preliminary attempt - Do not trust !" 125 #Version 93 126 94 127 ## =========================================================================== … … 169 202 SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}} 170 203 PROGRAM=${BRIDGE_MSUB_REQNAME} 171 MPIRUN=ccc_mprun 204 MpiRun="time ccc_mprun" 205 PyRun="ccc_mprun -n 1" 172 206 source ${SUBMIT_DIR}/arch.env 173 207 module load nco 174 module load cdo175 208 #source $(ccc_home -u igcmg)/MachineEnvironment/irene/env_irene 176 module load python /2.7.8209 module load python3 177 210 module load datadir/igcmg 178 211 module list … … 182 215 TMPDIR=${HOME}/Scratch/TMP 183 216 SUBMIT_DIR=$(pwd) 184 MPIRUN=/opt/local/bin/mpirun -n 4 217 MpiRun="/opt/local/bin/mpirun -n 4" 218 PyRun="time" 185 219 ;; 186 220 ( * ) exit -1 ;; … … 209 243 case ${OCE} in # Periodicity type of ORCA grid 210 244 ( ORCA2.3* ) OcePerio=4 ;; 211 ( ORCA1* | eORCA1*) OcePerio=6 ;;245 ( ORCA1* | eORCA1* ) OcePerio=6 ;; 212 246 ( ORCA025* | eORCA025 ) OcePerio=6 ;; 213 247 esac 214 248 # 215 # Format for OASIS files : should be NetCDF3 classic or NetCDF3 64 bits 249 echo ${Titre}"Format for OASIS files : should be NetCDF3 classic or NetCDF3 64 bits"${Norm} 216 250 # --------------------------------------------------------------------------- 217 251 FMT_OASIS=64bit … … 229 263 ncks --overwrite --fl_fmt=${FMT_OASIS} --history ${ATM}_grid.nc ${ATM}_grid_${FMT_OASIS}.nc 230 264 # 231 # Creates OCEAN C grid : redundant points removed to compute proper integrals # A passer dans CreateWeights 265 echo ${Titre}"Creates OCEAN C grid : redundant points removed to compute proper integrals # A passer dans CreateWeights"${Norm} 232 266 # -------------------------------------------------------------------------------------------------------- 233 267 cat <<EOF >add_c_grid.nco … … 258 292 259 293 ## 260 ## NEMO T point towards ATM - 1st order 294 echo ${Titre}"NEMO T point towards ATM - 1st order"${Norm} 261 295 ## =========================================================================== 262 296 echo "Command parameters : ${Command}" … … 267 301 cp iodef_oce_to_atm.xml iodef.xml 268 302 269 python 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_T270 python 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_T271 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType}272 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType}273 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1274 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v false275 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false276 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v false277 python 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_T278 python 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_T279 python 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}_${Suffix}280 python 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}"281 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType}282 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType}283 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t 1284 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType}285 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType}286 python 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}_${Suffix}.nc287 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1288 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t false289 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t false290 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t false291 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false292 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v false293 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v false303 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 304 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 305 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} 306 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 307 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 308 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v false 309 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false 310 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 311 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 312 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 313 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}_${Suffix} 314 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}" 315 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType} 316 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType} 317 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t 1 318 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} 319 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 320 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}_${Suffix}.nc 321 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 322 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t false 323 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t false 324 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t false 325 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false 326 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v false 327 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 294 328 295 329 cp iodef.xml iodef_${srcGrid}${src}_to_${dstGrid}${dst}_${Suffix}.xml … … 297 331 ln -fs ${ATM}_grid.nc atm_grid.nc 298 332 299 time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} 300 ## 301 ## Correct spurious values (extremes) 333 ${MpiRun} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} 334 335 ## 336 echo ${Titre}"Correct spurious values (extremes)"${Norm} 302 337 ## =========================================================================== 303 338 cat <<EOF > correction_masque.nco … … 313 348 314 349 ## 315 ## Creates ocean fractions on ATM grid 350 echo ${Titre}"Creates ocean fractions on ATM grid"${Norm} 316 351 ## =========================================================================== 317 352 cp dia_t${oce}_to_t${atm}_${Suffix}.nc dia_t${oce}_to_t${atm}_${Suffix}_mask.nc … … 330 365 rm dia_t${oce}_to_t${atm}_${Suffix}_mask.nc 331 366 332 # Change dimension names, and some attributes accordingly 367 echo "Change dimension names, and some attributes accordingly" 333 368 if [[ $(ncdump -h ${ATM}_grid_maskFrom_${OCE}.nc | grep domain_dst | wc -l) -gt 0 ]] ; then 334 369 case ${atm} in … … 357 392 358 393 ## 359 ## Creates mask of coastal OCE points 360 ## =========================================================================== 361 ccc_mprun -n 1 python -u ComputeNemoCoast.py -n ${OcePerio} -i ${OCE}_coordinates_mask.nc # Creates OceCoastal 362 ## 363 ## Creates mask of coastal ATM points 394 echo ${Titre}"Creates mask of coastal OCE points"${Norm} 395 ## =========================================================================== 396 ${PyRun} python3 -u ComputeNemoCoast.py -n ${OcePerio} -i ${OCE}_coordinates_mask.nc # Creates OceCoastal 397 398 ## 399 echo ${Titre}"Creates mask of coastal ATM points"${Norm} 364 400 ## =========================================================================== 365 401 cat <<EOF > coastal.nco … … 374 410 375 411 ## 376 ## Other weights files 412 echo ${Titre}"Other weights files"${Norm} 377 413 ## =========================================================================== 378 414 # Loop on commands … … 382 418 read_Command ${DefaultValues} 383 419 read_Command ${Command} 420 421 if [[ ${Command} = "Runoff" ]] ; then okRunoff=yes ; continue ; fi 422 if [[ ${Command} = "Calving" ]] ; then okCalving=yes ; continue ; fi 423 384 424 setValues 385 425 … … 391 431 cp iodef_oce_to_atm.xml iodef.xml 392 432 393 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="mask_src"]' -k name -v mask_${DSTGRID}394 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_dst"]/field[@id="mask_dst"]' -k name -v OceMask433 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 mask_${DSTGRID} 434 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 OceMask 395 435 396 python 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}397 python 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}398 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_dst"]/field[@id="mask_dest"]' -k name -v OceMask399 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_dst"]/field[@id="area_dest"]' -k name -v aire436 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} 437 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} 438 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 OceMask 439 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 400 440 ;; 401 441 ( a2o ) 402 442 cp iodef_atm_to_oce.xml iodef.xml 403 443 404 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="mask_src"]' -k name -v OceMask405 python 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}444 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 OceMask 445 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} 406 446 407 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_src"]/field[@id="mask_source"]' -k name -v OceMask408 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_src"]/field[@id="area_source"]' -k name -v aire409 python 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}410 python 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}447 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 OceMask 448 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 449 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} 450 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} 411 451 ;; 412 452 esac 413 453 414 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType}415 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType}416 417 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType}418 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType}419 420 python 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}_${Suffix}.nc421 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${numOrder}422 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v ${Quantity}423 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${Renormalize}424 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v ${useArea}425 426 python 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}_${Suffix}427 python 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}"428 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType}429 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType}430 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${Renormalize}431 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${numOrder}432 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t ${Quantity}433 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t ${useArea}454 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 455 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} 456 457 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} 458 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 459 460 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}_${Suffix}.nc 461 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${numOrder} 462 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v ${Quantity} 463 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${Renormalize} 464 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} 465 466 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}_${Suffix} 467 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}" 468 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType} 469 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType} 470 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${Renormalize} 471 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${numOrder} 472 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t ${Quantity} 473 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t ${useArea} 434 474 435 475 cp iodef.xml iodef_${srcGrid}${src}_to_${dstGrid}${dst}_${Suffix}.xml 436 time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea}476 ${MpiRun} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} 437 477 done 438 478 439 479 ## 440 ## Copy all NetCDF files to NetCDF 3 format (needed for OASIS) 480 echo ${Titre}"Copy all NetCDF files to NetCDF 3 format (needed for OASIS)"${Norm} 441 481 ## =========================================================================== 442 482 for InFile in *.nc ; do … … 446 486 447 487 ## 448 ## Add time axis and coordinates information 488 echo ${Titre}"Add time axis and coordinates information"${Norm} 449 489 ## (needed if files need to be read by XIOS) 450 490 ## =========================================================================== … … 491 531 492 532 ## 493 ## Add some metadata in file headers 533 echo ${Titre}"Add some metadata in file headers"${Norm} 494 534 ## =========================================================================== 495 535 496 536 UUID=$(uuid) 497 537 NCO="$(ncks --version |& tail -1|sed 's/ncks //')" 498 PYTHON_VER=$( python -c "import sys ; print (sys.version.split(' ')[0])" )538 PYTHON_VER=$( python3 -c "import sys ; print (sys.version.split(' ')[0])" ) 499 539 for InFile in $(ls *${oce}_to_*${atm}_*.nc *${atm}_to_*${oce}_*.nc ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}_${FMT_OASIS}.nc 2>/dev/null) ; do 500 540 ncatted --history \ … … 520 560 --attribute LOGNAME,global,o,c,"$(whoami)" \ 521 561 --attribute NCO,global,o,c,"NCO netCDF Operator ${NCO} http://nco.sourceforge.net" \ 522 --attribute Python,global,o,c,"Python version ${PYTHON_VER}" \562 --attribute Python,global,o,c,"Python3 version ${PYTHON_VER}" \ 523 563 --attribute OS,global,o,c,"$(uname -o)" \ 524 564 --attribute release,global,o,c,"$(uname -r)" \ 525 565 --attribute directory,global,o,c,"$(pwd)" \ 526 566 --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" \ 527 --attribute Comment,global,o,c,"Preliminary attempt - Do not trust !" \528 567 --attribute SVN_Author,global,o,c,'$Author$' \ 529 568 --attribute SVN_Date,global,o,c,'$Date$' \ … … 533 572 done 534 573 ## 535 ## Update and complete weight files to fit OASIS requested format 574 echo ${Titre}"Update and complete weight files to fit OASIS requested format"${Norm} 536 575 ## =========================================================================== 537 576 cat <<EOF > add_dim.nco … … 582 621 583 622 ## 584 ## Add missing variables in rmp files 623 echo ${Titre}"Add missing variables in rmp files"${Norm} 585 624 ## =========================================================================== 586 625 for $(ls rmpFile in rmp_?${atm}_to_[tuv]${oce}_*.nc rmp_[tuv]${oce}_to_t${atm}_*.nc* 2>/dev/null) ; do … … 721 760 722 761 ## 723 ## Creates and save auxiliary files for OASIS : grids.nc, areas.nc and masks.nc 762 echo ${Titre}"Creates and save auxiliary files for OASIS : grids.nc, areas.nc and masks.nc"${Norm} 724 763 ## ============================================================================ 725 764 bash ${SUBMIT_DIR}/CreateOasisGrids.bash --oce ${OCE} --atm ${ATM} 765 766 767 768 ## 769 echo ${Titre}"Runoff weights"${Norm} 770 ## =========================================================================== 771 if [[ "X${okRunoff}" = "Xyes" && "${atm}" = "lmd" ]] ; then 772 ${PyRun} python3 -u cotes_etal.py --oce=${OCE} --atm=${ATM} \ 773 --atmCoastWidth=${atmCoastWidth} --oceCoastWidth=${oceCoastWidth} --searchRadius=${searchRadius} \ 774 --grids=grids_${OCE}x${ATM}.nc --areas=areas_${OCE}x${ATM}.nc --masks=masks_${OCE}x${ATM}.nc \ 775 --o2a=${ATM}_grid_maskFrom_${OCE}.nc --output=rmp_t${atm}_to_t${oce}_runoff_${FMT_OASIS}.nc \ 776 --fmt=${FMT_OASIS} 777 fi 778 779 ## 780 echo ${Titre}"Calving weights"${Norm} 781 ## =========================================================================== 782 if [[ "X${okCalving}" = "Xyes" ]] ; then 783 case ${OCE} in 784 ( eORCA025 ) 785 cp ${R_IN}/OCE/NEMO/ORCA025_LIM3_PISCES/v3.6_stable/eORCA_R025_runoff_v1.1.nc . 786 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_full_${FMT_OASIS}.nc --fmt=${FMT_OASIS} \ 787 --oce=${OCE} --atm=${ATM} --type=full --dir=. 788 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth_${FMT_OASIS}.nc --fmt=${FMT_OASIS} \ 789 --oce=${OCE} --atm=${ATM} --type=nosouth --dir=. --repartition_file=eORCA_R025_runoff_v1.1.nc 790 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg_${FMT_OASIS}.nc --fmt=${FMT_OASIS} \ 791 --oce=${OCE} --atm=${ATM} --type=iceberg --dir=. --repartition_file=eORCA_R025_runoff_v1.1.nc --repartition_var=sornficbisf 792 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf_${FMT_OASIS}.nc --fmt=${FMT_OASIS} \ 793 --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=. --repartition_file=eORCA_R025_runoff_v1.1.nc --repartition_var=sofwfisf 794 ;; 795 796 ( eORCA1.2 ) 797 cp ${R_IN}/OCE/NEMO/ORCA1_LIM3_PISCES/v3.6_stable/runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc . 798 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth_${FMT_OASIS}.nc --fmt=${FMT_OASIS}\ 799 --oce=${OCE} --atm=${ATM} --type=nosouth --dir=. 800 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg_${FMT_OASIS}.nc --fmt=${FMT_OASIS}\ 801 --oce=${OCE} --atm=${ATM} --type=iceberg --dir=. --repartition_file=runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc --repartition_var=Icb_flux 802 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf_${FMT_OASIS}.nc --fmt=${FMT_OASIS}\ 803 --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=. --repartition_file=runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc --repartition_var=sornfisf 804 ;; 805 806 ( * ) 807 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_full_${FMT_OASIS}.nc --fmt=${FMT_OASIS} \ 808 --oce=${OCE} --atm=${ATM} --type=full --dir=. 809 ;; 810 811 esac 812 fi 813 814 ## 815 echo ${Titre}"Save results"${Norm} 816 ## =========================================================================== 817 818 cp ${ATM}_grid_maskFrom_${OCE}.nc ${SUBMIT_DIR} 819 for File in dia_*.nc rmp_*.nc 820 do 821 ncatted --history --attribute history_of_appended_files,global,d,c,"" ${File} 822 [[ "X${Comment}" != "X" ]] && ncatted --history --attribute Comment,global,o,c,"${Comment}" ${File} 823 [[ "X${Version}" != "X" ]] && ncatted --history --attribute Version,global,o,c,"${Version}" ${File} 824 825 NewFile=$(echo ${File} | sed -e "s/${atm}/${ATM}/" -e "s/${oce}/${OCE}/" ) 826 cp ${File} ${SUBMIT_DIR}/${NewFile} 827 done 726 828 727 829 cp areas_${OCE}x${ATM}.nc ${SUBMIT_DIR} … … 729 831 cp masks_${OCE}x${ATM}.nc ${SUBMIT_DIR} 730 832 731 ## 732 ## Calving weights 733 ## =========================================================================== 734 case ${OCE} in 735 ( eORCA025 ) 736 ccc_mprun -n 1 python -u CalvingWeights.py --oce=${OCE} --atm=${ATM} --type=full --dir=. 737 ;; 738 739 ( eORCA1.2 ) 740 cp ${R_IN}/OCE/NEMO/ORCA1_LIM3_PISCES/v3.6_stable/runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc . 741 ccc_mprun -n 1 python CalvingWeights.py --oce=${OCE} --atm=${ATM} --type=nosouth --dir=. 742 ccc_mprun -n 1 python CalvingWeights.py --oce=${OCE} --atm=${ATM} --type=iceberg --dir=. --repartition_file=runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc --repartition_var=Icb_flux 743 ccc_mprun -n 1 python CalvingWeights.py --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=. --repartition_file=runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc --repartition_var=sornfisf 744 ;; 745 746 ( * ) 747 ccc_mprun -n 1 python CalvingWeights.py --oce=${OCE} --atm=${ATM} --type=full --dir=. 748 ;; 749 esac 750 751 ## 752 ## Save results 753 ## =========================================================================== 754 cp ${ATM}_grid_maskFrom_${OCE}.nc ${SUBMIT_DIR} 755 for File in dia_*.nc rmp_*.nc 756 do 757 ncatted --history --attribute history_of_appended_files,global,d,c,"" ${File} 758 NewFile=$(echo ${File} | sed -e "s/${atm}/${ATM}/" -e "s/${oce}/${OCE}/" ) 759 cp ${File} ${SUBMIT_DIR}/${NewFile} 760 done 761 762 ## 763 ## Creates a README.txt file 833 834 ## 835 echo ${Titre}"Creates a README.txt file"${Norm} 764 836 ## =========================================================================== 765 837 [[ -f README.txt ]] && rm README.txt … … 802 874 echo '$HeadURL$ ' >> README.txt 803 875 804 # Compute checksums and add thmer to README 876 echo ${Titre}"Compute checksums and add them to README"${Norm} 805 877 # ----------------------------------------- 806 878 cat << EOF >> README.txt … … 824 896 ## =========================================================================== 825 897 ## 826 ## That's all folk's !!! 827 ## 828 ## =========================================================================== 829 898 echo ${Titre}" That's all folk's !!! "${Norm} 899 ## 900 ## =========================================================================== 901
Note: See TracChangeset
for help on using the changeset viewer.