Changeset 4298 for TOOLS


Ignore:
Timestamp:
02/28/19 14:10:31 (5 years ago)
Author:
omamce
Message:

O.M. : corection on MOSAIX

  • add ORCA025.1 to known resolutions
  • Correct mask used to generate weigths
  • Suppress the second computation of uuid
  • OceMask? is now ocean fraction like it was in MOZAIC. OceFrac? still exists (and equals OceFrac?)
  • Add Oce2AtmMask as a 1/0 mask
Location:
TOOLS/MOSAIX
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/MOSAIX/CalvingWeights.py

    r4259 r4298  
    3636 
    3737# Adding arguments 
    38 parser.add_argument ('--oce'     , help='oce model name', type=str, default='eORCA1.2', choices=['ORCA2.3', 'eORCA1.2', 'eORCA025'] ) 
     38parser.add_argument ('--oce'     , help='oce model name', type=str, default='eORCA1.2', choices=['ORCA2.3', 'eORCA1.2', 'eORCA025', 'eORCA025.1'] ) 
    3939parser.add_argument ('--atm'     , help='atm model name (ICO* or LMD*)', type=str, default='ICO40'    ) 
    4040parser.add_argument ('--type'    , help='Type of distribution', type=str, choices=['iceshelf', 'iceberg', 'nosouth', 'full'], default='full'  ) 
     
    111111 
    112112# Periodicity masking for NEMO 
    113 if dst_Name == 'ORCA2.3'  : nperio_dst = 4 
    114 if dst_Name == 'eORCA1.2' : nperio_dst = 6 
    115 if dst_Name == 'ORCA025'  : nperio_dst = 6 
    116 if dst_Name == 'eORCA025' : nperio_dst = 6 
     113if dst_Name == 'ORCA2.3'    : nperio_dst = 4 
     114if dst_Name == 'eORCA1.2'   : nperio_dst = 6 
     115if dst_Name == 'ORCA025'    : nperio_dst = 6 
     116if dst_Name == 'eORCA025'   : nperio_dst = 6 
     117if dst_Name == 'eORCA025.1' : nperio_dst = 6 
    117118print ('nperio_dst: ' + str(nperio_dst) ) 
    118119dst_mskutil = nemo.lbc_mask (dst_mskutil, nperio=nperio_dst, cd_type='T' ) 
     
    125126# Preparation by closing some straits 
    126127# ----------------------------------- 
    127 if dst_Name == 'eORCA025' : 
    128     print ('Filling some seas for eORCA025') 
     128if dst_Name in [ 'eORCA025', 'eORCA025.1' ] : 
     129    print ('Filling some seas for ' + dst_Name ) 
    129130    # Set Gibraltar strait to 0 to fill Mediterranean sea 
    130131    dst_mskutil[838:841,1125] = 0 
     
    315316f_calving.masksFile       = masks 
    316317f_calving.timeStamp       = time.asctime() 
    317 f_calving.uuid            = f_areas.uuid 
    318318f_calving.HOSTNAME        = platform.node() 
    319319#f_calving.LOGNAME         = os.getlogin() 
  • TOOLS/MOSAIX/CreateOasisGrids.bash

    r4259 r4298  
    3434OCE=ORCA2.3 
    3535# OCE=eORCA1.2 
    36 ATM=ICO30 
     36#ATM=ICO30 
    3737#ATM=ICO40 
    3838#ATM=ICO450 
    3939#ATM=LMD144142 
    40 #ATM=LMD9695 
     40ATM=LMD9695 
    4141 
    4242## =========================================================================== 
     
    5454PROGRAM=$(basename ${0}) 
    5555 
    56 # case ${arch} in 
    57 #     ( curie | irene ) 
    58 #     set +vx 
    59 #     module unload cdo nco ferret 
    60 #     module unload netcdf hdf5 
    61 #     module load python # /2.7.12 
    62 #     module load netcdf/4.3.3.1_hdf5_parallel # Version for XIOS 
    63 #     module load nco 
    64 #     R_IN=$(ccc_home -u igcmg --cccwork)/IGCM 
    65 #     TMPDIR=${SCRATCHDIR}/TMP 
    66 #     SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}} 
    67 #     ;; 
    68 #     ( spip ) 
    69 #     R_IN=${HOME}/Scratch/IGCM 
    70 #     TMPDIR=${HOME}/Scratch/TMP 
    71 #     SUBMIT_DIR=$(pwd) 
    72 #     MPIRUN=/opt/local/bin/mpirun-openmpi-gcc49 -n 2 
    73 #     ;;  
    74 #     ( * ) exit -1 ;; 
    75 # esac 
    76  
     56if [[ "X${R_IN}" = "X" ]] ; then 
     57     
     58    case ${arch} in 
     59        ( irene ) 
     60        set +vx 
     61        set +e 
     62        TMPDIR=${CCCWORKDIR}/TMP 
     63        SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}} 
     64        PROGRAM=${BRIDGE_MSUB_REQNAME} 
     65        MpiRun="time ccc_mprun" 
     66        PyRun="time ccc_mprun -n 1" # Needed to force python to run on one process only 
     67        #module purge 
     68        source $(ccc_home -u igcmg)/MachineEnvironment/irene/env_irene 
     69        source ${SUBMIT_DIR}/arch.env 
     70        #module load nco 
     71        module load python3  
     72        module load datadir/igcmg 
     73        module list 
     74        set -e 
     75        ;; 
     76        ( spip ) 
     77        R_IN=${HOME}/Scratch/IGCM 
     78        TMPDIR=${HOME}/Scratch/TMP 
     79        SUBMIT_DIR=$(pwd) 
     80        MpiRun="/opt/local/bin/mpirun -n 4" 
     81        PyRun="time" 
     82        ;;  
     83        ( * ) exit -1 ;; 
     84    esac 
     85fi 
    7786## 
    7887echo ${Titre}"Command line parameters"${Norm} 
     
    131140 
    132141# 
     142if [[ ${atm} = *lmd* ]] ; then 
     143    ncrename --dimension lon,x  ${ATM}_grid_maskFrom_${OCE}.nc 
     144    ncrename --dimension lat,y  ${ATM}_grid_maskFrom_${OCE}.nc 
     145fi 
     146# 
    133147# 
    134148echo ${Titre}"Creates ocean fields"${Norm} 
     
    160174# 
    161175echo ${Titre}"We need to have different names for dimensions and variables"${Norm} 
    162 # ---------------------------------------------------------------------------- 
     176# -------------------------------------------------------------------------------- 
    163177ncrename --history --variable lon,alon   grids_${CplModel}.nc 
    164178ncrename --history --variable lat,alat   grids_${CplModel}.nc 
     
    177191        areas_${CplModel}.nc 
    178192 
    179 ncks --history -C --variable OceMask         ${ATM}_grid_maskFrom_${OCE}.nc OceMask_tmp.nc 
    180 #ncwa --history --overwrite --average time_counter OceMask_tmp.nc OceMask_tmp2.nc # Suppress time dimension 
     193ncks --history -C --variable OceMask,OceFrac,Oce2AtmMask ${ATM}_grid_maskFrom_${OCE}.nc OceMask_tmp.nc 
    181194ncatted --history \ 
    182195        --attribute cell_methods,OceMask,d,c,       \ 
     
    185198        --attribute _FillValue,OceMask,d,,          \ 
    186199        --attribute missing_value,OceMask,d,,       \ 
     200        \ 
     201        --attribute cell_methods,OceFrac,d,c,       \ 
     202        --attribute coordinates,OceFrac,d,,         \ 
     203        --attribute online_operation,OceFrac,d,,    \ 
     204        --attribute _FillValue,OceFrac,d,,          \ 
     205        --attribute missing_value,OceFrac,d,,       \ 
     206        \ 
     207        --attribute cell_methods,Oce2AtmMask,d,c,       \ 
     208        --attribute coordinates,Oce2AtmMask,d,,         \ 
     209        --attribute online_operation,Oce2AtmMask,d,,    \ 
     210        --attribute _FillValue,Oce2AtmMask,d,,          \ 
     211        --attribute missing_value,Oce2AtmMask,d,,       \ 
    187212        OceMask_tmp.nc 
    188 ncap2 --history --append --script "OceMask=int(1-OceMask)" OceMask_tmp.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1 
     213 
     214ncap2 --history --append --script "Oce2AtmMask=int(1-Oce2AtmMask)" OceMask_tmp.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1 
    189215rm OceMask_tmp.nc 
    190216ncatted --history \ 
    191         --attribute long_name,OceMask,o,c,"Land-sea mask"   \ 
     217        --attribute long_name,Oce2AtmMask,o,c,"Land-sea mask"   \ 
    192218        --attribute units,OceMask,o,c,"Land:1, Ocean:0"  masks_${CplModel}.nc 
    193219 
     
    201227    ncrename --history --dimension cell,ycell masks_${CplModel}.nc 
    202228fi 
    203 # if [[ ${atm} = *lmd* ]] ; then 
    204 #     ncrename --dimension lon,tlmdlon  grids_${CplModel}.nc 
    205 #     ncrename --dimension lat,tlmdlat  grids_${CplModel}.nc 
    206 #     ncrename --dimension lon,tlmdlon  masks_${CplModel}.nc 
    207 #     ncrename --dimension lat,tlmdlat  masks_${CplModel}.nc 
    208 #     ncrename --dimension lon,tlmdlon  areas_${CplModel}.nc 
    209 #     ncrename --dimension lat,tlmdlat  areas_${CplModel}.nc 
    210 # fi 
    211229 
    212230# 
     
    233251    ncap2 --history --append --script 'defdim("xcell",1) '   masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
    234252    mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc 
    235     ncap2 --history --append --script 'OceMask[ycell,xcell]=OceMask'  masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
     253    ncap2 --history --append --script 'OceFrac    [ycell,xcell]=OceFrac'      masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
     254    ncap2 --history --append --script 'OceMask    [ycell,xcell]=OceMask'      masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
     255    ncap2 --history --append --script 'Oce2AtmMask[ycell,xcell]=Oce2AtmMask'  masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
    236256 
    237257    mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc 
     
    248268    # ----------------------------------------------------------------------- 
    249269    mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 
    250     ncap2 --history --append --script "alon[lat,lon]=alon; alat[lat,lon]=alat"  grids_${CplModel}_tmp.nc grids_${CplModel}.nc 
     270    ncap2 --history --append --script "alon[y,x]=alon; alat[y,x]=alat"  grids_${CplModel}_tmp.nc grids_${CplModel}.nc 
    251271    rm -f grids_${CplModel}_tmp.nc 
    252272    ncatted --history \ 
     
    267287*delta_y = alat(1,0) - alat(0,0) ; 
    268288// 
    269 bounds_lon[nvertex_lmd,lat,lon] = 0.0 ; 
    270 bounds_lat[nvertex_lmd,lat,lon] = 0.0 ; 
     289bounds_lon[nvertex_lmd,y,x] = 0.0 ; 
     290bounds_lat[nvertex_lmd,y,x] = 0.0 ; 
    271291// 
    272292bounds_lon (0,:,:) = alon + delta_x*0.5 ; 
     
    302322 
    303323mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc 
    304 ncap2 --history --script "o${atm}_mask=int(OceMask)*0+0 ; " masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
     324ncap2 --history --script "o${atm}_mask=int(Oce2AtmMask)*0+0 ; " masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
    305325 
    306326rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc 
     
    318338 
    319339mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc 
    320 ncap2 --history --script "c${atm}_mask=int(OceMask)*0+0 ; " masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
     340ncap2 --history --script "c${atm}_mask=int(Oce2AtmMask)*0+0 ; " masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
    321341 
    322342rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc 
     
    374394ncrename --history --variable alon,t${atm}.lon                grids_${CplModel}.nc 
    375395ncrename --history --variable alat,t${atm}.lat                grids_${CplModel}.nc 
    376 ncrename --history --variable OceMask,t${atm}.msk             masks_${CplModel}.nc 
     396ncrename --history --variable Oce2AtmMask,t${atm}.msk         masks_${CplModel}.nc 
    377397ncrename --history --variable aire,t${atm}.srf                areas_${CplModel}.nc 
    378398ncrename --history --variable bounds_lon,t${atm}.clo          grids_${CplModel}.nc 
     
    406426if [[ ${atm} = ico ]] ; then 
    407427    cat <<EOF > add_time.nco 
    408 OceFrac    [time_counter,cell] = OceFrac    [cell] ; 
    409 OceMask    [time_counter,cell] = OceMask    [cell] ; 
     428OceFrac     [time_counter,cell] = OceFrac     [cell] ; 
     429OceMask     [time_counter,cell] = OceMask     [cell] ; 
     430Oce2AtmMask [time_counter,cell] = Oce2AtmMask [cell] ; 
    410431EOF 
    411432    ncap2 --overwrite --history --script-file add_time.nco ${ATM}_grid_maskFrom_${OCE}_time.nc tmp_${ATM}_grid_maskFrom_${OCE}_time.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}_time.nc ${ATM}_grid_maskFrom_${OCE}_time.nc 
     
    419440if [[ ${atm} = lmd ]] ; then 
    420441    cat <<EOF > add_time.nco 
    421 OceFrac    [time_counter,lat,lon] = OceFrac    [lat,lon] ; 
    422 OceMask    [time_counter,lat,lon] = OceMask    [lat,lon]  ; 
     442OceFrac     [time_counter,y,x] = OceFrac     [y,x] ; 
     443OceMask     [time_counter,y,x] = OceMask     [y,x]  ; 
     444Oce2AtmMask [time_counter,y,x] = Oce2AtmMask [y,x]  ; 
    423445EOF 
    424446    ncap2 --overwrite --history --script-file add_time.nco ${ATM}_grid_maskFrom_${OCE}_time.nc tmp_${ATM}_grid_maskFrom_${OCE}_time.nc 
     
    429451            -a coordinates,OceFrac,m,c,"time_counter lat lon"    \ 
    430452            -a coordinates,OceMask,m,c,"time_counter lat lon"    \ 
     453            -a coordinates,Oce2AtmMask,m,c,"time_counter lat lon"    \ 
    431454            -a coordinates,aire,m,c,"lat lon" \ 
    432455            ${ATM}_grid_maskFrom_${OCE}.nc 
     
    437460echo ${Titre}"Add some useful information in NetCDF headers"${Norm} 
    438461## =========================================================================== 
    439 UUID=$(uuid) 
    440462NCO=$(ncks --version |& tail -1|sed 's/ncks //') 
    441463for type in areas masks grids ; do 
    442464    ncatted --history \ 
    443465            --attribute nco_openmp_thread_number,global,d,,            \ 
    444             --attribute uuid,global,d,,                                \ 
    445466            --attribute LongName,global,d,,                            \ 
    446467            --attribute NCO,global,o,c,"NCO netCDF Operator ${NCO} http://nco.sourceforge.net" \ 
     
    462483            --attribute associatedFiles,global,o,c,"grids_${CplModel}.nc areas_${CplModel}.nc masks_${CplModel}.nc" \ 
    463484            --attribute originalFiles,global,o,c,"${OCE}_coordinates_mask.nc ${ATM}_grid_mask.nc"\ 
    464             --attribute uuid,global,o,c,"${UUID}"                      \ 
    465485            --attribute OS,global,o,c,"$(uname -o)"                    \ 
    466486            --attribute release,global,o,c,"$(uname -r)"               \ 
  • TOOLS/MOSAIX/CreateWeightsMask.bash

    r4259 r4298  
    3737#  $HeadURL$ 
    3838# 
    39 # CplModel=eORCA1.2xLMD144142 ; qsub -r ${CplModel} -o Out_${CplModel} -e Out_${CplModel} CreateWeightsMask.bash 
     39# export CplModel=eORCA1.2xLMD144142 ; qsub -r ${CplModel} -o Out_${CplModel} -e Out_${CplModel} CreateWeightsMask.bash 
     40# export CplModel=ORCA2.3xLMD9695 
     41# export CplModel=ORCA2.3xICO30 
     42# export CplModel=ORCA2.3xICO40 
     43# export CplModel=eORCA1.2xICO40 
     44# export CplModel=eORCA1.2xLMD256256 
     45# export CplModel=eORCA1.2xICO450 
     46# export CplModel=eORCA025.1xLMD256256 
    4047# 
    4148 
     
    5865echo ${Titre}"Defines models"${Norm} 
    5966# ================================== 
    60 #OCE=ORCA2.3 
    61 OCE=eORCA1.2 
    62 #OCE=eORCA025 
    63  
    64 #ATM=ICO30 
     67OCE=ORCA2.3 
     68#OCE=eORCA1.2 
     69#OCE=eORCA025.1 
     70 
     71ATM=ICO30 
    6572#ATM=ICO40 
    6673#ATM=ICO450 
    6774#ATM=LMD9695 
    68 ATM=LMD144142 
     75#ATM=LMD144142 
    6976#ATM=LMD256256 
    7077 
    7178 
    7279Comment="Preliminary attempt - Do not trust !" 
    73 Version="v0" 
     80Version="v2" 
    7481 
    7582CplModel=${OCE}x${ATM} 
     83# If available, get model names from job name 
    7684if [[ X${SLURM_JOB_NAME} = X*ORC* ||  X${SLURM_JOB_NAME} = X*LMD*  ||  X${SLURM_JOB_NAME} = X*ICO* ]] ; then 
    7785    CplModel=${SLURM_JOB_NAME} ; OCE=${CplModel//x*} ; ATM=${CplModel##*x} 
     
    8492# Runoff parameter. atmCoastWidth and oceCoastWidth in grid points, searchRadius in km 
    8593atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=600.0 
    86 runOff_atmQuantity=Quantity runOff_oceQuantity=Surfacic 
    87  
    88 [[ ${ATM} = ICO*     ]] && atmCoastWidth=0 # Parameter relevant for LMD rectilinear grid only 
    89 [[ ${ATM} = LMD*     ]] && atmCoastWidth=2 
    90 [[ ${OCE} = ORCA2.3  ]] && oceCoastWidth=1 
    91 [[ ${OCE} = eORCA1.2 ]] && oceCoastWidth=3 
    92 [[ ${OCE} = eORCA025 ]] && oceCoastWidth=1 
     94runOff_atmQuantity=Quantity ; runOff_oceQuantity=Surfacic 
     95 
     96[[ ${ATM} = ICO*      ]] && atmCoastWidth=0 # Parameter relevant for LMD rectilinear grid only 
     97[[ ${ATM} = LMD*      ]] && atmCoastWidth=2 
     98[[ ${OCE} = ORCA2.3   ]] && oceCoastWidth=1 
     99[[ ${OCE} = eORCA1.2  ]] && oceCoastWidth=3 
     100[[ ${OCE} = eORCA025* ]] && oceCoastWidth=1 
    93101 
    94102 
     
    105113# 
    106114# Keywords :  
    107 #   Direction   : o2a for ocean to atmosphere, a2o for atmosphere to ocean 
    108 #   Order       : 1st or 2nd 
     115#   Direction   : o2a for ocean to atmosphere, a2o for atmosphere to ocean. 
     116#   Order       : 1st or 2nd. 
    109117#   Quantity    : true if integrated quantity over a grid box, false for flux (quantity / m^2) 
    110 #                 or intensive value (temperature, salinity, sea-ice fraction, ...) 
    111 #   Renormalize : used when source grid is masked, to use values on non masked points only 
    112 #   oceGrid     : t, u or v point for NEMO C grid 
    113 #   atmGrid     : up to know, only t grid used in the atmosphere 
    114 #   useArea     : if true area from the model metrics is used. If false, areas are computed by XIOS from grid corners 
    115 #   maskSrc     : true to use the source grid mask, false to used all grid points 
    116 #   maskDst     : true to use the destination grid mask, false to use all grid points 
     118#                 or intensive value (temperature, salinity, sea-ice fraction, ...). 
     119#   Renormalize : used when source grid is masked, to use values on non masked points only. 
     120#   oceGrid     : t, u or v point for NEMO C grid. 
     121#   atmGrid     : up to know, only t grid used in the atmosphere. 
     122#   useArea     : if true area from the model metrics is used. If false, areas are computed by XIOS from grid corners. 
     123#   maskSrc     : true to use the source grid mask, false to used all grid points. 
     124#   maskDst     : true to use the destination grid mask, false to use all grid points. 
    117125# 
    118126## Classic cases for IPSLCM6 
    119127AtmOceFluxes="   Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=HeatWaterFluxes" # Heat and water fluxes 
    120 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 
    121128OceAtmTemp="     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 
    122129OceAtmTemp2nd="  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 
     
    124131AtmOceStressV="  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 
    125132AtmOceQuantity=" Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=t,oceGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=Quantity"   # e.g. runoff 
    126 # Other cases 
     133# For new parameterization 
     134AtmOceTemp="     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 
    127135OceAtmFluxes="   Direction=o2a,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=OceAtmFluxes" # e.g. CO2 fluxes 
     136# Test to do with 2nd order 
     137AtmOceFluxes2nd="Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=HeatWaterFluxes" # Heat and water fluxes 
    128138OceAtmFluxes2nd="Direction=o2a,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=OceAtmFluxes" # e.g. CO2 fluxes 
    129 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 
    130139AtmOceTemps2nd=" 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 
    131140 
     
    136145 
    137146# More comprehensive list for IPSLCM6 with new features 
    138 #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${AtmOceTemp} Runoff Calving Grids ) 
     147CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${AtmOceTemp} Runoff Calving Grids ) 
    139148 
    140149# With 2nd order 
    141 CommandList=( ${AtmOceFluxes} ${AtmOceFluxes2nd} ${OceAtmTemp} ${OceAtmTemp2nd} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${OceAtmFluxes2nd} ${AtmOceTemp} ${AtmOceTemp2nd} Runoff Calving Grids ) 
     150#CommandList=( ${AtmOceFluxes} ${AtmOceFluxes2nd} ${OceAtmTemp} ${OceAtmTemp2nd} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${OceAtmFluxes2nd} ${AtmOceTemp} ${AtmOceTemp2nd} Runoff Calving Grids ) 
    142151 
    143152# Debugs 
     
    280289 
    281290case ${OCE} in # Periodicity type of ORCA grid 
    282     ( ORCA2.3*             ) OcePerio=4 ;; 
     291    ( ORCA2             ) OcePerio=4 ;; 
    283292    ( ORCA1*   | eORCA1*   ) OcePerio=6 ;; 
    284     ( ORCA025* | eORCA025  ) OcePerio=6 ;; 
     293    ( ORCA025* | eORCA025* ) OcePerio=6 ;; 
    285294esac 
    286295# 
     
    371380where (OceFrac >  1.0 )  OceFrac=0.0 ; 
    372381where (OceFrac <  0.0 )  OceFrac=0.0 ;  
     382OceMask = OceFrac ; 
    373383EOF 
    374384ncap2 --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 
    375385ncatted --history -a missing_value,OceFrac,d,,"" -a _FillValue,OceFrac,d,,"" dia_t${oce}_to_t${atm}_${FullName}.nc 
    376  
    377 ## 
    378 echo ${Titre}"Creates ocean fractions on ATM grid"${Norm} 
     386ncatted --history -a missing_value,OceMask,d,,"" -a _FillValue,OceMask,d,,"" dia_t${oce}_to_t${atm}_${FullName}.nc 
     387  
     388## 
     389echo ${Titre}"Creates mask on ATM grid"${Norm} 
    379390## =========================================================================== 
    380391cp dia_t${oce}_to_t${atm}_${FullName}.nc  dia_t${oce}_to_t${atm}_${FullName}_mask.nc 
    381 ncks --alphabetize --history --overwrite --variable OceFrac dia_t${oce}_to_t${atm}_${FullName}_mask.nc  ${ATM}_grid_maskFrom_${OCE}.nc 
     392ncks --alphabetize --history --overwrite --variable OceFrac dia_t${oce}_to_t${atm}_${FullName}_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc 
    382393 
    383394cat <<EOF > creation_masque.nco 
    384 where (OceFrac >  0.0 )  OceFrac=1 ; 
    385 where (OceFrac <= 0.0 )  OceFrac=0 ; 
     395Oce2AtmMask = OceMask ;  
     396where (OceMask >  0.0 )  Oce2AtmMask=1 ; 
     397where (OceMask <= 0.0 )  Oce2AtmMask=0 ; 
    386398EOF 
    387399 
    388 ncap2 --history --overwrite --script-file creation_masque.nco dia_t${oce}_to_t${atm}_${FullName}_mask.nc tmp_dia_t${oce}_to_t${atm}_${FullName}_mask.nc ; mv tmp_dia_t${oce}_to_t${atm}_${FullName}_mask.nc dia_t${oce}_to_t${atm}_${FullName}_mask.nc 
    389 ncrename --history --variable OceFrac,OceMask dia_t${oce}_to_t${atm}_${FullName}_mask.nc 
    390  
    391 ncks --overwrite --history --variable OceMask dia_t${oce}_to_t${atm}_${FullName}_mask.nc tmp_OceMask.nc 
    392 ncks --history --append tmp_OceMask.nc ${ATM}_grid_maskFrom_${OCE}.nc 
    393 rm dia_t${oce}_to_t${atm}_${FullName}_mask.nc 
     400ncap2 --history --overwrite --script-file creation_masque.nco dia_t${oce}_to_t${atm}_${FullName}.nc tmp_dia_${ATM}_grid_maskFrom_${OCE}.nc  
     401ncks --overwrite --history --variable OceMask,OceFrac,Oce2AtmMask tmp_dia_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc 
    394402 
    395403echo "Change dimension names, and some attributes accordingly" 
     404## =========================================================== 
    396405if [[ $(ncdump -h ${ATM}_grid_maskFrom_${OCE}.nc | grep domain_dst | wc -l) -gt 0 ]] ; then 
    397406    case ${atm} in 
     
    413422    ncatted  --history --attribute coordinates,OceFrac,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc 
    414423    ncatted  --history --attribute coordinates,OceMask,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc 
     424    ncatted  --history --attribute coordinates,Oce2AtmMask,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc 
    415425  
    416426fi 
     
    418428ncks --history --alphabetize  --append    --variable aire    atm_grid.nc                                   ${ATM}_grid_maskFrom_${OCE}.nc 
    419429[[ ${atm} = *ico* ]] && ncks --alphabetize --history --append --variable bounds_lon,bounds_lat atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc 
     430 
     431## 
     432 
     433#cp ${ATM}_grid.nc ${ATM}_gridFromOce.nc 
     434 
    420435 
    421436## 
     
    448463     
    449464    ln -fs ${OCE}_coordinates_mask.nc  oce_grid.nc 
    450     ln -fs ${ATM}_grid.nc              atm_grid.nc 
     465    #ln -fs ${ATM}_grid.nc              atm_grid.nc 
     466    ln -fs ${ATM}_grid_maskFrom_${OCE}.nc atm_grid.nc 
    451467     
    452468    case ${Direction} in 
     
    455471         
    456472        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}  
    457         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 
     473        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 
    458474         
    459475        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} 
    460476        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} 
    461         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 
     477        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 
    462478        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 
    463479        ;; 
     
    465481        cp iodef_atm_to_oce.xml iodef.xml 
    466482         
    467         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 
     483        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 
    468484        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} 
    469485         
    470         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 
     486        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 
    471487        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 
    472488        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} 
     
    504520## =========================================================================== 
    505521 
    506 UUID=$(uuid) 
    507522NCO="$(ncks --version |& tail -1|sed 's/ncks //')" 
    508523PYTHON_VER=$( python3 -c "import sys ; print (sys.version.split(' ')[0])" ) 
    509524for InFile in $(ls *${oce}_to_*${atm}_*.nc *${atm}_to_*${oce}_*.nc ${ATM}_grid_maskFrom_${OCE}.nc 2> /dev/null) ; do 
    510525    ncatted --history \ 
    511             --attribute uuid,global,d,,                                           \ 
    512526            --attribute LongName,global,d,,                                       \ 
    513527            --attribute nco_openmp_thread_number,global,d,,                       \ 
     
    526540            --attribute Program,global,o,c,"Generated by ${PROGRAM}"              \ 
    527541            --attribute timeStamp,global,o,c,"$(date)"                            \ 
    528             --attribute uuid,global,o,c,"${UUID}"                                 \ 
    529542            --attribute HOSTNAME,global,o,c,"$(hostname)"                         \ 
    530543            --attribute LOGNAME,global,o,c,"$(whoami)"                            \ 
     
    663676dst_grid_area  [dst_grid_size] = 0.0d ; 
    664677dst_grid_frac  [dst_grid_size] = 1.0d ; 
    665 dst_grid_imask (:) = 1 - OceMask(:) ; 
     678dst_grid_imask (:) = 1 - Oce2AtmMask(:) ; 
    666679dst_grid_imask.int() ; 
    667680dst_grid_area  (:) = aire(:) ; 
     
    707720dst_grid_area  [dst_grid_size] = 0.0d ; 
    708721dst_grid_frac  [dst_grid_size] = 1.0d ; 
    709 dst_grid_imask (:) = 1 - OceMask(:,:) ; 
     722dst_grid_imask (:) = 1 - Oce2AtmMask(:,:) ; 
    710723dst_grid_imask.int() ; 
    711724dst_grid_area  (:) = aire(:,:) ; 
     
    754767if [[ "X${okCalving}" = "Xyes" ]] ; then 
    755768    case ${OCE} in 
    756         ( eORCA025 ) 
     769        ( eORCA025* ) 
    757770        cp /ccc/work/cont003/gencmip6/deshayej/eORCA_R025_runoff_v1.2.nc . 
    758771        ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth.nc  --fmt=${FMT_XIOS} \ 
     
    830843## =========================================================================== 
    831844[[ -f README.txt ]] && rm README.txt 
     845UUID=$(uuid) 
    832846 
    833847cat <<EOF > README.txt 
     
    871885# ------------------------------------------------------------ 
    872886cat << EOF >> README.txt 
    873 UUID common to all files : ${UUID} 
    874887 
    875888Files produced, with checksum produced by Unix command shasum (version $(shasum --version)) with default algorithm 
     
    878891 
    879892for 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 
     893    ncatted --attribute uuid,global,o,c,"${UUID}" ${file} 
    880894    echo "$(shasum ${file})" >> README.txt 
    881895done 
  • TOOLS/MOSAIX/RunoffWeights.py

    r4259 r4298  
    5555 
    5656# Adding arguments 
    57 parser.add_argument ('--oce'          , help='oce model name', type=str, default='eORCA1.2', choices=['ORCA2.3', 'eORCA1.2', 'eORCA025'] ) 
     57parser.add_argument ('--oce'          , help='oce model name', type=str, default='eORCA1.2', choices=['ORCA2.3', 'eORCA1.2', 'eORCA025', 'eORCA025.1'] ) 
    5858parser.add_argument ('--atm'          , help='atm model name', type=str, default='LMD9695'    ) 
    5959parser.add_argument ('--atmCoastWidth', help='width of the coastal band in atmosphere (in grid points)', type=int, default=1 ) 
     
    6565parser.add_argument ('--areas' , help='masks file name', default='areas.nc' ) 
    6666parser.add_argument ('--masks' , help='areas file name', default='masks.nc' ) 
    67 parser.add_argument ('--o2a'   , help='o2a file name'  , default='o2a.nc' ) 
     67parser.add_argument ('--o2a'   , help='o2a file name'  , default='o2a.nc'   ) 
    6868parser.add_argument ('--output', help='output rmp file name', default='rmp_tlmd_to_torc_runoff.nc' ) 
    6969parser.add_argument ('--fmt'   , help='NetCDF file format, using nco syntax', default='netcdf4', choices=['classic', 'netcdf3', '64bit', '64bit_data', '64bit_data', 'netcdf4', 'netcdf4_classsic'] ) 
     
    152152oce_grid_imask = oce_grid_imask2D.ravel() 
    153153##  
    154 print ("Determination d'une bande cotiere ocean") 
     154print ("Computes an ocean coastal band") 
    155155 
    156156oceLand2D  = np.reshape ( np.where (oce_grid_pmask[:] < 0.5, True, False), (oce_jpj, oce_jpi) ) 
     
    179179oceCoast_address         = oce_address        [oceCoast] 
    180180 
    181 print ("Determination d'une bande cotiere atmosphere " ) 
     181print ("Computes an atmosphere coastal band " ) 
    182182atmLand      = np.where (o2aFrac[:] < epsfrac       , True, False) 
    183183atmLandFrac  = np.where (o2aFrac[:] < zone-epsfrac  , True, False) 
     
    186186atmOceanFrac = np.where (o2aFrac[:] > epsfrac       , True, False) 
    187187 
    188 ## La suite marche avec LMDZ seulement !! 
     188## For LMDZ only !! 
    189189if atmDomainType == 'rectilinear' : 
    190190    NNatm = 1+2*atmCoastWidth 
     
    270270f_runoff.o2aFile         = o2a 
    271271f_runoff.timeStamp       = time.asctime() 
    272 f_runoff.uuid            = areaFile.uuid 
    273272f_runoff.HOSTNAME        = platform.node() 
    274273#f_runoff.LOGNAME         = os.getlogin() 
  • TOOLS/MOSAIX/rangement.bash

    r4186 r4298  
    1212#source ./Setup.bash 
    1313 
    14 WORK_MOSAIC=/ccc/work/cont003/gen2212/p86mart/MOSAIX 
    15 mkdir -p ${WORK_MOSAIC} 
     14WORK_MOSAIX=/ccc/work/cont003/gen2212/p86mart/MOSAIX 
    1615 
    1716# ============================================================ 
    1817 
    19 for ATM in LMD144142 LMD9695 LMD256256 LMD144x142 LMD96x95 LMD256x256 ICO30 ICO40 ICO450 dynamico30 dynamico40 dynamico450 
     18for ATM in LMD9695 LMD96x95 LMD144142 LMD144x142 LMD256256 LMD256x256 ICO30 ICO40 ICO450 ;  
    2019do 
    21     for OCE in ORCA2.3 eORCA1.2 eORCA025 ORCA025  
     20    for OCE in ORCA2.3 eORCA1.2 eORCA025 eORCA025.1 
    2221    do 
    23         Liste=$(ls README_${OCE}x${ATM}*.txt *${ATM}*_*${OCE}*.nc *${OCE}*_*${ATM}*.nc  *${ATM}x${OCE}*.nc *${OCE}x${ATM}*.nc 2> /dev/null  ) 
     22        CplModel=${OCE}x${ATM} 
     23        Liste=$(ls README_${OCE}x${ATM}.txt README_${OCE}x${ATM}_*.txt rmp_*${OCE}_to_*${ATM}_*.nc rmp_*${ATM}_to_*${OCE}_*.nc dia_*${OCE}_to_*${ATM}_*.nc dia_*${ATM}_to_*${OCE}_*.nc ${ATM}_grid_maskFrom_${OCE}_*.nc grids_${OCE}x${ATM}_*.nc masks_${OCE}x${ATM}_*.nc areas_${OCE}x${ATM}_*.nc 2> /dev/null ) 
    2424 
    2525        if [[ -z ${Liste} ]] ; then 
    26             echo "${ATM} : ${OCE} : Vide " 
     26            echo "${CplModel} : Vide " 
    2727        else 
    28             echo "${ATM} : ${OCE} : ${Liste}" 
    29             echo "${WORK_MOSAIC}/${OCE}x${ATM}" 
    30             mkdir -p ${WORK_MOSAIC}/${OCE}x${ATM} 
    31             mv ${Liste}  ${WORK_MOSAIC}/${OCE}x${ATM} 
    32  
     28            echo "${CplModel} : ${Liste}" 
     29            echo "${WORK_MOSAIX}/${CplModel}" 
     30            mkdir -p ${WORK_MOSAIX}/${CplModel} 
     31            mv ${Liste} ${WORK_MOSAIX}/${CplModel} 
    3332        fi 
    34          
    3533    done 
     34    [[ -f Out_${CplModel} ]] && cp Out_${CplModel} ${WORK_MOSAIX}/${CplModel} 
    3635done 
Note: See TracChangeset for help on using the changeset viewer.