Changeset 4186 for TOOLS/MOSAIX
- Timestamp:
- 12/12/18 11:26:20 (5 years ago)
- Location:
- TOOLS/MOSAIX
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/MOSAIX/CalvingWeights.py
r4172 r4186 43 43 parser.add_argument ('--repartition_var' , help='Variable name for iceshelf' , type=str, default=None) 44 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 s', choices=['classic', 'netcdf3', '64bit', '64bit_data', '64bit_data', 'netcdf4', 'netcdf4_classsic'] )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'] ) 46 46 47 47 # Parse command line … … 308 308 f_calving.Program = "Generated by " + sys.argv[0] + " with flags " + str(sys.argv[1:]) 309 309 f_calving.repartitionType = myargs.type 310 if myargs.type in [ 'iceberg', 'iceshelf' ] :310 if myargs.type in [ 'iceberg', 'iceshelf' ] : 311 311 f_calving.repartitionFile = myargs.repartition_file 312 312 f_calving.repartitionVar = repartitionVar … … 333 333 f_calving.SVN_HeadURL = "$HeadURL$" 334 334 335 d_nb_zone 336 d_num_links 337 d_num_wgts 335 d_nb_zone = f_calving.createDimension ('nb_zone' , nb_zone ) 336 d_num_links = f_calving.createDimension ('num_links' , num_links ) 337 d_num_wgts = f_calving.createDimension ('num_wgts' , 1 ) 338 338 339 339 d_src_grid_size = f_calving.createDimension ('src_grid_size' , src_grid_size ) 340 340 d_src_grid_corners = f_calving.createDimension ('src_grid_corners', src_clo.shape[0] ) 341 D_src_grid_rank = f_calving.createDimension ('src_grid_rank' , 2 )341 d_src_grid_rank = f_calving.createDimension ('src_grid_rank' , 2 ) 342 342 343 343 d_dst_grid_size = f_calving.createDimension ('dst_grid_size' , dst_grid_size ) … … 398 398 v_dst_repartition = f_calving.createVariable ( 'dst_repartition' , 'f8', ('nb_zone', 'dst_grid_size',) ) 399 399 400 v_dst_southLimit = f_calving.createVariable ('dst_southLimit', 'f4', ('nb_zone',) ) 401 v_dst_northLimit = f_calving.createVariable ('dst_northLimit', 'f4', ('nb_zone',) ) 402 v_dst_southLimit[:] = np.min(limit_lat, axis=(1,) ) 403 v_dst_northLimit[:] = np.max(limit_lat, axis=(1,) ) 404 400 405 v_dst_grid_dims [:] = ( dst_jpi, dst_jpi ) 401 406 v_dst_grid_center_lon[:] = dst_lon[:].ravel() -
TOOLS/MOSAIX/CreateOasisGrids.bash
r4172 r4186 54 54 PROGRAM=$(basename ${0}) 55 55 56 case ${arch} in57 ( curie | irene )58 set +vx59 module unload cdo nco ferret60 module unload netcdf hdf561 module load python # /2.7.1262 module load netcdf/4.3.3.1_hdf5_parallel # Version for XIOS63 module load nco64 R_IN=$(ccc_home -u igcmg --cccwork)/IGCM65 TMPDIR=${SCRATCHDIR}/TMP66 SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}}67 ;;68 ( spip )69 R_IN=${HOME}/Scratch/IGCM70 TMPDIR=${HOME}/Scratch/TMP71 SUBMIT_DIR=$(pwd)72 MPIRUN=/opt/local/bin/mpirun-openmpi-gcc49 -n 273 ;;74 ( * ) exit -1 ;;75 esac56 # 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 76 77 77 ## … … 185 185 186 186 ncks --fl_fmt=${FL_FMT3} --history -C --variable OceMask ${ATM}_grid_maskFrom_${OCE}_${FL_FMT3}.nc OceMask_tmp.nc 187 ncwa --history --overwrite --average time_counter OceMask_tmp.nc OceMask_tmp2.nc # Suppress time dimension 187 188 ncatted --history \ 189 --attribute cell_methods,OceMask,d,c, \ 188 190 --attribute coordinates,OceMask,d,, \ 189 191 --attribute online_operation,OceMask,d,, \ … … 191 193 --attribute missing_value,OceMask,d,, \ 192 194 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=1195 ncap2 --fl_fmt=${FL_FMT3} --history --append --script "OceMask=int(1-OceMask)" OceMask_tmp2.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1 194 196 rm OceMask_tmp.nc 195 197 ncatted --history \ … … 216 218 217 219 # 218 echo ${Titre}"DYNAMICO grids : 1) Set correct order of dimensions, 2) Add a dimension"${Norm}219 # ----------------------------------------------------------------------------220 220 if [[ ${atm} = dynamico* || ${atm} = ico* ]] ; then 221 echo ${Titre}"DYNAMICO grids : 1) Set correct order of dimensions, 2) Add a dimension"${Norm} 222 # ------------------------------------------------------------------------------------------- 221 223 mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 222 224 ncpdq --permute nvertex,ycell,xcell grids_${CplModel}_tmp.nc grids_${CplModel}.nc 223 225 224 226 mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc 225 227 cat <<EOF >add_dim.nco … … 232 234 // 233 235 EOF 234 236 235 237 ncap2 --fl_fmt=${FL_FMT3} --history --append --script-file add_dim.nco grids_${CplModel}_tmp.nc grids_${CplModel}.nc 236 238 237 239 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 239 243 240 244 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}.nc245 ncap2 --fl_fmt=${FL_FMT3} --history --append --script 'defdim("xcell",1) ; aire[ycell,xcell]=aire ; ' areas_${CplModel}_tmp.nc areas_${CplModel}.nc 242 246 243 247 rm -f grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc 244 248 fi 245 249 246 250 # 247 251 echo ${Titre}"Some changes specific to LMDZ lon/lat grid"${Norm} … … 292 296 293 297 # 298 294 299 echo ${Titre}"Generates grid o${atm}, 'o' meaning 'one'"${Norm} 295 300 # same as t${atm} grid, with surfaces set to 1 … … 308 313 rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc 309 314 315 316 echo ${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 # -------------------------------------------------------------------------------------------------------- 321 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}.nc 323 324 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}.nc 326 327 ncks -C --history --overwrite -v maskutil_T ${OCE}_coordinates_mask_${FL_FMT3}.nc maskutil_T_${FL_FMT3}.nc 328 ncap2 --fl_fmt=${FL_FMT3} --history --append --script "mask_O=maskutil_T; " maskutil_T_${FL_FMT3}.nc masks_${CplModel}.nc 329 330 rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc 331 332 333 echo ${Titre}"Creates OCEAN C grid : redundant points removed to compute proper integrals"${Norm} 334 # -------------------------------------------------------------------------------------------------------- 335 336 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}.nc 338 339 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 346 310 347 # 311 348 echo ${Titre}"Final renaming"${Norm} 312 349 # ---------------------------------------------------------------------------- 313 for OCEGRID in T U V 350 for OCEGRID in T U V O C 314 351 do 315 352 ocegrid=${OCEGRID~} # To lowercase … … 342 379 ncrename --history --variable bounds_o${atm}_lat,o${atm}.cla grids_${CplModel}.nc 343 380 344 for atmgrid in t o ; do 381 for ATMGRID in T O ; do 382 atmgrid=${ATMGRID~} # To lowercase 345 383 ncatted --history \ 346 384 --attribute bounds,${atmgrid}${atm}.lon,c,c,"${atmgrid}${atm}.clo" \ … … 414 452 415 453 ## =========================================================================== 416 echo ${Titre}" exit from CreateOasisGrids "${Norm}454 echo ${Titre}"Exit from CreateOasisGrids "${Norm} 417 455 418 456 ## =========================================================================== -
TOOLS/MOSAIX/CreateWeightsMask.bash
r4172 r4186 5 5 #MSUB -eo 6 6 #MSUB -n 16 # Number of processors 7 #MSUB -T 1800 # Time limit (seconds)7 #MSUB -T 7200 # Time limit (seconds) 8 8 #MSUB -q skylake 9 #MSUB -Q test10 9 #MSUB -p gen2212 11 10 #MSUB -m work … … 45 44 couleurs=( "Black" "Blue" "Green" "Cyan" "Red" "Magenta" "Yellow" "White" ) 46 45 for i in $(seq 0 7 ) ; do eval "export ${couleurs[$i]}=$(tput setf $i)" ; done 47 export Norm=$(tput sgr0 46 export Norm=$(tput sgr0) 48 47 export Titre=${Bold}${Blue} 49 48 … … 56 55 echo ${Titre}"Defines models"${Norm} 57 56 # ============== 58 OCE=ORCA2.359 #OCE=eORCA1.257 #OCE=ORCA2.3 58 OCE=eORCA1.2 60 59 #OCE=eORCA025 61 60 62 61 #ATM=ICO30 63 #ATM=ICO4062 ATM=ICO40 64 63 #ATM=ICO450 65 ATM=LMD969564 #ATM=LMD9695 66 65 #ATM=LMD144142 67 66 #ATM=LMD256256 68 67 69 # Runoff parameter (LMDZ grids only) 70 atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=1000.0 71 72 if [[ ${OCE} = ORCA2.3 && ${ATM} = LMD9695 ]] ; then atmCoastWidth=2 ; oceCoastWidth=1 ; searchRadius=1000.0 ; fi 73 if [[ ${OCE} = ORCA2.3 && ${ATM} = LMD144142 ]] ; then atmCoastWidth=2 ; oceCoastWidth=1 ; searchRadius=1000.0 ; fi 74 if [[ ${OCE} = eORCA1.2 && ${ATM} = LMD9695 ]] ; then atmCoastWidth=2 ; oceCoastWidth=3 ; searchRadius=1000.0 ; fi 75 if [[ ${OCE} = eORCA1.2 && ${ATM} = LMD144142 ]] ; then atmCoastWidth=2 ; oceCoastWidth=3 ; searchRadius=1000.0 ; fi 68 echo ${Titre}"ATM model : ${ATM}"${Norm} 69 echo ${Titre}"OCE model : ${OCE}"${Norm} 70 71 # Runoff parameter. atmCoastWidth and oceCoastWidth in grid points, searchRadius in km 72 atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=600.0 73 runOff_atmQuantity=Quantity runOff_oceQuantity=Surfacic 74 75 [[ ${ATM} = ICO* ]] && atmCoastWidth=0 # Parameter relevant for LMD rectilinear grid only 76 [[ ${ATM} = LMD* ]] && atmCoastWidth=2 77 [[ ${OCE} = ORCA2.3 ]] && oceCoastWidth=1 78 [[ ${OCE} = eORCA1.2 ]] && oceCoastWidth=3 79 [[ ${OCE} = eORCA025 ]] && oceCoastWidth=1 80 76 81 77 82 # Default values, used to create ocean fraction on atmospheric grid 78 DefaultValues=( Direction=o2a,oceGrid=t,atmGrid=t,Order=1st,Quantity=false,Renormalize=false,useArea=false,maskSrc=true,maskDst=false )83 DefaultValues=( Direction=o2a,oceGrid=t,atmGrid=t,Order=1st,Quantity=false,Renormalize=false,useArea=false,maskSrc=true,maskDst=false,Name=OceFrac ) 79 84 80 85 ## List of weights to build … … 98 103 # maskDst : true to use the destination grid mask, false to use all grid points 99 104 # 100 # Classic cases 101 AtmOceFluxes=" Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true" # Heat and water fluxes 102 OceAtmTemp=" Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true" # Temperature, sea-ice fraction, albedo 103 AtmOceStressU="Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true" # Wind stress to NEMO U point 104 AtmOceStressV="Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=v,useArea=true,maskSrc=true,maskDst=true" # Wind stress to NEMO V point 105 # Classic cases for IPSLCM6 106 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 107 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 108 AtmOceStressU=" Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true,Name=WindStress" # Wind stress to NEMO U point 109 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 110 AtmOceQuantity="Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=t,oceGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=Quantity" # e.g. runoff 105 111 # Other cases 106 OceAtmFluxes=" Direction=o2a,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true" # e.g. CO2 fluxes 107 AtmOceTemp=" Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true" # e.g. T and S correction from DWL parametrization 108 AtmOceCoastal="Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=c,oceGrid=t,useArea=true,maskSrc=true,maskDst=true" # Runoff atm to oce, limited to oce coastal points 109 110 CommandList=( ${AtmOceFluxes} Runoff Calving ) 111 112 #CommandList=( Runoff Calving ) #\ 113 # Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true \ 114 # Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true \ 115 # Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true \ 116 # Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=v,useArea=true,maskSrc=true,maskDst=true \ 117 # Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=c,oceGrid=t,useArea=true,maskSrc=true,maskDst=true \ 118 # Calving \ 119 # Runoff \ 120 # ) 121 112 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 113 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 114 115 # Standard list for IPSLCM6 116 #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} Runoff Calving Grids ) 117 118 # More comprehesive list for IPSLCM6 with new features 119 CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${AtmOceTemp} Runoff Calving Grids ) 120 121 # Debugs 122 #CommandList=( Runoff ) 123 #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} Runoff Calving Grids ) 124 #CommandList=( Calving ) 125 #CommandList=( Grids ) 122 126 123 127 124 128 Comment="Preliminary attempt - Do not trust !" 125 #Version 129 Version="_v0" 126 130 127 131 ## =========================================================================== … … 130 134 ## 131 135 ## =========================================================================== 136 Tag="_MOSAIX" 132 137 SUBMIT_DIR=$(pwd) 133 138 … … 152 157 function setValues { 153 158 # 159 read_Command "Direction=None,Order=None,Quantity=None,Renormalize=None,atmGrid=None,oceGrid=None,useArea=None,maskSrc=None,maskDst=None" 160 read_Command ${1} 161 # 154 162 oceGrid=${oceGrid,,} ; atmGrid=${atmGrid,,} 155 163 OCEGRID=${oceGrid^^} ; ATMGRID=${atmGrid^^} … … 171 179 ( false ) AreaName=NoArea ;; 172 180 esac 173 174 Suffix=${Order}Order_${NormName}_${QuantName}_${AreaName} 181 182 if [[ "${Name}" != "None" ]] ; then 183 Suffix=${Name} 184 else 185 Suffix=${Order}Order_${NormName}_${QuantName}_${AreaName} 186 fi 175 187 176 188 case ${Direction} in … … 184 196 ;; 185 197 esac 186 echo ${Green}"${SRC} ${SRCGRID} toward ${DST} ${DSTGRID} - ${Order} Order - Normalize: ${Renormalize} - Quantity: ${QuantName} - Area: ${AreaName} "${Norm} 198 echo ${Green}"${SRC} ${SRCGRID} toward ${DST} ${DSTGRID} - ${Order} Order - Normalize: ${Renormalize} - Quantity: ${QuantName} - Area: ${AreaName} "${Norm} 199 echo ${Green}"Suffix : ${Suffix}"${Norm} 187 200 } 188 201 189 202 # 190 203 # Defines computer … … 203 216 PROGRAM=${BRIDGE_MSUB_REQNAME} 204 217 MpiRun="time ccc_mprun" 205 PyRun=" ccc_mprun -n 1"218 PyRun="time ccc_mprun -n 1" 206 219 source ${SUBMIT_DIR}/arch.env 207 220 module load nco … … 263 276 ncks --overwrite --fl_fmt=${FMT_OASIS} --history ${ATM}_grid.nc ${ATM}_grid_${FMT_OASIS}.nc 264 277 # 265 echo ${Titre}"Creates OCEAN C grid : redundant points removed to compute proper integrals # A passer dans CreateWeights"${Norm}266 # --------------------------------------------------------------------------------------------------------267 cat <<EOF >add_c_grid.nco268 defdim("x_grid_C", \$x_grid_T.size) ;269 defdim("y_grid_C", \$y_grid_T.size) ;270 defdim("nvertex_grid_C", 4) ;271 nav_lon_grid_C[y_grid_C,x_grid_C] = nav_lon_grid_T(:,:) ;272 nav_lat_grid_C[y_grid_C,x_grid_C] = nav_lat_grid_T(:,:) ;273 bounds_lon_grid_C[y_grid_C,x_grid_C,nvertex_grid_C] = bounds_lon_grid_T(:,:,:) ;274 bounds_lat_grid_C[y_grid_C,x_grid_C,nvertex_grid_C] = bounds_lat_grid_T(:,:,:) ;275 mask_C[y_grid_C,x_grid_C] = maskutil_T(:,:) ;276 area_grid_C[y_grid_C,x_grid_C] = area_grid_T(:,:) ;277 EOF278 279 ncap2 --overwrite --history --script-file add_c_grid.nco ${OCE}_coordinates_mask.nc tmp_${OCE}_coordinates_mask.nc280 ncatted --history --attribute bounds,nav_lon_grid_C,m,c,"bounds_lon_grid_C" tmp_${OCE}_coordinates_mask.nc281 ncatted --history --attribute bounds,nav_lat_grid_C,m,c,"bounds_lat_grid_C" tmp_${OCE}_coordinates_mask.nc282 ncks --history --overwrite --variable nav_lon_grid_C,nav_lat_grid_C tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc283 ncks --history --append --variable bounds_lon_grid_C,bounds_lat_grid_C tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc284 ncks --history --append --variable area_grid_C tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc285 286 ncks --history --append C_${OCE}_coordinates_mask.nc ${OCE}_coordinates_mask.nc287 rm C_${OCE}_coordinates_mask.nc288 289 ncks --history --overwrite --fl_fmt=${FMT_OASIS} ${OCE}_coordinates_mask.nc ${OCE}_coordinates_mask_${FMT_OASIS}.nc290 291 ls -al278 # echo ${Titre}"Creates OCEAN C grid : redundant points removed to compute proper integrals # A passer dans CreateWeights"${Norm} 279 # # -------------------------------------------------------------------------------------------------------- 280 # cat <<EOF >add_c_grid.nco 281 # defdim("x_grid_C", \$x_grid_T.size) ; 282 # defdim("y_grid_C", \$y_grid_T.size) ; 283 # defdim("nvertex_grid_C", 4) ; 284 # nav_lon_grid_C[y_grid_C,x_grid_C] = nav_lon_grid_T(:,:) ; 285 # nav_lat_grid_C[y_grid_C,x_grid_C] = nav_lat_grid_T(:,:) ; 286 # bounds_lon_grid_C[y_grid_C,x_grid_C,nvertex_grid_C] = bounds_lon_grid_T(:,:,:) ; 287 # bounds_lat_grid_C[y_grid_C,x_grid_C,nvertex_grid_C] = bounds_lat_grid_T(:,:,:) ; 288 # mask_C[y_grid_C,x_grid_C] = maskutil_T(:,:) ; 289 # area_grid_C[y_grid_C,x_grid_C] = area_grid_T(:,:) ; 290 # EOF 291 292 # ncap2 --overwrite --history --script-file add_c_grid.nco ${OCE}_coordinates_mask.nc tmp_${OCE}_coordinates_mask.nc 293 # ncatted --history --attribute bounds,nav_lon_grid_C,m,c,"bounds_lon_grid_C" tmp_${OCE}_coordinates_mask.nc 294 # ncatted --history --attribute bounds,nav_lat_grid_C,m,c,"bounds_lat_grid_C" tmp_${OCE}_coordinates_mask.nc 295 # ncks --history --overwrite --variable nav_lon_grid_C,nav_lat_grid_C tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc 296 # ncks --history --append --variable bounds_lon_grid_C,bounds_lat_grid_C tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc 297 # ncks --history --append --variable area_grid_C tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc 298 299 # ncks --history --append C_${OCE}_coordinates_mask.nc ${OCE}_coordinates_mask.nc 300 # rm C_${OCE}_coordinates_mask.nc 301 302 # ncks --history --overwrite --fl_fmt=${FMT_OASIS} ${OCE}_coordinates_mask.nc ${OCE}_coordinates_mask_${FMT_OASIS}.nc 303 304 # ls -al 292 305 293 306 ## … … 295 308 ## =========================================================================== 296 309 echo "Command parameters : ${Command}" 297 read_Command ${DefaultValues} 298 read_Command ${Command} 299 setValues 310 setValues ${DefaultValues} 300 311 301 312 cp iodef_oce_to_atm.xml iodef.xml … … 416 427 do 417 428 echo "Command parameters : ${Command}" 418 read_Command ${DefaultValues} 419 read_Command ${Command} 420 429 setValues ${Command} 421 430 if [[ ${Command} = "Runoff" ]] ; then okRunoff=yes ; continue ; fi 422 431 if [[ ${Command} = "Calving" ]] ; then okCalving=yes ; continue ; fi 423 424 setValues 432 if [[ ${Command} = "Grids" ]] ; then okGrids=yes ; continue ; fi 425 433 426 434 ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc … … 620 628 done 621 629 630 ls 622 631 ## 623 632 echo ${Titre}"Add missing variables in rmp files"${Norm} 624 633 ## =========================================================================== 625 for $(ls rmpFile in rmp_?${atm}_to_[tuv]${oce}_*.nc rmp_[tuv]${oce}_to_t${atm}_*.nc*2>/dev/null) ; do634 for rmpFile in $(ls rmp_?${atm}_to_[tuv]${oce}_*.nc rmp_[tuv]${oce}_to_t${atm}_*.nc 2>/dev/null) ; do 626 635 echo ${rmpFile} 627 636 a_to_o=false ; o_to_a=false … … 760 769 761 770 ## 771 ## ============================================================================ 762 772 echo ${Titre}"Creates and save auxiliary files for OASIS : grids.nc, areas.nc and masks.nc"${Norm} 763 ## ============================================================================ 764 bash ${SUBMIT_DIR}/CreateOasisGrids.bash --oce ${OCE} --atm ${ATM} 765 773 cp ${SUBMIT_DIR}/CreateOasisGrids.bash . 774 bash CreateOasisGrids.bash --oce ${OCE} --atm ${ATM} 766 775 767 776 … … 769 778 echo ${Titre}"Runoff weights"${Norm} 770 779 ## =========================================================================== 771 if [[ "X${okRunoff}" = "Xyes" && "${atm}" = "lmd" ]] ; then 780 #if [[ "X${okRunoff}" = "Xyes" && "${atm}" = "lmd" ]] ; then 781 if [[ "X${okRunoff}" = "Xyes" ]] ; then 772 782 ${PyRun} python3 -u cotes_etal.py --oce=${OCE} --atm=${ATM} \ 773 783 --atmCoastWidth=${atmCoastWidth} --oceCoastWidth=${oceCoastWidth} --searchRadius=${searchRadius} \ 774 784 --grids=grids_${OCE}x${ATM}.nc --areas=areas_${OCE}x${ATM}.nc --masks=masks_${OCE}x${ATM}.nc \ 775 --o2a=${ATM}_grid_maskFrom_${OCE}.nc --output=rmp_t${atm}_to_t${oce}_runoff_${FMT_OASIS}.nc \ 776 --fmt=${FMT_OASIS} 785 --o2a=${ATM}_grid_maskFrom_${OCE}.nc --output=rmp_t${atm}_to_t${oce}_runoff_${runOff_atmQuantity}_to_${runOff_oceQuantity}_${FMT_OASIS}.nc \ 786 --fmt=${FMT_OASIS} \ 787 --atmQuantity=${runOff_atmQuantity} --oceQuantity=${runOff_oceQuantity} 777 788 fi 778 789 … … 783 794 case ${OCE} in 784 795 ( eORCA025 ) 785 cp ${R_IN}/OCE/NEMO/ORCA025_LIM3_PISCES/v3.6_stable/eORCA_R025_runoff_v1.1.nc . 786 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_full_${FMT_OASIS}.nc --fmt=${FMT_OASIS} \ 787 --oce=${OCE} --atm=${ATM} --type=full --dir=. 796 # cp ${R_IN}/OCE/NEMO/ORCA025_LIM3_PISCES/v3.6_stable/eORCA_R025_runoff_v1.1.nc . 797 cp /ccc/work/cont003/gencmip6/deshayej/eORCA_R025_runoff_v1.2.nc . 788 798 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth_${FMT_OASIS}.nc --fmt=${FMT_OASIS} \ 789 --oce=${OCE} --atm=${ATM} --type=nosouth --dir=. --repartition_file=eORCA_R025_runoff_v1.1.nc799 --oce=${OCE} --atm=${ATM} --type=nosouth --dir=. 790 800 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg_${FMT_OASIS}.nc --fmt=${FMT_OASIS} \ 791 --oce=${OCE} --atm=${ATM} --type=iceberg --dir=. --repartition_file=eORCA_R025_runoff_v1. 1.nc --repartition_var=sornficbisf801 --oce=${OCE} --atm=${ATM} --type=iceberg --dir=. --repartition_file=eORCA_R025_runoff_v1.2.nc --repartition_var=Icb_flux 792 802 ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf_${FMT_OASIS}.nc --fmt=${FMT_OASIS} \ 793 --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=. --repartition_file=eORCA_R025_runoff_v1. 1.nc --repartition_var=sofwfisf803 --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=. --repartition_file=eORCA_R025_runoff_v1.2.nc --repartition_var=sornfisf 794 804 ;; 795 805 … … 827 837 done 828 838 829 cp areas_${OCE}x${ATM}.nc ${SUBMIT_DIR} 830 cp grids_${OCE}x${ATM}.nc ${SUBMIT_DIR} 831 cp masks_${OCE}x${ATM}.nc ${SUBMIT_DIR} 832 839 if [[ "X${okGrids}" = "Xyes" ]] ; then 840 cp areas_${OCE}x${ATM}.nc ${SUBMIT_DIR} 841 cp grids_${OCE}x${ATM}.nc ${SUBMIT_DIR} 842 cp masks_${OCE}x${ATM}.nc ${SUBMIT_DIR} 843 fi 833 844 834 845 ## … … 892 903 EOF 893 904 894 cp README.txt ${SUBMIT_DIR}/README_${OCE}x${ATM} .txt905 cp README.txt ${SUBMIT_DIR}/README_${OCE}x${ATM}_MOSAIX.txt 895 906 896 907 ## =========================================================================== -
TOOLS/MOSAIX/cotes_etal.py
r4172 r4186 37 37 epsfrac = np.dtype('float64').type(1.0E-10) 38 38 pi = np.pi 39 rad = pi/np.dtype('float64').type(180.0) 39 rad = pi/np.dtype('float64').type(180.0) # Conversion from degrees to radian 40 40 ra = np.dtype('float64').type(6371229.0) # Earth radius 41 41 … … 56 56 # Adding arguments 57 57 parser.add_argument ('--oce' , help='oce model name', type=str, default='eORCA1.2', choices=['ORCA2.3', 'eORCA1.2', 'eORCA025'] ) 58 parser.add_argument ('--atm' , help='atm model name (LMD*)', type=str, default='LMD9695' )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 ) 60 60 parser.add_argument ('--oceCoastWidth', help='width of the coastal band in ocean (in grid points)' , type=int, default=2 ) 61 parser.add_argument ('--searchRadius' , help='max distance to connect a land point to an ocean point (in km)', type=float, default=600000.0) 61 parser.add_argument ('--atmQuantity' , help='Quantity if atm provides quantities (m/s), Surfacic if atm provided flux (m/s/m2)' , type=str, default='Quantity', choices=['Quantity', 'Surfacic'] ) 62 parser.add_argument ('--oceQuantity' , help='Quantity if oce requires quantities (ks/s), Surfacic if oce requires flux (m/s/m2)' , type=str, default='Surfacic', choices=['Quantity', 'Surfacic'] ) 63 parser.add_argument ('--searchRadius' , help='max distance to connect a land point to an ocean point (in km)', type=float, default=600.0 ) 62 64 parser.add_argument ('--grids' , help='grids file name', default='grids.nc' ) 63 65 parser.add_argument ('--areas' , help='masks file name', default='areas.nc' ) … … 93 95 if myargs.fmt == 'netcdf4_classic' : FmtNetcdf = 'NETCDF4_CLASSIC' 94 96 97 # 98 if atm_Name.find('LMD') >= 0 : atm_n = 'lmd' ; atmDomainType = 'rectilinear' 99 if atm_Name.find('ICO') >= 0 : atm_n = 'ico' ; atmDomainType = 'unstructured' 100 101 print ('atmQuantity : ' + str (myargs.atmQuantity) ) 102 print ('oceQuantity : ' + str (myargs.oceQuantity) ) 103 95 104 ### Read coordinates of all models 96 105 ### … … 104 113 o2aFrac = np.where ( np.abs(o2aFrac) < 1E10, o2aFrac, 0.0) 105 114 106 atm_grid_center_lat = gridFile['tlmd.lat'][:] 107 atm_grid_center_lon = gridFile['tlmd.lon'][:] 108 atm_grid_corner_lat = gridFile['tlmd.cla'][:] 109 atm_grid_corner_lon = gridFile['tlmd.clo'][:] 110 111 atm_grid_area = areaFile['tlmd.srf'][:] 112 atm_grid_imask = 1-maskFile['tlmd.msk'][:].squeeze() 113 atm_grid_dims = atm_grid_area.shape 114 (atm_nvertex, atm_jpj, atm_jpi) = atm_grid_corner_lat.shape 115 (atm_nvertex, atm_jpj, atm_jpi) = gridFile['t'+atm_n+'.clo'][:].shape 116 atm_grid_size = atm_jpj*atm_jpi 117 atm_grid_rank = len(gridFile['t'+atm_n+'.lat'][:].shape) 118 119 atm_grid_center_lat = gridFile['t'+atm_n+'.lat'][:].ravel() 120 atm_grid_center_lon = gridFile['t'+atm_n+'.lon'][:].ravel() 121 atm_grid_corner_lat = np.reshape ( gridFile['t'+atm_n+'.cla'][:], (atm_nvertex, atm_grid_size) ) 122 atm_grid_corner_lon = np.reshape ( gridFile['t'+atm_n+'.clo'][:], (atm_nvertex, atm_grid_size) ) 123 atm_grid_area = areaFile['t'+atm_n+'.srf'][:].ravel() 124 atm_grid_imask = 1-maskFile['t'+atm_n+'.msk'][:].squeeze().ravel() 125 atm_grid_dims = gridFile['t'+atm_n+'.lat'][:].shape 126 115 127 atm_perio = 0 116 atm_grid_pmask = nemo.lbc_mask (atm_grid_imask, 'T', atm_perio) 117 atm_address = np.reshape ( np.arange(atm_jpj*atm_jpi), (atm_jpj, atm_jpi) ) 118 atm_grid_size = atm_jpj*atm_jpi 119 120 oce_grid_center_lat = gridFile['torc.lat'][:] 121 oce_grid_center_lon = gridFile['torc.lon'][:] 122 oce_grid_corner_lat = gridFile['torc.cla'][:] 123 oce_grid_corner_lon = gridFile['torc.clo'][:] 124 oce_grid_area = areaFile['torc.srf'][:] 125 oce_grid_imask = 1-maskFile['torc.msk'][:] 126 oce_grid_dims = oce_grid_area.shape 127 (oce_nvertex, oce_jpj, oce_jpi) = oce_grid_corner_lat.shape ; jpon=oce_jpj*oce_jpj 128 atm_grid_pmask = atm_grid_imask 129 atm_address = np.arange(atm_jpj*atm_jpi) 130 131 132 (oce_nvertex, oce_jpj, oce_jpi) = gridFile['torc.cla'][:].shape ; jpon=oce_jpj*oce_jpj 133 oce_grid_size = oce_jpj*oce_jpi 134 oce_grid_rank = len(gridFile['torc.lat'][:].shape) 135 136 oce_grid_center_lat = gridFile['torc.lat'][:].ravel() 137 oce_grid_center_lon = gridFile['torc.lon'][:].ravel() 138 oce_grid_corner_lat = np.reshape( gridFile['torc.cla'][:], (oce_nvertex, oce_grid_size) ) 139 oce_grid_corner_lon = np.reshape( gridFile['torc.clo'][:], (oce_nvertex, oce_grid_size) ) 140 oce_grid_area = areaFile['torc.srf'][:].ravel() 141 oce_grid_imask = 1-maskFile['torc.msk'][:].ravel() 142 oce_grid_dims = gridFile['torc.lat'][:].shape 128 143 if oce_jpi == 182 : oce_perio = 4 # ORCA 2 129 144 if oce_jpi == 362 : oce_perio = 6 # ORCA 1 130 145 if oce_jpi == 1442 : oce_perio = 6 # ORCA 025 131 oce_grid_pmask = nemo.lbc_mask (oce_grid_imask, 'T', oce_perio) 132 oce_address = np.reshape ( np.arange(oce_jpj*oce_jpi), (oce_jpj, oce_jpi) ) 133 oce_grid_size = oce_jpj*oce_jpi 146 oce_grid_pmask = nemo.lbc_mask (np.reshape(oce_grid_imask, (oce_jpj,oce_jpi)), 'T', oce_perio).ravel() 147 oce_address = np.arange(oce_jpj*oce_jpi) 134 148 135 149 ## Fill closed sea with image processing library 136 oce_grid_imask = nemo.lbc_mask ( 1-ndimage.binary_fill_holes (1-nemo.lbc(oce_grid_imask, nperio=oce_perio, cd_type='T')), nperio=oce_perio, cd_type='T' ) 137 150 oce_grid_imask2D = np.reshape(oce_grid_pmask,(oce_jpj,oce_jpi)) 151 oce_grid_imask2D = nemo.lbc_mask ( 1-ndimage.binary_fill_holes (1-nemo.lbc(oce_grid_imask2D, nperio=oce_perio, cd_type='T')), nperio=oce_perio, cd_type='T' ) 152 oce_grid_imask = oce_grid_imask2D.ravel() 138 153 ## 139 154 print ("Determination d'une bande cotiere ocean") 140 155 141 oceLand = np.where (oce_grid_pmask[:] < 0.5, True, False)142 oceOcean = np.where (oce_grid_pmask[:] > 0.5, True, False)156 oceLand2D = np.reshape ( np.where (oce_grid_pmask[:] < 0.5, True, False), (oce_jpj, oce_jpi) ) 157 oceOcean2D = np.reshape ( np.where (oce_grid_pmask[:] > 0.5, True, False), (oce_jpj, oce_jpi) ) 143 158 144 159 NNocean = 1+2*oceCoastWidth 145 oceOceanFiltered = ndimage.uniform_filter(oceOcean.astype(float), size=NNocean) 146 oceCoast = np.where (oceOceanFiltered<(1.0-0.5/(NNocean**2)),True,False) & oceOcean 147 oceCoast = nemo.lbc_mask (oceCoast, oce_perio, 'T') 160 oceOceanFiltered2D = ndimage.uniform_filter(oceOcean2D.astype(float), size=NNocean) 161 oceCoast2D = np.where (oceOceanFiltered2D<(1.0-0.5/(NNocean**2)),True,False) & oceOcean2D 162 oceCoast2D = nemo.lbc_mask (np.reshape(oceCoast2D,(oce_jpj,oce_jpi)), oce_perio, 'T').ravel() 163 164 oceOceanFiltered = oceOceanFiltered2D.ravel() 165 oceLand = oceLand2D.ravel() 166 oceOcean = oceOcean2D.ravel() 167 oceCoast = oceCoast2D.ravel() 148 168 149 169 print ('Number of points in oceLand : ' + str(oceLand.sum()) ) … … 166 186 atmOceanFrac = np.where (o2aFrac[:] > epsfrac , True, False) 167 187 168 NNatm = 1+2*atmCoastWidth 169 atmLandFiltered = ndimage.uniform_filter(atmLand.astype(float), size=NNatm) 170 atmCoast = np.where (atmLandFiltered<(1.0-0.5/(NNatm**2)),True,False) & atmLandFrac 171 atmCoast = nemo.lbc_mask (atmCoast, 1, 'T') 172 173 print ('Number of points in atmLand : ' + str(atmLand.sum()) ) 174 print ('Number of points in atmOcean : ' + str(atmOcean.sum()) ) 175 print ('Number of points in atmCoast : ' + str(atmCoast.sum()) ) 176 188 ## La suite marche avec LMDZ seulement !! 189 if atmDomainType == 'rectilinear' : 190 NNatm = 1+2*atmCoastWidth 191 atmLand2D = np.reshape ( atmLand, ( atm_jpj, atm_jpi) ) 192 193 atmLandFiltered2D = ndimage.uniform_filter(atmLand2D.astype(float), size=NNatm) 194 atmCoast2D = np.where (atmLandFiltered2D<(1.0-0.5/(NNatm**2)),True,False) & atmLandFrac 195 196 atmLandFiltered = atmLandFiltered2D.ravel() 197 atmCoast = atmCoast2D.ravel() 198 199 print ('Number of points in atmLand : ' + str(atmLand.sum()) ) 200 print ('Number of points in atmOcean : ' + str(atmOcean.sum()) ) 201 print ('Number of points in atmCoast : ' + str(atmCoast.sum()) ) 202 203 else : 204 atmCoast = atmFrac 205 206 177 207 # Arrays with coastal points only 178 208 atmCoast_grid_center_lon = atm_grid_center_lon[atmCoast] … … 183 213 atmCoast_address = atm_address [atmCoast] 184 214 215 # Initialisations before the loop 185 216 remap_matrix = np.empty ( shape=(0), dtype=np.float64 ) 186 217 atm_address = np.empty ( shape=(0), dtype=np.int32 ) … … 191 222 z_dist = geodist ( atmCoast_grid_center_lon[ja], atmCoast_grid_center_lat[ja], oceCoast_grid_center_lon, oceCoast_grid_center_lat) 192 223 z_mask = np.where ( z_dist*ra < searchRadius, True, False) 193 num_links = z_mask.sum()224 num_links = np.int(z_mask.sum()) 194 225 if num_links == 0 : continue 195 226 z_area = oceCoast_grid_area[z_mask].sum() 196 poids = 1.0 / z_area 197 #print ( num_links, z_mask.sum(), z_area ) 227 poids = np.ones ((num_links),dtype=np.float64) / z_area 228 if myargs.atmQuantity == 'Surfacic' : poids = poids * atm_grid_area[ja] 229 if myargs.oceQuantity == 'Quantity' : poids = poids * oceCoast_grid_area[z_mask] 230 if ja % (len(atmCoast_grid_pmask)//50) == 0 : # Control print 231 print ( 'ja:{:8d}, num_links:{:8d}, z_area:{:8.4e}, atm area:{:8.4e}, weights sum:{:8.4e} '.format(ja, num_links, z_area, atm_grid_area[ja], poids.sum() ) ) 198 232 # 199 matrix_local = np.ones ((num_links),dtype=np.float64) * poids 200 # address on source grid : all links points to the same LMDZ point. 233 matrix_local = poids 201 234 atm_address_local = np.ones(num_links, dtype=np.int32 ) * atmCoast_address[ja] 202 # address on destination grid235 # Address on destination grid 203 236 oce_address_local = oceCoast_address[z_mask] 204 237 # Append to global tabs … … 252 285 f_runoff.SVN_HeadURL = "$HeadURL$" 253 286 254 d_num_links 255 d_num_wgts 287 d_num_links = f_runoff.createDimension ('num_links' , num_links ) 288 d_num_wgts = f_runoff.createDimension ('num_wgts' , 1 ) 256 289 257 290 d_atm_grid_size = f_runoff.createDimension ('src_grid_size' , atm_grid_size ) 258 291 d_atm_grid_corners = f_runoff.createDimension ('src_grid_corners', atm_grid_corner_lon.shape[0] ) 259 d_atm_grid_rank = f_runoff.createDimension ('src_grid_rank' , 2)292 d_atm_grid_rank = f_runoff.createDimension ('src_grid_rank' , atm_grid_rank ) 260 293 261 294 d_oce_grid_size = f_runoff.createDimension ('dst_grid_size' , oce_grid_size ) 262 295 d_oce_grid_corners = f_runoff.createDimension ('dst_grid_corners', oce_grid_corner_lon.shape[0] ) 263 d_oce_grid_rank = f_runoff.createDimension ('dst_grid_rank' , 2)296 d_oce_grid_rank = f_runoff.createDimension ('dst_grid_rank' , oce_grid_rank ) 264 297 265 298 v_remap_matrix = f_runoff.createVariable ( 'remap_matrix', 'f8', ('num_links', 'num_wgts') ) … … 289 322 290 323 v_atm_grid_dims [:] = atm_grid_dims 291 v_atm_grid_center_lon[:] = atm_grid_center_lon[:] .ravel()292 v_atm_grid_center_lat[:] = atm_grid_center_lat[:] .ravel()293 v_atm_grid_corner_lon[:] = atm_grid_corner_lon .reshape( (atm_jpi*atm_jpj, d_atm_grid_corners.__len__()) )294 v_atm_grid_corner_lat[:] = atm_grid_corner_lat .reshape( (atm_jpi*atm_jpj, d_atm_grid_corners.__len__()) )295 v_atm_grid_area [:] = atm_grid_area[:] .ravel()296 v_atm_grid_imask [:] = atm_grid_imask[:] .ravel()297 v_atm_grid_pmask [:] = atm_grid_pmask[:] .ravel()324 v_atm_grid_center_lon[:] = atm_grid_center_lon[:] 325 v_atm_grid_center_lat[:] = atm_grid_center_lat[:] 326 v_atm_grid_corner_lon[:] = atm_grid_corner_lon 327 v_atm_grid_corner_lat[:] = atm_grid_corner_lat 328 v_atm_grid_area [:] = atm_grid_area[:] 329 v_atm_grid_imask [:] = atm_grid_imask[:] 330 v_atm_grid_pmask [:] = atm_grid_pmask[:] 298 331 299 332 # -- … … 316 349 317 350 v_oce_grid_dims [:] = oce_grid_dims 318 v_oce_grid_center_lon[:] = oce_grid_center_lon[:] .ravel()319 v_oce_grid_center_lat[:] = oce_grid_center_lat[:] .ravel()320 v_oce_grid_corner_lon[:] = oce_grid_corner_lon .reshape( (oce_jpi*oce_jpj, d_oce_grid_corners.__len__()) )321 v_oce_grid_corner_lat[:] = oce_grid_corner_lon .reshape( (oce_jpi*oce_jpj, d_oce_grid_corners.__len__()) )322 v_oce_grid_area [:] = oce_grid_area[:] .ravel()323 v_oce_grid_imask [:] = oce_grid_imask[:] .ravel()324 v_oce_grid_pmask [:] = oce_grid_pmask[:] .ravel()351 v_oce_grid_center_lon[:] = oce_grid_center_lon[:] 352 v_oce_grid_center_lat[:] = oce_grid_center_lat[:] 353 v_oce_grid_corner_lon[:] = oce_grid_corner_lon 354 v_oce_grid_corner_lat[:] = oce_grid_corner_lon 355 v_oce_grid_area [:] = oce_grid_area[:] 356 v_oce_grid_imask [:] = oce_grid_imask[:] 357 v_oce_grid_pmask [:] = oce_grid_pmask[:] 325 358 326 359 v_atm_lon_addressed = f_runoff.createVariable ( 'src_lon_addressed' , 'f8', ('num_links',) ) … … 338 371 v_atm_lon_addressed.long_name="Longitude" ; v_atm_lon_addressed.standard_name="longitude" ; v_atm_lon_addressed.units="degrees_east" 339 372 v_atm_lat_addressed.long_name="Latitude" ; v_atm_lat_addressed.standard_name="latitude" ; v_atm_lat_addressed.units="degrees_north" 340 v_atm_lon_addressed [:] = atm_grid_center_lon .ravel()[atm_address].ravel()341 v_atm_lat_addressed [:] = atm_grid_center_lat .ravel()[atm_address].ravel()342 v_atm_area_addressed [:] = atm_grid_area .ravel()[atm_address].ravel()343 v_atm_imask_addressed[:] = 1-atm_grid_imask .ravel()[atm_address].ravel()344 v_atm_pmask_addressed[:] = 1-atm_grid_pmask .ravel()[atm_address].ravel()373 v_atm_lon_addressed [:] = atm_grid_center_lon[atm_address] 374 v_atm_lat_addressed [:] = atm_grid_center_lat[atm_address] 375 v_atm_area_addressed [:] = atm_grid_area[atm_address] 376 v_atm_imask_addressed[:] = 1-atm_grid_imask[atm_address] 377 v_atm_pmask_addressed[:] = 1-atm_grid_pmask[atm_address] 345 378 346 379 v_oce_lon_addressed.long_name="Longitude" ; v_oce_lon_addressed.standard_name="longitude" ; v_oce_lon_addressed.units="degrees_east" 347 380 v_oce_lat_addressed.long_name="Latitude" ; v_oce_lat_addressed.standard_name="latitude" ; v_oce_lat_addressed.units="degrees_north" 348 v_oce_lon_addressed [:] = oce_grid_center_lon.ravel()[oce_address].ravel() 349 v_oce_lat_addressed [:] = oce_grid_center_lat.ravel()[oce_address].ravel() 350 v_oce_area_addressed [:] = oce_grid_area.ravel()[oce_address].ravel() 351 v_oce_imask_addressed[:] = 1-oce_grid_imask.ravel()[oce_address].ravel() 352 v_oce_pmask_addressed[:] = 1-oce_grid_pmask.ravel()[oce_address].ravel() 353 354 v_atmLand = f_runoff.createVariable ( 'atmLand' , 'i4', ('src_grid_size',) ) 355 v_atmLandFiltered = f_runoff.createVariable ( 'atmLandFiltered', 'f4', ('src_grid_size',) ) 356 v_atmLandFrac = f_runoff.createVariable ( 'atmLandFrac' , 'i4', ('src_grid_size',) ) 357 v_atmFrac = f_runoff.createVariable ( 'atmFrac' , 'i4', ('src_grid_size',) ) 358 v_atmOcean = f_runoff.createVariable ( 'atmOcean' , 'i4', ('src_grid_size',) ) 359 v_atmOceanFrac = f_runoff.createVariable ( 'atmOceanFrac' , 'i4', ('src_grid_size',) ) 360 v_atmCoast = f_runoff.createVariable ( 'atmCoast' , 'i4', ('src_grid_size',) ) 361 362 v_atmLand[:] = atmLand.ravel() 363 v_atmLandFrac[:] = atmLandFrac.ravel() 364 v_atmLandFiltered[:] = atmLandFiltered.ravel() 365 v_atmFrac[:] = atmFrac.ravel() 366 v_atmOcean[:] = atmOcean.ravel() 367 v_atmOceanFrac[:] = atmOceanFrac.ravel() 368 v_atmCoast[:] = atmCoast.ravel() 381 v_oce_lon_addressed [:] = oce_grid_center_lon[oce_address] 382 v_oce_lat_addressed [:] = oce_grid_center_lat[oce_address]#.ravel() 383 v_oce_area_addressed [:] = oce_grid_area[oce_address] 384 v_oce_imask_addressed[:] = 1-oce_grid_imask[oce_address] 385 v_oce_pmask_addressed[:] = 1-oce_grid_pmask[oce_address] 386 387 if atmDomainType == 'rectilinear' : 388 v_atmLand = f_runoff.createVariable ( 'atmLand' , 'i4', ('src_grid_size',) ) 389 v_atmLandFiltered = f_runoff.createVariable ( 'atmLandFiltered', 'f4', ('src_grid_size',) ) 390 v_atmLandFrac = f_runoff.createVariable ( 'atmLandFrac' , 'i4', ('src_grid_size',) ) 391 v_atmFrac = f_runoff.createVariable ( 'atmFrac' , 'i4', ('src_grid_size',) ) 392 v_atmOcean = f_runoff.createVariable ( 'atmOcean' , 'i4', ('src_grid_size',) ) 393 v_atmOceanFrac = f_runoff.createVariable ( 'atmOceanFrac' , 'i4', ('src_grid_size',) ) 394 395 v_atmLand[:] = atmLand 396 v_atmLandFrac[:] = atmLandFrac 397 v_atmLandFiltered[:] = atmLandFiltered 398 v_atmFrac[:] = atmFrac 399 v_atmOcean[:] = atmOcean 400 v_atmOceanFrac[:] = atmOceanFrac 401 402 v_atmCoast = f_runoff.createVariable ( 'atmCoast' , 'i4', ('src_grid_size',) ) 403 v_atmCoast[:] = atmCoast 369 404 370 405 v_oceLand = f_runoff.createVariable ( 'oceLand' , 'i4', ('dst_grid_size',) ) … … 373 408 v_oceCoast = f_runoff.createVariable ( 'oceCoast' , 'i4', ('dst_grid_size',) ) 374 409 375 v_oceLand[:] = oceLand .ravel()376 v_oceOcean[:] = oceOcean .ravel()377 v_oceOceanFiltered[:] = oceOceanFiltered .ravel()378 v_oceCoast[:] = oceCoast .ravel()410 v_oceLand[:] = oceLand 411 v_oceOcean[:] = oceOcean 412 v_oceOceanFiltered[:] = oceOceanFiltered 413 v_oceCoast[:] = oceCoast 379 414 380 415 f_runoff.sync () -
TOOLS/MOSAIX/rangement.bash
r4172 r4186 17 17 # ============================================================ 18 18 19 for ATM in LMD144142 LMD9695 LMD256256 ICO30 ICO40 ICO450 dynamico30 dynamico40 dynamico45019 for ATM in LMD144142 LMD9695 LMD256256 LMD144x142 LMD96x95 LMD256x256 ICO30 ICO40 ICO450 dynamico30 dynamico40 dynamico450 20 20 do 21 21 for OCE in ORCA2.3 eORCA1.2 eORCA025 ORCA025 22 22 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 )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 ) 24 24 25 25 if [[ -z ${Liste} ]] ; then
Note: See TracChangeset
for help on using the changeset viewer.