Changeset 4199
- Timestamp:
- 12/18/18 16:06:39 (6 years ago)
- Location:
- TOOLS/MOSAIX
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/MOSAIX/CalvingWeights.py
r4186 r4199 42 42 parser.add_argument ('--repartition_file', help='Data files with iceberg melting' , type=str, default='./runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc' ) 43 43 parser.add_argument ('--repartition_var' , help='Variable name for iceshelf' , type=str, default=None) 44 parser.add_argument ('--output' , help='output rmp file name', default='rmp_tlmd_to_torc_calving _64bit.nc' )45 parser.add_argument ('--fmt' , help='NetCDF file format, using nco syntax', default=' 64bit', choices=['classic', 'netcdf3', '64bit', '64bit_data', '64bit_data', 'netcdf4', 'netcdf4_classsic'] )44 parser.add_argument ('--output' , help='output rmp file name', default='rmp_tlmd_to_torc_calving.nc' ) 45 parser.add_argument ('--fmt' , help='NetCDF file format, using nco syntax', default='netcdf4', choices=['classic', 'netcdf3', '64bit', '64bit_data', '64bit_data', 'netcdf4', 'netcdf4_classsic'] ) 46 46 47 47 # Parse command line -
TOOLS/MOSAIX/CreateOasisGrids.bash
r4186 r4199 123 123 echo ${Titre}"Format for OASIS-MCT files : should be NetCDF3 classic or NetCDF3 64 bits"${Norm} 124 124 # --------------------------------------------------------------------------- 125 FL_FMT3=64bit 126 125 FL_FMT=netcdf4 127 126 # 128 127 echo ${Titre}"Cleaning"${Norm} … … 132 131 133 132 # 134 echo ${Titre}"Creates NetCDF3 version of input files"${Norm}135 # ----------------------------------------------------------------------------136 ncks --overwrite --fl_fmt=${FL_FMT} --history ${OCE}_coordinates_mask.nc ${OCE}_coordinates_mask_${FL_FMT3}.nc137 ncks --overwrite --fl_fmt=${FL_FMT} --history ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}_${FL_FMT3}.nc138 139 140 133 # 141 134 echo ${Titre}"Creates ocean fields"${Norm} 142 135 # ---------------------------------------------------------------------------- 143 136 for OCEGRID in T U V ; do 144 ncks - -fl_fmt=${FL_FMT3} -C --history --append --variable nav_lon_grid_${OCEGRID},nav_lat_grid_${OCEGRID},bounds_lon_grid_${OCEGRID},bounds_lat_grid_${OCEGRID} ${OCE}_coordinates_mask_${FL_FMT3}.nc grids_${CplModel}.nc145 ncks - -fl_fmt=${FL_FMT3} -C --history --append --variable area_grid_${OCEGRID} ${OCE}_coordinates_mask_${FL_FMT3}.nc areas_${CplModel}.nc137 ncks -C --history --append --variable nav_lon_grid_${OCEGRID},nav_lat_grid_${OCEGRID},bounds_lon_grid_${OCEGRID},bounds_lat_grid_${OCEGRID} ${OCE}_coordinates_mask.nc grids_${CplModel}.nc 138 ncks -C --history --append --variable area_grid_${OCEGRID} ${OCE}_coordinates_mask.nc areas_${CplModel}.nc 146 139 # Inverts mask values and switch to integer 147 ncks -- fl_fmt=${FL_FMT33} --history -C --variable mask_${OCEGRID} ${OCE}_coordinates_mask_${FL_FMT3}.nc mask_${OCEGRID}_tmp.nc140 ncks --history -C --variable mask_${OCEGRID} ${OCE}_coordinates_mask.nc mask_${OCEGRID}_tmp.nc 148 141 ncatted --history \ 149 142 --attribute coordinates,mask_${OCEGRID},d,, \ … … 152 145 mask_${OCEGRID}_tmp.nc 153 146 154 ncap2 -- fl_fmt=${FL_FMT3} --history --append --script "mask_${OCEGRID}=int(1-mask_${OCEGRID});" mask_${OCEGRID}_tmp.nc masks_${CplModel}.nc147 ncap2 --history --append --script "mask_${OCEGRID}=int(1-mask_${OCEGRID});" mask_${OCEGRID}_tmp.nc masks_${CplModel}.nc 155 148 rm mask_${OCEGRID}_tmp.nc 156 149 ncatted --history \ … … 163 156 done 164 157 165 ncks --history --append --variable lon,lat ${ATM}_grid_maskFrom_${OCE} _${FL_FMT3}.nc grids_${CplModel}.nc158 ncks --history --append --variable lon,lat ${ATM}_grid_maskFrom_${OCE}.nc grids_${CplModel}.nc 166 159 167 160 # … … 172 165 173 166 if [[ ${ATM} = dynamico* || ${ATM} = ICO* ]] ; then 174 ncks -- fl_fmt=${FL_FMT3} --history --append --variable bounds_lon,bounds_lat ${ATM}_grid_maskFrom_${OCE}_${FL_FMT3}.nc grids_${CplModel}.nc167 ncks --history --append --variable bounds_lon,bounds_lat ${ATM}_grid_maskFrom_${OCE}.nc grids_${CplModel}.nc 175 168 fi 176 169 177 ncks -- fl_fmt=${FL_FMT3} --history -C --append --variable aire ${ATM}_grid_maskFrom_${OCE}_${FL_FMT3}.nc areas_${CplModel}.nc170 ncks --history -C --append --variable aire ${ATM}_grid_maskFrom_${OCE}.nc areas_${CplModel}.nc 178 171 ncatted --history --attribute coordinates,aire,d,, \ 179 172 --attribute _FillValue,aire,d,, \ … … 184 177 areas_${CplModel}.nc 185 178 186 ncks -- fl_fmt=${FL_FMT3} --history -C --variable OceMask ${ATM}_grid_maskFrom_${OCE}_${FL_FMT3}.nc OceMask_tmp.nc179 ncks --history -C --variable OceMask ${ATM}_grid_maskFrom_${OCE}.nc OceMask_tmp.nc 187 180 ncwa --history --overwrite --average time_counter OceMask_tmp.nc OceMask_tmp2.nc # Suppress time dimension 188 181 ncatted --history \ … … 193 186 --attribute missing_value,OceMask,d,, \ 194 187 OceMask_tmp.nc 195 ncap2 -- fl_fmt=${FL_FMT3} --history --append --script "OceMask=int(1-OceMask)" OceMask_tmp2.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1188 ncap2 --history --append --script "OceMask=int(1-OceMask)" OceMask_tmp2.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1 196 189 rm OceMask_tmp.nc 197 190 ncatted --history \ … … 235 228 EOF 236 229 237 ncap2 -- fl_fmt=${FL_FMT3} --history --append --script-file add_dim.nco grids_${CplModel}_tmp.nc grids_${CplModel}.nc230 ncap2 --history --append --script-file add_dim.nco grids_${CplModel}_tmp.nc grids_${CplModel}.nc 238 231 239 232 mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc 240 ncap2 -- fl_fmt=${FL_FMT3} --history --append --script 'defdim("xcell",1) ' masks_${CplModel}_tmp.nc masks_${CplModel}.nc233 ncap2 --history --append --script 'defdim("xcell",1) ' masks_${CplModel}_tmp.nc masks_${CplModel}.nc 241 234 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}.nc235 ncap2 --history --append --script 'OceMask[ycell,xcell]=OceMask' masks_${CplModel}_tmp.nc masks_${CplModel}.nc 243 236 244 237 mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc 245 ncap2 -- fl_fmt=${FL_FMT3} --history --append --script 'defdim("xcell",1) ; aire[ycell,xcell]=aire ; ' areas_${CplModel}_tmp.nc areas_${CplModel}.nc238 ncap2 --history --append --script 'defdim("xcell",1) ; aire[ycell,xcell]=aire ; ' areas_${CplModel}_tmp.nc areas_${CplModel}.nc 246 239 247 240 rm -f grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc … … 255 248 # ----------------------------------------------------------------------- 256 249 mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 257 ncap2 -- fl_fmt=${FL_FMT3} --history --append --script "alon[lat,lon]=alon; alat[lat,lon]=alat" grids_${CplModel}_tmp.nc grids_${CplModel}.nc250 ncap2 --history --append --script "alon[lat,lon]=alon; alat[lat,lon]=alat" grids_${CplModel}_tmp.nc grids_${CplModel}.nc 258 251 rm -f grids_${CplModel}_tmp.nc 259 252 ncatted --history \ … … 291 284 EOF 292 285 mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 293 ncap2 -- fl_fmt=${FL_FMT3} --history --script-file add_bounds.nco -O grids_${CplModel}_tmp.nc grids_${CplModel}.nc286 ncap2 --history --script-file add_bounds.nco -O grids_${CplModel}_tmp.nc grids_${CplModel}.nc 294 287 rm grids_${CplModel}_tmp.nc 295 288 fi … … 303 296 # ---------------------------------------------------------------------------- 304 297 mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 305 ncap2 -- fl_fmt=${FL_FMT3} --history --script "o${atm}_lon=alon; o${atm}_lat=alat; bounds_o${atm}_lon=bounds_lon; bounds_o${atm}_lat=bounds_lat; " grids_${CplModel}_tmp.nc grids_${CplModel}.nc298 ncap2 --history --script "o${atm}_lon=alon ; o${atm}_lat=alat ; bounds_o${atm}_lon=bounds_lon; bounds_o${atm}_lat=bounds_lat ; " grids_${CplModel}_tmp.nc grids_${CplModel}.nc 306 299 307 300 mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc 308 ncap2 -- fl_fmt=${FL_FMT3} --history --script "o${atm}_aire=aire*0.0d+1.0d; " areas_${CplModel}_tmp.nc areas_${CplModel}.nc301 ncap2 --history --script "o${atm}_aire=aire*0.0d+1.0d ; " areas_${CplModel}_tmp.nc areas_${CplModel}.nc 309 302 310 303 mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc 311 ncap2 -- fl_fmt=${FL_FMT3} --history --script "o${atm}_mask=int(OceMask)*0+0; " masks_${CplModel}_tmp.nc masks_${CplModel}.nc304 ncap2 --history --script "o${atm}_mask=int(OceMask)*0+0 ; " masks_${CplModel}_tmp.nc masks_${CplModel}.nc 312 305 313 306 rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc 314 307 308 309 echo ${Titre}"Generates grid c${atm}, 'o' meaning 'one'"${Norm} 310 # same as t${atm} grid, with surfaces set to grid area 311 # and mask to 0 (ocean everywhere, to compute integral over the whole grid)) 312 # ---------------------------------------------------------------------------- 313 mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 314 ncap2 --history --script "c${atm}_lon=alon ; c${atm}_lat=alat ; bounds_c${atm}_lon=bounds_lon ; bounds_c${atm}_lat=bounds_lat ; " grids_${CplModel}_tmp.nc grids_${CplModel}.nc 315 316 mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc 317 ncap2 --history --script "c${atm}_aire=aire" areas_${CplModel}_tmp.nc areas_${CplModel}.nc 318 319 mv 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 321 322 rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc 315 323 316 324 echo ${Titre}"Generates grid o${oce}, 'o' meaning 'one'"${Norm} … … 320 328 # -------------------------------------------------------------------------------------------------------- 321 329 mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 322 ncap2 -- 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}.nc330 ncap2 --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 331 324 332 mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc 325 ncap2 -- fl_fmt=${FL_FMT3} --history --script "area_grid_O=area_grid_T*0.0d+1.0d;" areas_${CplModel}_tmp.nc areas_${CplModel}.nc326 327 ncks -C --history --overwrite -v maskutil_T ${OCE}_coordinates_mask _${FL_FMT3}.nc maskutil_T_${FL_FMT3}.nc328 ncap2 -- fl_fmt=${FL_FMT3} --history --append --script "mask_O=maskutil_T; " maskutil_T_${FL_FMT3}.nc masks_${CplModel}.nc333 ncap2 --history --script "area_grid_O=area_grid_T*0.0d+1.0d;" areas_${CplModel}_tmp.nc areas_${CplModel}.nc 334 335 ncks -C --history --overwrite -v maskutil_T ${OCE}_coordinates_mask.nc maskutil_T.nc 336 ncap2 --history --append --script "mask_O=maskutil_T; " maskutil_T.nc masks_${CplModel}.nc 329 337 330 338 rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc … … 335 343 336 344 mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 337 ncap2 -- 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}.nc345 ncap2 --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 346 339 347 mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc 340 ncap2 --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 343 ncap2 --fl_fmt=${FL_FMT3} --history --append --script "mask_C=maskutil_T; " maskutil_T_${FL_FMT3}.nc masks_${CplModel}.nc 344 345 rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc maskutil_T_${FL_FMT3}.nc 348 ncap2 --history --script "area_grid_C=area_grid_T ; " areas_${CplModel}_tmp.nc areas_${CplModel}.nc 349 350 ncap2 --history --append --script "mask_C=maskutil_T; " maskutil_T.nc masks_${CplModel}.nc 351 352 rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc maskutil_T.nc 346 353 347 354 # … … 367 374 ncrename --history --variable alon,t${atm}.lon grids_${CplModel}.nc 368 375 ncrename --history --variable alat,t${atm}.lat grids_${CplModel}.nc 369 ncrename --history --variable o${atm}_lon,o${atm}.lon grids_${CplModel}.nc370 ncrename --history --variable o${atm}_lat,o${atm}.lat grids_${CplModel}.nc371 376 ncrename --history --variable OceMask,t${atm}.msk masks_${CplModel}.nc 372 ncrename --history --variable o${atm}_mask,o${atm}.msk masks_${CplModel}.nc373 377 ncrename --history --variable aire,t${atm}.srf areas_${CplModel}.nc 374 ncrename --history --variable o${atm}_aire,o${atm}.srf areas_${CplModel}.nc375 376 378 ncrename --history --variable bounds_lon,t${atm}.clo grids_${CplModel}.nc 377 379 ncrename --history --variable bounds_lat,t${atm}.cla grids_${CplModel}.nc 378 ncrename --history --variable bounds_o${atm}_lon,o${atm}.clo grids_${CplModel}.nc 379 ncrename --history --variable bounds_o${atm}_lat,o${atm}.cla grids_${CplModel}.nc 380 381 for ATMGRID in T O ; do 380 381 for ATMGRID in O C ; do 382 atmgrid=${ATMGRID~} # To lowercase 383 ncrename --history --variable ${atmgrid}${atm}_lon,${atmgrid}${atm}.lon grids_${CplModel}.nc 384 ncrename --history --variable ${atmgrid}${atm}_lat,${atmgrid}${atm}.lat grids_${CplModel}.nc 385 ncrename --history --variable ${atmgrid}${atm}_mask,${atmgrid}${atm}.msk masks_${CplModel}.nc 386 ncrename --history --variable ${atmgrid}${atm}_aire,${atmgrid}${atm}.srf areas_${CplModel}.nc 387 ncrename --history --variable bounds_${atmgrid}${atm}_lon,${atmgrid}${atm}.clo grids_${CplModel}.nc 388 ncrename --history --variable bounds_${atmgrid}${atm}_lat,${atmgrid}${atm}.cla grids_${CplModel}.nc 389 done 390 391 for ATMGRID in T O C ; do 382 392 atmgrid=${ATMGRID~} # To lowercase 383 393 ncatted --history \ … … 386 396 --attribute units,${atmgrid}${atm}.clo,o,c,"degrees_east" \ 387 397 --attribute units,${atmgrid}${atm}.cla,o,c,"degrees_north" grids_${CplModel}.nc 388 done389 390 ##391 echo ${Titre}"Change all NetCDF files to NetCDF 3 format"${Norm}392 ## ===========================================================================393 for InFile in areas_${CplModel}.nc grids_${CplModel}.nc masks_${CplModel}.nc ; do394 if [[ $(ncdump -k ${InFile}) = *netCDF-4* ]] ; then395 mv ${InFile} tmp_${InFile}396 ncks --fl_fmt=${FL_FMT3} --history tmp_${InFile} ${InFile}397 rm tmp_${InFile}398 fi399 398 done 400 399 -
TOOLS/MOSAIX/CreateWeightsMask.bash
r4195 r4199 57 57 # 58 58 echo ${Titre}"Defines models"${Norm} 59 # ============== 59 # ================================== 60 60 OCE=ORCA2.3 61 61 #OCE=eORCA1.2 … … 68 68 #ATM=LMD144142 69 69 #ATM=LMD256256 70 71 72 Comment="Preliminary attempt - Do not trust !" 73 Version="v0" 70 74 71 75 CplModel=${OCE}x${ATM} … … 131 135 #CommandList=( Runoff ) 132 136 #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} Runoff Calving Grids ) 137 #CommandList=( ${AtmOceFluxes} Runoff Calving Grids ) 138 CommandList=( ${AtmOceFluxes} ) 133 139 #CommandList=( Calving ) 134 140 #CommandList=( Grids ) 135 141 136 142 137 Comment="Preliminary attempt - Do not trust !"138 Version="_v0"139 143 140 144 ## =========================================================================== … … 143 147 ## 144 148 ## =========================================================================== 145 Tag=" _MOSAIX"149 Tag="MOSAIX" 146 150 SUBMIT_DIR=$(pwd) 147 151 … … 190 194 191 195 if [[ "${Name}" != "None" ]] ; then 192 Suffix=${Name}196 FullName=${Name} 193 197 else 194 Suffix=${Order}Order_${NormName}_${QuantName}_${AreaName}198 FullName=${Order}Order_${NormName}_${QuantName}_${AreaName} 195 199 fi 196 200 … … 206 210 esac 207 211 echo ${Green}"${SRC} ${SRCGRID} toward ${DST} ${DSTGRID} - ${Order} Order - Normalize: ${Renormalize} - Quantity: ${QuantName} - Area: ${AreaName} "${Norm} 208 echo ${Green}" Suffix : ${Suffix}"${Norm}212 echo ${Green}"FullName : ${FullName}"${Norm} 209 213 } 210 214 … … 282 286 cp ${R_IN}/ATM/GRID/${ATM}_grid.nc . 283 287 284 ncks --overwrite --fl_fmt=${FMT_OASIS} --history ${OCE}_coordinates_mask.nc ${OCE}_coordinates_mask_${FMT_OASIS}.nc285 ncks --overwrite --fl_fmt=${FMT_OASIS} --history ${ATM}_grid.nc ${ATM}_grid_${FMT_OASIS}.nc286 288 # 287 289 # echo ${Titre}"Creates OCEAN C grid : redundant points removed to compute proper integrals # A passer dans CreateWeights"${Norm} … … 309 311 # rm C_${OCE}_coordinates_mask.nc 310 312 311 # ncks --history --overwrite --fl_fmt=${FMT_OASIS} ${OCE}_coordinates_mask.nc ${OCE}_coordinates_mask_${FMT_OASIS}.nc312 313 313 # ls -al 314 314 … … 331 331 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_T 332 332 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_T 333 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${srcGrid}${src}_to_${dstGrid}${dst}_${ Suffix}333 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName} 334 334 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${SRC} mask interpolated to ${DST}" 335 335 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType} … … 338 338 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} 339 339 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 340 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${srcGrid}${src}_to_${dstGrid}${dst}_${ Suffix}.nc340 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.nc 341 341 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 342 342 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t false … … 347 347 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v false 348 348 349 cp iodef.xml iodef_${srcGrid}${src}_to_${dstGrid}${dst}_${ Suffix}.xml349 cp iodef.xml iodef_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.xml 350 350 ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc 351 351 ln -fs ${ATM}_grid.nc atm_grid.nc … … 364 364 where (OceFrac < 0.0 ) OceFrac=0.0 ; 365 365 EOF 366 ncap2 --history --overwrite --script-file correction_masque.nco dia_t${oce}_to_t${atm}_${ Suffix}.nc tmp_dia_t${oce}_to_t${atm}_${Suffix}.nc ; mv tmp_dia_t${oce}_to_t${atm}_${Suffix}.nc dia_t${oce}_to_t${atm}_${Suffix}.nc367 ncatted --history -a missing_value,OceFrac,d,,"" -a _FillValue,OceFrac,d,,"" dia_t${oce}_to_t${atm}_${ Suffix}.nc366 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 367 ncatted --history -a missing_value,OceFrac,d,,"" -a _FillValue,OceFrac,d,,"" dia_t${oce}_to_t${atm}_${FullName}.nc 368 368 369 369 ## 370 370 echo ${Titre}"Creates ocean fractions on ATM grid"${Norm} 371 371 ## =========================================================================== 372 cp dia_t${oce}_to_t${atm}_${ Suffix}.nc dia_t${oce}_to_t${atm}_${Suffix}_mask.nc373 ncks --alphabetize --history --overwrite --variable OceFrac dia_t${oce}_to_t${atm}_${ Suffix}_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc372 cp dia_t${oce}_to_t${atm}_${FullName}.nc dia_t${oce}_to_t${atm}_${FullName}_mask.nc 373 ncks --alphabetize --history --overwrite --variable OceFrac dia_t${oce}_to_t${atm}_${FullName}_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc 374 374 375 375 cat <<EOF > creation_masque.nco … … 378 378 EOF 379 379 380 ncap2 --history --overwrite --script-file creation_masque.nco dia_t${oce}_to_t${atm}_${ Suffix}_mask.nc tmp_dia_t${oce}_to_t${atm}_${Suffix}_mask.nc ; mv tmp_dia_t${oce}_to_t${atm}_${Suffix}_mask.nc dia_t${oce}_to_t${atm}_${Suffix}_mask.nc381 ncrename --history --variable OceFrac,OceMask dia_t${oce}_to_t${atm}_${ Suffix}_mask.nc382 383 ncks --overwrite --history --variable OceMask dia_t${oce}_to_t${atm}_${ Suffix}_mask.nc tmp_OceMask.nc380 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 381 ncrename --history --variable OceFrac,OceMask dia_t${oce}_to_t${atm}_${FullName}_mask.nc 382 383 ncks --overwrite --history --variable OceMask dia_t${oce}_to_t${atm}_${FullName}_mask.nc tmp_OceMask.nc 384 384 ncks --history --append tmp_OceMask.nc ${ATM}_grid_maskFrom_${OCE}.nc 385 rm dia_t${oce}_to_t${atm}_${ Suffix}_mask.nc385 rm dia_t${oce}_to_t${atm}_${FullName}_mask.nc 386 386 387 387 echo "Change dimension names, and some attributes accordingly" … … 412 412 413 413 ## 414 echo ${Titre}"Creates mask of coastal OCE points"${Norm} 415 ## =========================================================================== 416 ${PyRun} python3 -u ComputeNemoCoast.py -n ${OcePerio} -i ${OCE}_coordinates_mask.nc # Creates OceCoastal 417 418 ## 419 echo ${Titre}"Creates mask of coastal ATM points"${Norm} 420 ## =========================================================================== 421 cat <<EOF > coastal.nco 422 AtmCoastal = OceFrac * 0.0 ; 423 where (OceFrac > 0.0 && OceFrac < 1.0 ) AtmCoastal = 1.0 ; 424 EOF 425 ncap2 --history --overwrite --script-file coastal.nco ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_coastal_maskFrom_${OCE}.nc 426 ncks --history --append --variable AtmCoastal ${ATM}_coastal_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc 427 rm ${ATM}_coastal_maskFrom_${OCE}.nc 428 ncks --alphabetize --history --overwrite --fl_fmt=${FMT_OASIS} ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}_${FMT_OASIS}.nc 429 414 #echo ${Titre}"Creates mask of coastal OCE points"${Norm} 415 ## =========================================================================== 416 #${PyRun} python3 -u ComputeNemoCoast.py -n ${OcePerio} -i ${OCE}_coordinates_mask.nc # Creates OceCoastal 417 418 ## 419 #echo ${Titre}"Creates mask of coastal ATM points"${Norm} 420 ## =========================================================================== 421 #cat <<EOF > coastal.nco 422 #AtmCoastal = OceFrac * 0.0 ; 423 #where (OceFrac > 0.0 && OceFrac < 1.0 ) AtmCoastal = 1.0 ; 424 #EOF 425 #ncap2 --history --overwrite --script-file coastal.nco ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_coastal_maskFrom_${OCE}.nc 426 #ncks --history --append --variable AtmCoastal ${ATM}_coastal_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc 427 #rm ${ATM}_coastal_maskFrom_${OCE}.nc 430 428 431 429 ## … … 475 473 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 476 474 477 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${srcGrid}${src}_to_${dstGrid}${dst}_${ Suffix}.nc475 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.nc 478 476 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${numOrder} 479 477 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v ${Quantity} … … 481 479 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v ${useArea} 482 480 483 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${srcGrid}${src}_to_${dstGrid}${dst}_${ Suffix}481 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName} 484 482 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${SRC} mask interpolated to ${DST}" 485 483 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType} … … 490 488 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t ${useArea} 491 489 492 cp iodef.xml iodef_${srcGrid}${src}_to_${dstGrid}${dst}_${ Suffix}.xml490 cp iodef.xml iodef_${srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.xml 493 491 ${MpiRun} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} 494 492 done 495 493 496 ##497 echo ${Titre}"Copy all NetCDF files to NetCDF 3 format (needed for OASIS)"${Norm}498 ## ===========================================================================499 for InFile in *.nc ; do500 OuFile=$(basename ${InFile} .nc)_${FMT_OASIS}.nc501 [[ ! -f ${OuFile} ]] && ncks --alphabetize --history --fl_fmt=${FMT_OASIS} ${InFile} ${OuFile}502 done503 504 ##505 494 echo ${Titre}"Add time axis and coordinates information"${Norm} 506 495 ## (needed if files need to be read by XIOS) 507 496 ## =========================================================================== 508 #ncatted --history -a coordinates,aire,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc509 497 ncap2 --overwrite --history --script 'defdim("time_counter",1) ;' ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc 510 511 ncks --alphabetize --history --overwrite --fl_fmt=${FMT_OASIS} ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}_${FMT_OASIS}.nc512 498 513 499 if [[ ${atm} = ico ]] ; then … … 515 501 OceFrac [time_counter,cell] = OceFrac [cell] ; 516 502 OceMask [time_counter,cell] = OceMask [cell] ; 517 AtmCoastal [time_counter,cell] = AtmCoastal [cell] ;518 503 EOF 519 504 ncap2 --overwrite --history --script-file add_time.nco ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc … … 521 506 -a coordinates,OceFrac,m,c,"time_counter lat lon" \ 522 507 -a coordinates,OceMask,m,c,"time_counter lat lon" \ 523 -a coordinates,AtmCoastal,m,c,"time_counter lat lon" \524 508 -a coordinates,aire,c,c,"lat lon" \ 525 509 ${ATM}_grid_maskFrom_${OCE}.nc 526 510 fi 527 ncks --alphabetize --history --overwrite --fl_fmt=${FMT_OASIS} ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}_${FMT_OASIS}.nc528 511 529 512 if [[ ${atm} = lmd ]] ; then … … 531 514 OceFrac [time_counter,lat,lon] = OceFrac [lat,lon] ; 532 515 OceMask [time_counter,lat,lon] = OceMask [lat,lon] ; 533 AtmCoastal [time_counter,lat,lon] = AtmCoastal [lat,lon] ;534 516 EOF 535 517 ncap2 --overwrite --history --script-file add_time.nco ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc … … 540 522 -a coordinates,OceFrac,m,c,"time_counter lat lon" \ 541 523 -a coordinates,OceMask,m,c,"time_counter lat lon" \ 542 -a coordinates,AtmCoastal,m,c,"time_counter lat lon" \543 524 -a coordinates,aire,m,c,"lat lon" \ 544 525 ${ATM}_grid_maskFrom_${OCE}.nc 545 526 fi 546 ncks --alphabetize --history --overwrite --mk_rec time_counter ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc 547 ncks --alphabetize --history --overwrite --fl_fmt=${FMT_OASIS} ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}_${FMT_OASIS}.nc 527 ncks --alphabetize --history --overwrite --mk_rec time_counter ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc 548 528 549 529 ## … … 554 534 NCO="$(ncks --version |& tail -1|sed 's/ncks //')" 555 535 PYTHON_VER=$( python3 -c "import sys ; print (sys.version.split(' ')[0])" ) 556 for InFile in $(ls *${oce}_to_*${atm}_*.nc *${atm}_to_*${oce}_*.nc ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}_${FMT_OASIS}.nc 2>/dev/null) ; do536 for InFile in $(ls *${oce}_to_*${atm}_*.nc *${atm}_to_*${oce}_*.nc ${ATM}_grid_maskFrom_${OCE}.nc 2> /dev/null) ; do 557 537 ncatted --history \ 558 538 --attribute uuid,global,d,, \ … … 597 577 598 578 for rmpFile in rmp_*.nc ; do 599 mv ${rmpFile} xios_${rmpFile}600 ncap2 -- fl_fmt=${FMT_OASIS} --history --script-file add_dim.nco xios_${rmpFile}${rmpFile}579 mv ${rmpFile} tmp_${rmpFile} 580 ncap2 --history --script-file add_dim.nco tmp_${rmpFile} ${rmpFile} ; rm tmp_${rmpFile} 601 581 602 582 ncrename --history --dimension n_weight,num_links ${rmpFile} … … 641 621 echo ${Titre}"Add missing variables in rmp files"${Norm} 642 622 ## =========================================================================== 643 for rmpFile in $(ls rmp_?${atm}_to_[tuv]${oce}_*.nc rmp_[tuv]${oce}_to_t${atm}_*.nc 2> /dev/null) ; do623 for rmpFile in $(ls rmp_?${atm}_to_[tuv]${oce}_*.nc rmp_[tuv]${oce}_to_t${atm}_*.nc 2>& /dev/null ) ; do 644 624 echo ${rmpFile} 645 625 a_to_o=false ; o_to_a=false … … 684 664 685 665 cp add_varoce.nco add_varoce_$(basename ${rmpFile} .nc)_o_to_a.nco 686 [[ ${o_to_a} = true ]] && ncap2 --history --append --script-file add_varoce_$(basename ${rmpFile} .nc)_o_to_a.nco ${OCE}_coordinates_mask _${FMT_OASIS}.nc ${rmpFile}666 [[ ${o_to_a} = true ]] && ncap2 --history --append --script-file add_varoce_$(basename ${rmpFile} .nc)_o_to_a.nco ${OCE}_coordinates_mask.nc ${rmpFile} 687 667 sed --in-place "s/src_/dst_/g" add_varoce.nco 688 668 cp add_varoce.nco add_varoce_$(basename ${rmpFile} .nc)_a_to_o.nco 689 [[ ${a_to_o} = true ]] && ncap2 --history --append --script-file add_varoce_$(basename ${rmpFile} .nc)_a_to_o.nco ${OCE}_coordinates_mask _${FMT_OASIS}.nc ${rmpFile}669 [[ ${a_to_o} = true ]] && ncap2 --history --append --script-file add_varoce_$(basename ${rmpFile} .nc)_a_to_o.nco ${OCE}_coordinates_mask.nc ${rmpFile} 690 670 691 671 if [[ ${atm} = ico ]] ; then … … 717 697 cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco 718 698 if [[ ${o_to_a} = true ]] ; then 719 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE} _${FMT_OASIS}.nc ${rmpFile}699 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} 720 700 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc 721 701 mv rmp_tmp.nc ${rmpFile} … … 725 705 cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco 726 706 if [[ ${a_to_o} = true ]] ; then 727 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE} _${FMT_OASIS}.nc ${rmpFile}707 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} 728 708 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc 729 709 mv rmp_tmp.nc ${rmpFile} … … 761 741 cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco 762 742 if [[ ${o_to_a} = true ]] ; then 763 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE} _${FMT_OASIS}.nc ${rmpFile}743 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} 764 744 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc 765 745 mv rmp_tmp.nc ${rmpFile} … … 769 749 cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco 770 750 if [[ ${a_to_o} = true ]] ; then 771 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE} _${FMT_OASIS}.nc ${rmpFile}751 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} 772 752 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc 773 753 mv rmp_tmp.nc ${rmpFile} … … 792 772 --atmCoastWidth=${atmCoastWidth} --oceCoastWidth=${oceCoastWidth} --searchRadius=${searchRadius} \ 793 773 --grids=grids_${CplModel}.nc --areas=areas_${CplModel}.nc --masks=masks_${CplModel}.nc \ 794 --o2a=${ATM}_grid_maskFrom_${OCE}.nc --output=rmp_t${atm}_to_t${oce}_runoff_${runOff_atmQuantity}_to_${runOff_oceQuantity} _${FMT_OASIS}.nc \795 --fmt=${FMT_ OASIS} \774 --o2a=${ATM}_grid_maskFrom_${OCE}.nc --output=rmp_t${atm}_to_t${oce}_runoff_${runOff_atmQuantity}_to_${runOff_oceQuantity}.nc \ 775 --fmt=${FMT_XIOS} \ 796 776 --atmQuantity=${runOff_atmQuantity} --oceQuantity=${runOff_oceQuantity} 797 777 fi … … 803 783 case ${OCE} in 804 784 ( eORCA025 ) 805 # cp ${R_IN}/OCE/NEMO/ORCA025_LIM3_PISCES/v3.6_stable/eORCA_R025_runoff_v1.1.nc .806 785 cp /ccc/work/cont003/gencmip6/deshayej/eORCA_R025_runoff_v1.2.nc . 807 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth _${FMT_OASIS}.nc --fmt=${FMT_OASIS} \786 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth.nc --fmt=${FMT_XIOS} \ 808 787 --oce=${OCE} --atm=${ATM} --type=nosouth --dir=. 809 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg _${FMT_OASIS}.nc --fmt=${FMT_OASIS} \788 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg.nc --fmt=${FMT_XIOS} \ 810 789 --oce=${OCE} --atm=${ATM} --type=iceberg --dir=. --repartition_file=eORCA_R025_runoff_v1.2.nc --repartition_var=Icb_flux 811 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf _${FMT_OASIS}.nc --fmt=${FMT_OASIS} \790 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf.nc --fmt=${FMT_XIOS} \ 812 791 --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=. --repartition_file=eORCA_R025_runoff_v1.2.nc --repartition_var=sornfisf 813 792 ;; … … 815 794 ( eORCA1.2 ) 816 795 cp ${R_IN}/OCE/NEMO/ORCA1_LIM3_PISCES/v3.6_stable/runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc . 817 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth _${FMT_OASIS}.nc --fmt=${FMT_OASIS}\796 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth.nc --fmt=${FMT_XIOS}\ 818 797 --oce=${OCE} --atm=${ATM} --type=nosouth --dir=. 819 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg _${FMT_OASIS}.nc --fmt=${FMT_OASIS}\798 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg.nc --fmt=${FMT_XIOS}\ 820 799 --oce=${OCE} --atm=${ATM} --type=iceberg --dir=. --repartition_file=runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc --repartition_var=Icb_flux 821 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf _${FMT_OASIS}.nc --fmt=${FMT_OASIS}\800 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf.nc --fmt=${FMT_XIOS}\ 822 801 --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=. --repartition_file=runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc --repartition_var=sornfisf 823 802 ;; 824 803 825 804 ( * ) 826 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_full _${FMT_OASIS}.nc --fmt=${FMT_OASIS} \805 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_full.nc --fmt=${FMT_XIOS} \ 827 806 --oce=${OCE} --atm=${ATM} --type=full --dir=. 828 807 ;; … … 832 811 833 812 ## 834 echo ${Titre}"Save results"${Norm} 835 ## =========================================================================== 836 837 cp ${ATM}_grid_maskFrom_${OCE}.nc ${SUBMIT_DIR} 838 for File in dia_*.nc rmp_*.nc 839 do 813 echo ${Titre}"Simplifies headers, add version and comment"${Norm} 814 ## =========================================================================== 815 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 840 816 ncatted --history --attribute history_of_appended_files,global,d,c,"" ${File} 817 ncatted --history --attribute history,global,d,c,"" ${File} 841 818 [[ "X${Comment}" != "X" ]] && ncatted --history --attribute Comment,global,o,c,"${Comment}" ${File} 842 819 [[ "X${Version}" != "X" ]] && ncatted --history --attribute Version,global,o,c,"${Version}" ${File} 843 820 [[ "X${Tag}" != "X" ]] && ncatted --history --attribute Version,global,o,c,"${Tag}" ${File} 821 done 822 823 ## 824 echo ${Titre}"Rename rmp and dia files"${Norm} 825 ## =========================================================================== 826 for File in $(ls dia_*.nc rmp_*.nc 2>& /dev/null ); do 844 827 NewFile=$(echo ${File} | sed -e "s/${atm}/${ATM}/" -e "s/${oce}/${OCE}/" ) 845 cp${File} ${SUBMIT_DIR}/${NewFile}828 mv ${File} ${SUBMIT_DIR}/${NewFile} 846 829 done 847 830 848 if [[ "X${okGrids}" = "Xyes" ]] ; then 849 cp areas_${CplModel}.nc ${SUBMIT_DIR} 850 cp grids_${CplModel}.nc ${SUBMIT_DIR} 851 cp masks_${CplModel}.nc ${SUBMIT_DIR} 831 ## 832 echo ${Titre}"Add Tag"${Norm} 833 ## =========================================================================== 834 if [[ "X${Tag}" != "X" ]] ; then 835 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 836 mv ${File} $(basename ${File} .nc)_${Tag}.nc 837 done 852 838 fi 839 ## 840 echo ${Titre}"Add Version"${Norm} 841 ## =========================================================================== 842 if [[ "X${Version}" != "X" ]] ; then 843 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 844 mv ${File} $(basename ${File} .nc)_${Version}.nc 845 done 846 fi 847 848 ## =========================================================================== 849 echo ${Titre}"Save results"${Norm} 850 ## =========================================================================== 851 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 852 cp ${File} ${SUBMIT_DIR} 853 done 854 853 855 854 856 ## … … 895 897 896 898 echo ${Titre}"Compute checksums and add them to README"${Norm} 897 # ----------------------------------------- 899 # ------------------------------------------------------------ 898 900 cat << EOF >> README.txt 899 901 UUID common to all files : ${UUID} … … 903 905 EOF 904 906 905 for file in *.nc; do907 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 906 908 echo "$(shasum ${file})" >> README.txt 907 909 done -
TOOLS/MOSAIX/RunoffWeights.py
r4195 r4199 3 3 ### 4 4 ### Compute runoff weights. 5 ### For LMDZ only. Not suitable for DYNAMICO 5 6 ### 6 7 ### =========================================================================== … … 65 66 parser.add_argument ('--masks' , help='areas file name', default='masks.nc' ) 66 67 parser.add_argument ('--o2a' , help='o2a file name' , default='o2a.nc' ) 67 parser.add_argument ('--output', help='output rmp file name', default='rmp_tlmd_to_torc_runoff _64bit.nc' )68 parser.add_argument ('--fmt' , help='NetCDF file format, using nco syntax', default=' 64bit', choices=['classic', 'netcdf3', '64bit', '64bit_data', '64bit_data', 'netcdf4', 'netcdf4_classsic'] )68 parser.add_argument ('--output', help='output rmp file name', default='rmp_tlmd_to_torc_runoff.nc' ) 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'] ) 69 70 70 71 # Parse command line … … 97 98 if atm_Name.find('LMD') >= 0 : atm_n = 'lmd' ; atmDomainType = 'rectilinear' 98 99 if atm_Name.find('ICO') >= 0 : atm_n = 'ico' ; atmDomainType = 'unstructured' 99 if oce_Name.find('ORC') >= 0 : oce_n = 'orc' ; oceDomainType = 'curvilinear'100 100 101 101 print ('atmQuantity : ' + str (myargs.atmQuantity) ) … … 152 152 oce_grid_imask = oce_grid_imask2D.ravel() 153 153 ## 154 print ("De fines a coastal bands (on ocean) in the ocean")154 print ("Determination d'une bande cotiere ocean") 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 ("De fines a coastal bands (on land) in the atmosphere" )181 print ("Determination d'une bande cotiere atmosphere " ) 182 182 atmLand = np.where (o2aFrac[:] < epsfrac , True, False) 183 183 atmLandFrac = np.where (o2aFrac[:] < zone-epsfrac , True, False)
Note: See TracChangeset
for help on using the changeset viewer.