- Timestamp:
- 02/28/19 14:10:31 (5 years ago)
- Location:
- TOOLS/MOSAIX
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/MOSAIX/CalvingWeights.py
r4259 r4298 36 36 37 37 # Adding arguments 38 parser.add_argument ('--oce' , help='oce model name', type=str, default='eORCA1.2', choices=['ORCA2.3', 'eORCA1.2', 'eORCA025' ] )38 parser.add_argument ('--oce' , help='oce model name', type=str, default='eORCA1.2', choices=['ORCA2.3', 'eORCA1.2', 'eORCA025', 'eORCA025.1'] ) 39 39 parser.add_argument ('--atm' , help='atm model name (ICO* or LMD*)', type=str, default='ICO40' ) 40 40 parser.add_argument ('--type' , help='Type of distribution', type=str, choices=['iceshelf', 'iceberg', 'nosouth', 'full'], default='full' ) … … 111 111 112 112 # 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 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 117 if dst_Name == 'eORCA025.1' : nperio_dst = 6 117 118 print ('nperio_dst: ' + str(nperio_dst) ) 118 119 dst_mskutil = nemo.lbc_mask (dst_mskutil, nperio=nperio_dst, cd_type='T' ) … … 125 126 # Preparation by closing some straits 126 127 # ----------------------------------- 127 if dst_Name == 'eORCA025':128 print ('Filling some seas for eORCA025')128 if dst_Name in [ 'eORCA025', 'eORCA025.1' ] : 129 print ('Filling some seas for ' + dst_Name ) 129 130 # Set Gibraltar strait to 0 to fill Mediterranean sea 130 131 dst_mskutil[838:841,1125] = 0 … … 315 316 f_calving.masksFile = masks 316 317 f_calving.timeStamp = time.asctime() 317 f_calving.uuid = f_areas.uuid318 318 f_calving.HOSTNAME = platform.node() 319 319 #f_calving.LOGNAME = os.getlogin() -
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)" \ -
TOOLS/MOSAIX/CreateWeightsMask.bash
r4259 r4298 37 37 # $HeadURL$ 38 38 # 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 40 47 # 41 48 … … 58 65 echo ${Titre}"Defines models"${Norm} 59 66 # ================================== 60 #OCE=ORCA2.361 OCE=eORCA1.262 #OCE=eORCA025 63 64 #ATM=ICO3067 OCE=ORCA2.3 68 #OCE=eORCA1.2 69 #OCE=eORCA025.1 70 71 ATM=ICO30 65 72 #ATM=ICO40 66 73 #ATM=ICO450 67 74 #ATM=LMD9695 68 ATM=LMD14414275 #ATM=LMD144142 69 76 #ATM=LMD256256 70 77 71 78 72 79 Comment="Preliminary attempt - Do not trust !" 73 Version="v 0"80 Version="v2" 74 81 75 82 CplModel=${OCE}x${ATM} 83 # If available, get model names from job name 76 84 if [[ X${SLURM_JOB_NAME} = X*ORC* || X${SLURM_JOB_NAME} = X*LMD* || X${SLURM_JOB_NAME} = X*ICO* ]] ; then 77 85 CplModel=${SLURM_JOB_NAME} ; OCE=${CplModel//x*} ; ATM=${CplModel##*x} … … 84 92 # Runoff parameter. atmCoastWidth and oceCoastWidth in grid points, searchRadius in km 85 93 atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=600.0 86 runOff_atmQuantity=Quantity runOff_oceQuantity=Surfacic87 88 [[ ${ATM} = ICO* ]] && atmCoastWidth=0 # Parameter relevant for LMD rectilinear grid only89 [[ ${ATM} = LMD* ]] && atmCoastWidth=290 [[ ${OCE} = ORCA2.3 ]] && oceCoastWidth=191 [[ ${OCE} = eORCA1.2 ]] && oceCoastWidth=392 [[ ${OCE} = eORCA025 ]] && oceCoastWidth=194 runOff_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 93 101 94 102 … … 105 113 # 106 114 # 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. 109 117 # 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. 117 125 # 118 126 ## Classic cases for IPSLCM6 119 127 AtmOceFluxes=" 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 fluxes121 128 OceAtmTemp=" 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 122 129 OceAtmTemp2nd=" 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 … … 124 131 AtmOceStressV=" 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 125 132 AtmOceQuantity=" 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 134 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 127 135 OceAtmFluxes=" 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 137 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 128 138 OceAtmFluxes2nd="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 parametrization130 139 AtmOceTemps2nd=" 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 131 140 … … 136 145 137 146 # More comprehensive list for IPSLCM6 with new features 138 #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${AtmOceTemp} Runoff Calving Grids )147 CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${AtmOceTemp} Runoff Calving Grids ) 139 148 140 149 # 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 ) 142 151 143 152 # Debugs … … 280 289 281 290 case ${OCE} in # Periodicity type of ORCA grid 282 ( ORCA2 .3*) OcePerio=4 ;;291 ( ORCA2* ) OcePerio=4 ;; 283 292 ( ORCA1* | eORCA1* ) OcePerio=6 ;; 284 ( ORCA025* | eORCA025 293 ( ORCA025* | eORCA025* ) OcePerio=6 ;; 285 294 esac 286 295 # … … 371 380 where (OceFrac > 1.0 ) OceFrac=0.0 ; 372 381 where (OceFrac < 0.0 ) OceFrac=0.0 ; 382 OceMask = OceFrac ; 373 383 EOF 374 384 ncap2 --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 375 385 ncatted --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} 386 ncatted --history -a missing_value,OceMask,d,,"" -a _FillValue,OceMask,d,,"" dia_t${oce}_to_t${atm}_${FullName}.nc 387 388 ## 389 echo ${Titre}"Creates mask on ATM grid"${Norm} 379 390 ## =========================================================================== 380 391 cp 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 392 ncks --alphabetize --history --overwrite --variable OceFrac dia_t${oce}_to_t${atm}_${FullName}_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc 382 393 383 394 cat <<EOF > creation_masque.nco 384 where (OceFrac > 0.0 ) OceFrac=1 ; 385 where (OceFrac <= 0.0 ) OceFrac=0 ; 395 Oce2AtmMask = OceMask ; 396 where (OceMask > 0.0 ) Oce2AtmMask=1 ; 397 where (OceMask <= 0.0 ) Oce2AtmMask=0 ; 386 398 EOF 387 399 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 400 ncap2 --history --overwrite --script-file creation_masque.nco dia_t${oce}_to_t${atm}_${FullName}.nc tmp_dia_${ATM}_grid_maskFrom_${OCE}.nc 401 ncks --overwrite --history --variable OceMask,OceFrac,Oce2AtmMask tmp_dia_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc 394 402 395 403 echo "Change dimension names, and some attributes accordingly" 404 ## =========================================================== 396 405 if [[ $(ncdump -h ${ATM}_grid_maskFrom_${OCE}.nc | grep domain_dst | wc -l) -gt 0 ]] ; then 397 406 case ${atm} in … … 413 422 ncatted --history --attribute coordinates,OceFrac,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc 414 423 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 415 425 416 426 fi … … 418 428 ncks --history --alphabetize --append --variable aire atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc 419 429 [[ ${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 420 435 421 436 ## … … 448 463 449 464 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 451 467 452 468 case ${Direction} in … … 455 471 456 472 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 Oce Mask473 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 458 474 459 475 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} 460 476 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 Oce Mask477 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 462 478 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 463 479 ;; … … 465 481 cp iodef_atm_to_oce.xml iodef.xml 466 482 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 Oce Mask483 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 468 484 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} 469 485 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 Oce Mask486 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 471 487 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 472 488 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} … … 504 520 ## =========================================================================== 505 521 506 UUID=$(uuid)507 522 NCO="$(ncks --version |& tail -1|sed 's/ncks //')" 508 523 PYTHON_VER=$( python3 -c "import sys ; print (sys.version.split(' ')[0])" ) 509 524 for InFile in $(ls *${oce}_to_*${atm}_*.nc *${atm}_to_*${oce}_*.nc ${ATM}_grid_maskFrom_${OCE}.nc 2> /dev/null) ; do 510 525 ncatted --history \ 511 --attribute uuid,global,d,, \512 526 --attribute LongName,global,d,, \ 513 527 --attribute nco_openmp_thread_number,global,d,, \ … … 526 540 --attribute Program,global,o,c,"Generated by ${PROGRAM}" \ 527 541 --attribute timeStamp,global,o,c,"$(date)" \ 528 --attribute uuid,global,o,c,"${UUID}" \529 542 --attribute HOSTNAME,global,o,c,"$(hostname)" \ 530 543 --attribute LOGNAME,global,o,c,"$(whoami)" \ … … 663 676 dst_grid_area [dst_grid_size] = 0.0d ; 664 677 dst_grid_frac [dst_grid_size] = 1.0d ; 665 dst_grid_imask (:) = 1 - Oce Mask(:) ;678 dst_grid_imask (:) = 1 - Oce2AtmMask(:) ; 666 679 dst_grid_imask.int() ; 667 680 dst_grid_area (:) = aire(:) ; … … 707 720 dst_grid_area [dst_grid_size] = 0.0d ; 708 721 dst_grid_frac [dst_grid_size] = 1.0d ; 709 dst_grid_imask (:) = 1 - Oce Mask(:,:) ;722 dst_grid_imask (:) = 1 - Oce2AtmMask(:,:) ; 710 723 dst_grid_imask.int() ; 711 724 dst_grid_area (:) = aire(:,:) ; … … 754 767 if [[ "X${okCalving}" = "Xyes" ]] ; then 755 768 case ${OCE} in 756 ( eORCA025 )769 ( eORCA025* ) 757 770 cp /ccc/work/cont003/gencmip6/deshayej/eORCA_R025_runoff_v1.2.nc . 758 771 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth.nc --fmt=${FMT_XIOS} \ … … 830 843 ## =========================================================================== 831 844 [[ -f README.txt ]] && rm README.txt 845 UUID=$(uuid) 832 846 833 847 cat <<EOF > README.txt … … 871 885 # ------------------------------------------------------------ 872 886 cat << EOF >> README.txt 873 UUID common to all files : ${UUID}874 887 875 888 Files produced, with checksum produced by Unix command shasum (version $(shasum --version)) with default algorithm … … 878 891 879 892 for 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} 880 894 echo "$(shasum ${file})" >> README.txt 881 895 done -
TOOLS/MOSAIX/RunoffWeights.py
r4259 r4298 55 55 56 56 # Adding arguments 57 parser.add_argument ('--oce' , help='oce model name', type=str, default='eORCA1.2', choices=['ORCA2.3', 'eORCA1.2', 'eORCA025' ] )57 parser.add_argument ('--oce' , help='oce model name', type=str, default='eORCA1.2', choices=['ORCA2.3', 'eORCA1.2', 'eORCA025', 'eORCA025.1'] ) 58 58 parser.add_argument ('--atm' , help='atm model name', type=str, default='LMD9695' ) 59 59 parser.add_argument ('--atmCoastWidth', help='width of the coastal band in atmosphere (in grid points)', type=int, default=1 ) … … 65 65 parser.add_argument ('--areas' , help='masks file name', default='areas.nc' ) 66 66 parser.add_argument ('--masks' , help='areas file name', default='masks.nc' ) 67 parser.add_argument ('--o2a' , help='o2a file name' , default='o2a.nc' )67 parser.add_argument ('--o2a' , help='o2a file name' , default='o2a.nc' ) 68 68 parser.add_argument ('--output', help='output rmp file name', default='rmp_tlmd_to_torc_runoff.nc' ) 69 69 parser.add_argument ('--fmt' , help='NetCDF file format, using nco syntax', default='netcdf4', choices=['classic', 'netcdf3', '64bit', '64bit_data', '64bit_data', 'netcdf4', 'netcdf4_classsic'] ) … … 152 152 oce_grid_imask = oce_grid_imask2D.ravel() 153 153 ## 154 print (" Determination d'une bande cotiere ocean")154 print ("Computes an ocean coastal band") 155 155 156 156 oceLand2D = np.reshape ( np.where (oce_grid_pmask[:] < 0.5, True, False), (oce_jpj, oce_jpi) ) … … 179 179 oceCoast_address = oce_address [oceCoast] 180 180 181 print (" Determination d'une bande cotiere atmosphere" )181 print ("Computes an atmosphere coastal band " ) 182 182 atmLand = np.where (o2aFrac[:] < epsfrac , True, False) 183 183 atmLandFrac = np.where (o2aFrac[:] < zone-epsfrac , True, False) … … 186 186 atmOceanFrac = np.where (o2aFrac[:] > epsfrac , True, False) 187 187 188 ## La suite marche avec LMDZ seulement!!188 ## For LMDZ only !! 189 189 if atmDomainType == 'rectilinear' : 190 190 NNatm = 1+2*atmCoastWidth … … 270 270 f_runoff.o2aFile = o2a 271 271 f_runoff.timeStamp = time.asctime() 272 f_runoff.uuid = areaFile.uuid273 272 f_runoff.HOSTNAME = platform.node() 274 273 #f_runoff.LOGNAME = os.getlogin() -
TOOLS/MOSAIX/rangement.bash
r4186 r4298 12 12 #source ./Setup.bash 13 13 14 WORK_MOSAIC=/ccc/work/cont003/gen2212/p86mart/MOSAIX 15 mkdir -p ${WORK_MOSAIC} 14 WORK_MOSAIX=/ccc/work/cont003/gen2212/p86mart/MOSAIX 16 15 17 16 # ============================================================ 18 17 19 for ATM in LMD 144142 LMD9695 LMD256256 LMD144x142 LMD96x95 LMD256x256 ICO30 ICO40 ICO450 dynamico30 dynamico40 dynamico45018 for ATM in LMD9695 LMD96x95 LMD144142 LMD144x142 LMD256256 LMD256x256 ICO30 ICO40 ICO450 ; 20 19 do 21 for OCE in ORCA2.3 eORCA1.2 eORCA025 ORCA02520 for OCE in ORCA2.3 eORCA1.2 eORCA025 eORCA025.1 22 21 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 ) 24 24 25 25 if [[ -z ${Liste} ]] ; then 26 echo "${ ATM} : ${OCE} : Vide "26 echo "${CplModel} : Vide " 27 27 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} 33 32 fi 34 35 33 done 34 [[ -f Out_${CplModel} ]] && cp Out_${CplModel} ${WORK_MOSAIX}/${CplModel} 36 35 done
Note: See TracChangeset
for help on using the changeset viewer.