Changeset 6105 for TOOLS


Ignore:
Timestamp:
03/16/22 11:45:53 (2 years ago)
Author:
omamce
Message:

MOSAIX, by O.M : adapt to new file format of NEMO4.2

(no halo or peridodicity band in files)

Location:
TOOLS/MOSAIX
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/MOSAIX/CalvingWeights.py

    r6090 r6105  
    5050parser.add_argument ('--fmt'     , help='NetCDF file format, using nco syntax', default='netcdf4', 
    5151                         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 ) 
     52parser.add_argument ('--ocePerio', help='periodicity of ocean grid', type=float, default=0, choices=nemo.nperio_valid_range ) 
    5353 
    5454# Parse command line 
  • TOOLS/MOSAIX/CreateWeightsMask.bash

    r6093 r6105  
    7272#CplModel=ORCA2.3xLMD9695 
    7373#CplModel=ORCA2.3xICO30 
    74 CplModel=ORCA2.3xICO40 
    75 #CplModel=eORCA1.2xLMD144142 
     74#CplModel=ORCA2.3xICO40 
     75CplModel=eORCA1.2xLMD144142 
     76#CplModel=eORCA1.4.0xLMD144142 
     77#CplModel=eORCA1.4.2xLMD144142 
    7678#CplModel=eORCA1.2xLMD256256 
    7779#CplModel=eORCA1.2xICO40 
     
    111113 
    112114# More specific cases 
    113 [[ ${CplModel} = eORCA1.2xLMD144142 ]] && { atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=550.0 ; } 
    114  
    115 if [[ ${CplModel} = eORCA1.2xLMD144142 && Version = "NoSearchRadius" ]] ; then 
     115[[ ${CplModel} = eORCA1.*xLMD144142 ]] && { atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=550.0 ; } 
     116 
     117if [[ ${CplModel} = eORCA1.*xLMD144142 && Version = "NoSearchRadius" ]] ; then 
    116118    atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=0.0 
    117119fi 
     
    192194# Functions to handle command parameters 
    193195# ====================================== 
     196function tolow { echo ${*} | tr '[:upper:]' '[:lower:]' ; } 
     197function toup  { echo ${*} | tr '[:lower:]' '[:upper:]' ; } 
     198function capit { echo $(toup ${1:0:1})$(tolow ${1:1})   ; } 
     199function Capit { echo $(toup ${1:0:1})${1:1}            ; } 
     200 
    194201function readCommand { 
    195202    # Decipher the command line to set bash variables  
     
    215222    readCommand ${1} 
    216223    # 
    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}) 
    219228 
    220229    case ${Order} in 
     
    309318 
    310319case ${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   ;; 
    314328esac 
    315329# 
     
    345359OutFileName=${srcGrid}${src}_to_${dstGrid}${dst}_${FullName} 
    346360 
    347 cp iodef_oce_to_atm.xml   iodef.xml 
     361cp iodef_oce_to_atm.xml iodef.xml 
    348362 
    349363cat << EOF > command_file_${OutFileName}.txt 
     
    815829         
    816830        ( 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         
    818833        ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth.nc  --fmt=${FMT_XIOS} \ 
    819834                 --oce=${OCE} --atm=${ATM} --type=nosouth   \ 
  • TOOLS/MOSAIX/RunoffWeights.py

    r6090 r6105  
    11# -*- Mode: python -*- 
     2#!/usr/bin/env python3 
    23### =========================================================================== 
    34### 
     
    7172parser.add_argument ('--fmt'   , help='NetCDF file format, using nco syntax', default='netcdf4', 
    7273                         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 ) 
     74parser.add_argument ('--ocePerio'   , help='periodicity of ocean grid', type=float, default=0, choices=nemo.nperio_valid_range) 
    7475 
    7576# Parse command line 
     
    169170    if oce_jpi == 1442 : oce_perio = 6 # ORCA 025 
    170171         
    171 print ("Oce NPERIO parameter : {:d}".format(oce_perio)) 
     172print ("Oce NPERIO parameter : {:}".format(oce_perio)) 
    172173oce_grid_pmask = nemo.lbc_mask (np.reshape(oce_grid_imask.values, (oce_jpj,oce_jpi)), nperio=oce_perio, cd_type='T', sval=0).ravel() 
    173174oce_address = np.arange(oce_jpj*oce_jpi) 
  • TOOLS/MOSAIX/nemo.py

    r6064 r6105  
    2424rpi = np.pi ; rad = rpi / 180.0 
    2525 
    26 nperio_valid_range = [0,1,4,5,6] 
     26nperio_valid_range = [0, 1, 4, 4.2, 5, 6, 6.2] 
    2727 
    2828## SVN information 
     
    3838     
    3939    Inputs 
     40    jpj    : number of latitudes 
    4041    jpi    : number of longitudes 
    4142    nperio : periodicity parameter 
    4243    ''' 
    4344    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 
    5061        # 
    5162        if nperio == None : 
    5263            sys.exit ('in nemo module : nperio not found, and cannot by guessed' ) 
    5364        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)) 
    5568 
    5669    return nperio 
     
    103116    # Special case for eORCA025 
    104117    if lon.shape[-1] == 1442 : lon [..., -2, :] =  lon [..., -3, :] 
    105          
     118    if lon.shape[-1] == 1440 : lon [..., -1, :] =  lon [..., -2, :] 
     119                 
    106120    return fixed_lon 
    107121 
     
    359373            ptab [..., -1, 0:-1     ] = psgn * ptab [..., -4, -1:0:-1      ] 
    360374            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          
    362390         
    363391    if nperio in [5, 6] :            #  North fold F-point pivot   
     
    428456            ptab [..., -2, :     ] = sval 
    429457            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 
    430471     
    431472    if nperio in [5, 6] :            #  North fold F-point pivot 
     
    491532            ptab [..., -2, : ] = sval 
    492533            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 
    493547       
    494548    if nperio in [5, 6] :            #  North fold F-point pivot   
Note: See TracChangeset for help on using the changeset viewer.