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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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)"               \ 
Note: See TracChangeset for help on using the changeset viewer.