Changeset 6105
- Timestamp:
- 03/16/22 11:45:53 (2 years ago)
- Location:
- TOOLS/MOSAIX
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/MOSAIX/CalvingWeights.py
r6090 r6105 50 50 parser.add_argument ('--fmt' , help='NetCDF file format, using nco syntax', default='netcdf4', 51 51 choices=['classic', 'netcdf3', '64bit', '64bit_data', '64bit_data', 'netcdf4', 'netcdf4_classsic'] ) 52 parser.add_argument ('--ocePerio', help='periodicity of ocean grid', type= int, default=0)52 parser.add_argument ('--ocePerio', help='periodicity of ocean grid', type=float, default=0, choices=nemo.nperio_valid_range ) 53 53 54 54 # Parse command line -
TOOLS/MOSAIX/CreateWeightsMask.bash
r6093 r6105 72 72 #CplModel=ORCA2.3xLMD9695 73 73 #CplModel=ORCA2.3xICO30 74 CplModel=ORCA2.3xICO40 75 #CplModel=eORCA1.2xLMD144142 74 #CplModel=ORCA2.3xICO40 75 CplModel=eORCA1.2xLMD144142 76 #CplModel=eORCA1.4.0xLMD144142 77 #CplModel=eORCA1.4.2xLMD144142 76 78 #CplModel=eORCA1.2xLMD256256 77 79 #CplModel=eORCA1.2xICO40 … … 111 113 112 114 # More specific cases 113 [[ ${CplModel} = eORCA1. 2xLMD144142 ]] && { atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=550.0 ; }114 115 if [[ ${CplModel} = eORCA1. 2xLMD144142 && Version = "NoSearchRadius" ]] ; then115 [[ ${CplModel} = eORCA1.*xLMD144142 ]] && { atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=550.0 ; } 116 117 if [[ ${CplModel} = eORCA1.*xLMD144142 && Version = "NoSearchRadius" ]] ; then 116 118 atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=0.0 117 119 fi … … 192 194 # Functions to handle command parameters 193 195 # ====================================== 196 function tolow { echo ${*} | tr '[:upper:]' '[:lower:]' ; } 197 function toup { echo ${*} | tr '[:lower:]' '[:upper:]' ; } 198 function capit { echo $(toup ${1:0:1})$(tolow ${1:1}) ; } 199 function Capit { echo $(toup ${1:0:1})${1:1} ; } 200 194 201 function readCommand { 195 202 # Decipher the command line to set bash variables … … 215 222 readCommand ${1} 216 223 # 217 oceGrid=${oceGrid,,} ; atmGrid=${atmGrid,,} # Model names to lower case 218 OCEGRID=${oceGrid^^} ; ATMGRID=${atmGrid^^} # Model names to upper case 224 #oceGrid=${oceGrid,,} ; atmGrid=${atmGrid,,} # Model names to lower case 225 #OCEGRID=${oceGrid^^} ; ATMGRID=${atmGrid^^} # Model names to upper case 226 oceGrid=$(tolow ${oceGrid}) ; atmGrid=$(tolow ${atmGrid}) 227 OCEGRID=$(toup ${oceGrid}) ; ATMGRID=$(toup ${atmGrid}) 219 228 220 229 case ${Order} in … … 309 318 310 319 case ${OCE} in # Periodicity type of ORCA grid 311 ( ORCA2* ) OcePerio=4 ;; # 4 ORCA 6 PALEORCA 312 ( ORCA1* | eORCA1* ) OcePerio=6 ;; 313 ( ORCA025* | eORCA025* ) OcePerio=6 ;; 320 ( ORCA2.4 ) OcePerio=4.2 ;; # 4 ORCA 6 PALEORCA 321 ( ORCA2* ) OcePerio=4 ;; # 4 ORCA 6 PALEORCA 322 ( eORCA1.2 ) OcePerio=6 ;; 323 ( eORCA1.4.0 ) OcePerio=6 ;; 324 ( eORCA1.4.2 ) OcePerio=6.2 ;; 325 ( ORCA1* ) OcePerio=6 ;; 326 ( eORCA025.4 ) OcePerio=6.2 ;; 327 ( ORCA025* | eORCA025* ) OcePerio=6 ;; 314 328 esac 315 329 # … … 345 359 OutFileName=${srcGrid}${src}_to_${dstGrid}${dst}_${FullName} 346 360 347 cp iodef_oce_to_atm.xml 361 cp iodef_oce_to_atm.xml iodef.xml 348 362 349 363 cat << EOF > command_file_${OutFileName}.txt … … 815 829 816 830 ( eORCA1.2 | eORCA1.4 ) 817 cp ${R_IN}/OCE/NEMO/ORCA1_LIM3_PISCES/v3.6_stable/runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc . 831 cp ${R_IN}/OCE/NEMO/${OCE}/OPA/runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc . 832 818 833 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth.nc --fmt=${FMT_XIOS} \ 819 834 --oce=${OCE} --atm=${ATM} --type=nosouth \ -
TOOLS/MOSAIX/RunoffWeights.py
r6090 r6105 1 1 # -*- Mode: python -*- 2 #!/usr/bin/env python3 2 3 ### =========================================================================== 3 4 ### … … 71 72 parser.add_argument ('--fmt' , help='NetCDF file format, using nco syntax', default='netcdf4', 72 73 choices=['classic', 'netcdf3', '64bit', '64bit_data', '64bit_data', 'netcdf4', 'netcdf4_classsic'] ) 73 parser.add_argument ('--ocePerio' , help='periodicity of ocean grid', type= int, default=0)74 parser.add_argument ('--ocePerio' , help='periodicity of ocean grid', type=float, default=0, choices=nemo.nperio_valid_range) 74 75 75 76 # Parse command line … … 169 170 if oce_jpi == 1442 : oce_perio = 6 # ORCA 025 170 171 171 print ("Oce NPERIO parameter : {: d}".format(oce_perio))172 print ("Oce NPERIO parameter : {:}".format(oce_perio)) 172 173 oce_grid_pmask = nemo.lbc_mask (np.reshape(oce_grid_imask.values, (oce_jpj,oce_jpi)), nperio=oce_perio, cd_type='T', sval=0).ravel() 173 174 oce_address = np.arange(oce_jpj*oce_jpi) -
TOOLS/MOSAIX/nemo.py
r6064 r6105 24 24 rpi = np.pi ; rad = rpi / 180.0 25 25 26 nperio_valid_range = [0, 1,4,5,6]26 nperio_valid_range = [0, 1, 4, 4.2, 5, 6, 6.2] 27 27 28 28 ## SVN information … … 38 38 39 39 Inputs 40 jpj : number of latitudes 40 41 jpi : number of longitudes 41 42 nperio : periodicity parameter 42 43 ''' 43 44 if nperio == None : 44 if jpi == 182 : nperio = 4 # ORCA2. We choose legacy orca2. 45 if jpi == 362 : nperio = 6 # eORCA1. 46 if jpi == 1442 : nperio = 6 # ORCA025. 47 48 if jpj == 149 : nperio = 4 # ORCA2. We choose legacy orca2. 49 if jpj == 332 : nperio = 6 # eORCA1. 45 ## Values for NEMO version < 4.2 46 if jpi == 182 : nperio = 4 # ORCA2. We choose legacy orca2. 47 if jpi == 362 : nperio = 6 # eORCA1. 48 if jpi == 1442 : nperio = 6 # ORCA025. 49 50 if jpj == 149 : nperio = 4 # ORCA2. We choose legacy orca2. 51 if jpj == 332 : nperio = 6 # eORCA1. 52 53 ## Values for NEMO version >= 4.2. No more halo points 54 if jpi == 180 : nperio = 4.2 # ORCA2. We choose legacy orca2. 55 if jpi == 360 : nperio = 0 # eORCA1. 56 if jpi == 1440 : nperio = 0 # ORCA025. 57 58 if jpj == 148 : nperio = 4.2 # ORCA2. We choose legacy orca2. 59 if jpj == 330 : nperio = 0 # eORCA1. 60 50 61 # 51 62 if nperio == None : 52 63 sys.exit ('in nemo module : nperio not found, and cannot by guessed' ) 53 64 else : 54 print ('nperio set as {:d} (deduced from jpi={:d})'.format (nperio, jpi)) 65 sys.ext ('nperio set as {:} (deduced from jpi={:d}) : nemo.py is not ready for this value'.format (nperio, jpi) ) 66 67 print ('nperio set as {:} (deduced from jpi={:d})'.format (nperio, jpi)) 55 68 56 69 return nperio … … 103 116 # Special case for eORCA025 104 117 if lon.shape[-1] == 1442 : lon [..., -2, :] = lon [..., -3, :] 105 118 if lon.shape[-1] == 1440 : lon [..., -1, :] = lon [..., -2, :] 119 106 120 return fixed_lon 107 121 … … 359 373 ptab [..., -1, 0:-1 ] = psgn * ptab [..., -4, -1:0:-1 ] 360 374 ptab [..., -1, 0 ] = psgn * ptab [..., -4, 1 ] 361 ptab [..., -1, -1 ] = psgn * ptab [..., -4, -2 ] 375 ptab [..., -1, -1 ] = psgn * ptab [..., -4, -2 ] 376 377 if nperio in [4.2] : # North fold T-point pivot 378 if cd_type in [ 'T', 'W' ] : # T-, W-point 379 ptab [..., -1, jpi//2: ] = psgn * ptab [..., -1, jpi//2:0:-1 ] 380 381 if cd_type == 'U' : 382 ptab [..., -1, jpi//2-1:-1] = psgn * ptab [..., -1, jpi//2:0:-1] 383 384 if cd_type == 'V' : 385 ptab [..., -1, 1: ] = psgn * ptab [..., -2, jpi-1:0:-1 ] 386 387 if cd_type == 'F' : 388 ptab [..., -1, 0:-1 ] = psgn * ptab [..., -2, -1:0:-1 ] 389 362 390 363 391 if nperio in [5, 6] : # North fold F-point pivot … … 428 456 ptab [..., -2, : ] = sval 429 457 ptab [..., -1, : ] = sval 458 459 if nperio in [4.2] : # North fold T-point pivot 460 if cd_type in [ 'T', 'W' ] : # T-, W-point 461 ptab [..., -1, jpi//2: ] = sval 462 463 if cd_type == 'U' : 464 ptab [..., -1, jpi//2-1:-1] = sval 465 466 if cd_type == 'V' : 467 ptab [..., -1, 1: ] = sval 468 469 if cd_type == 'F' : 470 ptab [..., -1, 0:-1 ] = sval 430 471 431 472 if nperio in [5, 6] : # North fold F-point pivot … … 491 532 ptab [..., -2, : ] = sval 492 533 ptab [..., -1, : ] = sval 534 535 if nperio in [4.2] : # North fold T-point pivot 536 if cd_type in [ 'T', 'W' ] : # T-, W-point 537 ptab [..., -1, jpi//2: ] = sval 538 539 if cd_type == 'U' : 540 ptab [..., -1, jpi//2-1:-1] = sval 541 542 if cd_type == 'V' : 543 ptab [..., -1, 1: ] = sval 544 545 if cd_type == 'F' : 546 ptab [..., -1, 0:-1 ] = sval 493 547 494 548 if nperio in [5, 6] : # North fold F-point pivot
Note: See TracChangeset
for help on using the changeset viewer.