Changeset 4298 for TOOLS/MOSAIX/CreateOasisGrids.bash
- Timestamp:
- 02/28/19 14:10:31 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/MOSAIX/CreateOasisGrids.bash
r4259 r4298 34 34 OCE=ORCA2.3 35 35 # OCE=eORCA1.2 36 ATM=ICO3036 #ATM=ICO30 37 37 #ATM=ICO40 38 38 #ATM=ICO450 39 39 #ATM=LMD144142 40 #ATM=LMD969540 ATM=LMD9695 41 41 42 42 ## =========================================================================== … … 54 54 PROGRAM=$(basename ${0}) 55 55 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 56 if [[ "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 85 fi 77 86 ## 78 87 echo ${Titre}"Command line parameters"${Norm} … … 131 140 132 141 # 142 if [[ ${atm} = *lmd* ]] ; then 143 ncrename --dimension lon,x ${ATM}_grid_maskFrom_${OCE}.nc 144 ncrename --dimension lat,y ${ATM}_grid_maskFrom_${OCE}.nc 145 fi 146 # 133 147 # 134 148 echo ${Titre}"Creates ocean fields"${Norm} … … 160 174 # 161 175 echo ${Titre}"We need to have different names for dimensions and variables"${Norm} 162 # ---------------------------------------------------------------------------- 176 # -------------------------------------------------------------------------------- 163 177 ncrename --history --variable lon,alon grids_${CplModel}.nc 164 178 ncrename --history --variable lat,alat grids_${CplModel}.nc … … 177 191 areas_${CplModel}.nc 178 192 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 193 ncks --history -C --variable OceMask,OceFrac,Oce2AtmMask ${ATM}_grid_maskFrom_${OCE}.nc OceMask_tmp.nc 181 194 ncatted --history \ 182 195 --attribute cell_methods,OceMask,d,c, \ … … 185 198 --attribute _FillValue,OceMask,d,, \ 186 199 --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,, \ 187 212 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 214 ncap2 --history --append --script "Oce2AtmMask=int(1-Oce2AtmMask)" OceMask_tmp.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1 189 215 rm OceMask_tmp.nc 190 216 ncatted --history \ 191 --attribute long_name,Oce Mask,o,c,"Land-sea mask" \217 --attribute long_name,Oce2AtmMask,o,c,"Land-sea mask" \ 192 218 --attribute units,OceMask,o,c,"Land:1, Ocean:0" masks_${CplModel}.nc 193 219 … … 201 227 ncrename --history --dimension cell,ycell masks_${CplModel}.nc 202 228 fi 203 # if [[ ${atm} = *lmd* ]] ; then204 # ncrename --dimension lon,tlmdlon grids_${CplModel}.nc205 # ncrename --dimension lat,tlmdlat grids_${CplModel}.nc206 # ncrename --dimension lon,tlmdlon masks_${CplModel}.nc207 # ncrename --dimension lat,tlmdlat masks_${CplModel}.nc208 # ncrename --dimension lon,tlmdlon areas_${CplModel}.nc209 # ncrename --dimension lat,tlmdlat areas_${CplModel}.nc210 # fi211 229 212 230 # … … 233 251 ncap2 --history --append --script 'defdim("xcell",1) ' masks_${CplModel}_tmp.nc masks_${CplModel}.nc 234 252 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 236 256 237 257 mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc … … 248 268 # ----------------------------------------------------------------------- 249 269 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}.nc270 ncap2 --history --append --script "alon[y,x]=alon; alat[y,x]=alat" grids_${CplModel}_tmp.nc grids_${CplModel}.nc 251 271 rm -f grids_${CplModel}_tmp.nc 252 272 ncatted --history \ … … 267 287 *delta_y = alat(1,0) - alat(0,0) ; 268 288 // 269 bounds_lon[nvertex_lmd, lat,lon] = 0.0 ;270 bounds_lat[nvertex_lmd, lat,lon] = 0.0 ;289 bounds_lon[nvertex_lmd,y,x] = 0.0 ; 290 bounds_lat[nvertex_lmd,y,x] = 0.0 ; 271 291 // 272 292 bounds_lon (0,:,:) = alon + delta_x*0.5 ; … … 302 322 303 323 mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc 304 ncap2 --history --script "o${atm}_mask=int(Oce Mask)*0+0 ; " masks_${CplModel}_tmp.nc masks_${CplModel}.nc324 ncap2 --history --script "o${atm}_mask=int(Oce2AtmMask)*0+0 ; " masks_${CplModel}_tmp.nc masks_${CplModel}.nc 305 325 306 326 rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc … … 318 338 319 339 mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc 320 ncap2 --history --script "c${atm}_mask=int(Oce Mask)*0+0 ; " masks_${CplModel}_tmp.nc masks_${CplModel}.nc340 ncap2 --history --script "c${atm}_mask=int(Oce2AtmMask)*0+0 ; " masks_${CplModel}_tmp.nc masks_${CplModel}.nc 321 341 322 342 rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc … … 374 394 ncrename --history --variable alon,t${atm}.lon grids_${CplModel}.nc 375 395 ncrename --history --variable alat,t${atm}.lat grids_${CplModel}.nc 376 ncrename --history --variable Oce Mask,t${atm}.mskmasks_${CplModel}.nc396 ncrename --history --variable Oce2AtmMask,t${atm}.msk masks_${CplModel}.nc 377 397 ncrename --history --variable aire,t${atm}.srf areas_${CplModel}.nc 378 398 ncrename --history --variable bounds_lon,t${atm}.clo grids_${CplModel}.nc … … 406 426 if [[ ${atm} = ico ]] ; then 407 427 cat <<EOF > add_time.nco 408 OceFrac [time_counter,cell] = OceFrac [cell] ; 409 OceMask [time_counter,cell] = OceMask [cell] ; 428 OceFrac [time_counter,cell] = OceFrac [cell] ; 429 OceMask [time_counter,cell] = OceMask [cell] ; 430 Oce2AtmMask [time_counter,cell] = Oce2AtmMask [cell] ; 410 431 EOF 411 432 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 … … 419 440 if [[ ${atm} = lmd ]] ; then 420 441 cat <<EOF > add_time.nco 421 OceFrac [time_counter,lat,lon] = OceFrac [lat,lon] ; 422 OceMask [time_counter,lat,lon] = OceMask [lat,lon] ; 442 OceFrac [time_counter,y,x] = OceFrac [y,x] ; 443 OceMask [time_counter,y,x] = OceMask [y,x] ; 444 Oce2AtmMask [time_counter,y,x] = Oce2AtmMask [y,x] ; 423 445 EOF 424 446 ncap2 --overwrite --history --script-file add_time.nco ${ATM}_grid_maskFrom_${OCE}_time.nc tmp_${ATM}_grid_maskFrom_${OCE}_time.nc … … 429 451 -a coordinates,OceFrac,m,c,"time_counter lat lon" \ 430 452 -a coordinates,OceMask,m,c,"time_counter lat lon" \ 453 -a coordinates,Oce2AtmMask,m,c,"time_counter lat lon" \ 431 454 -a coordinates,aire,m,c,"lat lon" \ 432 455 ${ATM}_grid_maskFrom_${OCE}.nc … … 437 460 echo ${Titre}"Add some useful information in NetCDF headers"${Norm} 438 461 ## =========================================================================== 439 UUID=$(uuid)440 462 NCO=$(ncks --version |& tail -1|sed 's/ncks //') 441 463 for type in areas masks grids ; do 442 464 ncatted --history \ 443 465 --attribute nco_openmp_thread_number,global,d,, \ 444 --attribute uuid,global,d,, \445 466 --attribute LongName,global,d,, \ 446 467 --attribute NCO,global,o,c,"NCO netCDF Operator ${NCO} http://nco.sourceforge.net" \ … … 462 483 --attribute associatedFiles,global,o,c,"grids_${CplModel}.nc areas_${CplModel}.nc masks_${CplModel}.nc" \ 463 484 --attribute originalFiles,global,o,c,"${OCE}_coordinates_mask.nc ${ATM}_grid_mask.nc"\ 464 --attribute uuid,global,o,c,"${UUID}" \465 485 --attribute OS,global,o,c,"$(uname -o)" \ 466 486 --attribute release,global,o,c,"$(uname -r)" \
Note: See TracChangeset
for help on using the changeset viewer.