Ignore:
Timestamp:
12/12/18 11:26:20 (5 years ago)
Author:
omamce
Message:

O.M. :

Runoff weight for both ICO and LMDZ
Correct corc grid

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/MOSAIX/CreateOasisGrids.bash

    r4172 r4186  
    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 
     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 
    7676 
    7777## 
     
    185185 
    186186ncks --fl_fmt=${FL_FMT3} --history -C --variable OceMask         ${ATM}_grid_maskFrom_${OCE}_${FL_FMT3}.nc OceMask_tmp.nc 
     187ncwa --history --overwrite --average time_counter OceMask_tmp.nc OceMask_tmp2.nc # Suppress time dimension 
    187188ncatted --history \ 
     189        --attribute cell_methods,OceMask,d,c,       \ 
    188190        --attribute coordinates,OceMask,d,,         \ 
    189191        --attribute online_operation,OceMask,d,,    \ 
     
    191193        --attribute missing_value,OceMask,d,,       \ 
    192194        OceMask_tmp.nc 
    193 ncap2 --fl_fmt=${FL_FMT3} --history --append --script "OceMask=int(1-OceMask)"            OceMask_tmp.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1 
     195ncap2 --fl_fmt=${FL_FMT3} --history --append --script "OceMask=int(1-OceMask)" OceMask_tmp2.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1 
    194196rm OceMask_tmp.nc 
    195197ncatted --history \ 
     
    216218 
    217219# 
    218 echo ${Titre}"DYNAMICO grids : 1) Set correct order of dimensions, 2) Add a dimension"${Norm} 
    219 # ---------------------------------------------------------------------------- 
    220220if [[ ${atm} = dynamico* || ${atm} = ico* ]] ; then 
     221    echo ${Titre}"DYNAMICO grids : 1) Set correct order of dimensions, 2) Add a dimension"${Norm} 
     222    # ------------------------------------------------------------------------------------------- 
    221223    mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 
    222224    ncpdq --permute nvertex,ycell,xcell  grids_${CplModel}_tmp.nc grids_${CplModel}.nc 
    223      
     225 
    224226    mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 
    225227    cat <<EOF >add_dim.nco 
     
    232234// 
    233235EOF 
    234      
     236    
    235237    ncap2 --fl_fmt=${FL_FMT3} --history --append --script-file add_dim.nco  grids_${CplModel}_tmp.nc grids_${CplModel}.nc 
    236238     
    237239    mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc 
    238     ncap2 --fl_fmt=${FL_FMT3} --history --append --script 'defdim("xcell",1) ; OceMask[time_counter,ycell,xcell]=OceMask(:,:)'  masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
     240    ncap2 --fl_fmt=${FL_FMT3} --history --append --script 'defdim("xcell",1) '   masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
     241    mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc 
     242    ncap2 --fl_fmt=${FL_FMT3} --history --append --script 'OceMask[ycell,xcell]=OceMask'  masks_${CplModel}_tmp.nc masks_${CplModel}.nc 
    239243 
    240244    mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc 
    241     ncap2 --fl_fmt=${FL_FMT3} --history --append --script 'defdim("xcell",1) ; aire[ycell,xcell]=aire(:) ; '                    areas_${CplModel}_tmp.nc areas_${CplModel}.nc 
     245    ncap2 --fl_fmt=${FL_FMT3} --history --append --script 'defdim("xcell",1) ; aire[ycell,xcell]=aire ; ' areas_${CplModel}_tmp.nc areas_${CplModel}.nc 
    242246 
    243247    rm -f grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc 
    244248fi 
    245  
     249  
    246250# 
    247251echo ${Titre}"Some changes specific to LMDZ lon/lat grid"${Norm} 
     
    292296 
    293297# 
     298  
    294299echo ${Titre}"Generates grid o${atm}, 'o' meaning 'one'"${Norm} 
    295300# same as t${atm} grid, with surfaces set to 1 
     
    308313rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc 
    309314 
     315 
     316echo ${Titre}"Generates grid o${oce}, 'o' meaning 'one'"${Norm} 
     317# same as t${oce} grid, with surfaces set to 1 
     318# and mask to 0 (ocean everywhere, to compute integral over the whole grid)) 
     319# This grid is used when field are quantities instead of fluxes (i.e river flow) 
     320# -------------------------------------------------------------------------------------------------------- 
     321mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 
     322ncap2 --fl_fmt=${FL_FMT3} --history --script "nav_lon_grid_O=nav_lon_grid_T; nav_lat_grid_O=nav_lat_grid_T; bounds_lon_grid_O=bounds_lon_grid_T; bounds_lat_grid_O=bounds_o${oce}_lat=bounds_lat_grid_T; " grids_${CplModel}_tmp.nc grids_${CplModel}.nc 
     323 
     324mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc 
     325ncap2 --fl_fmt=${FL_FMT3} --history --script "area_grid_O=area_grid_T*0.0d+1.0d;"   areas_${CplModel}_tmp.nc areas_${CplModel}.nc 
     326 
     327ncks -C --history --overwrite -v maskutil_T ${OCE}_coordinates_mask_${FL_FMT3}.nc maskutil_T_${FL_FMT3}.nc 
     328ncap2 --fl_fmt=${FL_FMT3} --history --append --script "mask_O=maskutil_T; " maskutil_T_${FL_FMT3}.nc masks_${CplModel}.nc 
     329 
     330rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc  
     331 
     332 
     333echo ${Titre}"Creates OCEAN C grid : redundant points removed to compute proper integrals"${Norm} 
     334# -------------------------------------------------------------------------------------------------------- 
     335 
     336mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 
     337ncap2 --fl_fmt=${FL_FMT3} --history --script "nav_lon_grid_C=nav_lon_grid_T; nav_lat_grid_C=nav_lat_grid_T; bounds_lon_grid_C=bounds_lon_grid_T; bounds_lat_grid_C=bounds_o${oce}_lat=bounds_lat_grid_T; " grids_${CplModel}_tmp.nc grids_${CplModel}.nc 
     338 
     339mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc 
     340ncap2 --fl_fmt=${FL_FMT3} --history --script "area_grid_C=area_grid_T ; "   areas_${CplModel}_tmp.nc areas_${CplModel}.nc 
     341 
     342#mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc 
     343ncap2 --fl_fmt=${FL_FMT3} --history --append --script "mask_C=maskutil_T; " maskutil_T_${FL_FMT3}.nc masks_${CplModel}.nc 
     344 
     345rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc maskutil_T_${FL_FMT3}.nc 
     346 
    310347# 
    311348echo ${Titre}"Final renaming"${Norm} 
    312349# ---------------------------------------------------------------------------- 
    313 for OCEGRID in T U V 
     350for OCEGRID in T U V O C 
    314351do 
    315352    ocegrid=${OCEGRID~} # To lowercase 
     
    342379ncrename --history --variable bounds_o${atm}_lat,o${atm}.cla  grids_${CplModel}.nc 
    343380 
    344 for atmgrid in t o ; do 
     381for ATMGRID in T O ; do 
     382    atmgrid=${ATMGRID~} # To lowercase 
    345383    ncatted --history \ 
    346384            --attribute bounds,${atmgrid}${atm}.lon,c,c,"${atmgrid}${atm}.clo"   \ 
     
    414452 
    415453## =========================================================================== 
    416 echo ${Titre}"exit from CreateOasisGrids "${Norm} 
     454echo ${Titre}"Exit from CreateOasisGrids "${Norm} 
    417455 
    418456## =========================================================================== 
Note: See TracChangeset for help on using the changeset viewer.