Changeset 4153
- Timestamp:
- 11/27/18 17:08:31 (6 years ago)
- Location:
- TOOLS/MOSAIX
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/MOSAIX/CreateWeightsMask.bash
r4146 r4153 53 53 # Defines models 54 54 # ============== 55 OCE=ORCA2.356 #OCE=eORCA1.255 #OCE=ORCA2.3 56 OCE=eORCA1.2 57 57 #OCE=ORCA025 58 58 … … 60 60 #ATM=ICO40 61 61 #ATM=ICO450 62 ATM=LMD9695 63 #ATM=LMD144X142 64 65 # 66 # Defines OCE grids to handle 67 # =========================== 68 ListOCEGRID="T" # U V 69 ListOrder="1st" # 2nd 70 ListNormalize="false true" 71 ListQuantity="false true" 62 #ATM=LMD9695 63 ATM=LMD144142 64 65 # Default values, used to create ocean fraction on atmospheric grid 66 DefaultValues=( Direction=o2a,ocegrid=t,atmgrid=t,Order=1st,Quantity=false,Renormalize=false,useArea=false,maskSrc=true,maskDst=false ) 67 68 # List of weights to build 69 CommandList=( \ 70 Direction=o2a,Order=1st,Quantity=false,Renormalize=true,ocegrid=t,atmgrid=t,useArea=false,maskSrc=true,maskDst=true \ 71 Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmgrid=t,ocegrid=t,useArea=true,maskSrc=true,maskDst=true \ 72 Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmgrid=t,ocegrid=u,useArea=true,maskSrc=true,maskDst=true \ 73 Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmgrid=t,ocegrid=v,useArea=true,maskSrc=true,maskDst=true \ 74 Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmgrid=c,ocegrid=t,useArea=true,maskSrc=true,maskDst=true \ 75 ) 72 76 73 77 ## =========================================================================== … … 77 81 ## =========================================================================== 78 82 SUBMIT_DIR=$(pwd) 79 83 # Function to handle command parameters 84 function read_Command { 85 # Decipher the command line to set bash variables 86 local l_Debug="no" l_Element 87 while [[ ${1} = -* ]] ; do 88 case ${1} in 89 ( -- ) shift ; break ;; 90 ( -d | --debug ) l_Debug="true" ; shift ;; 91 esac 92 done 93 local l_Command=${1} 94 for l_Element in $(echo ${l_Command} | tr "," "\n" ) 95 do 96 [[ "X${l_Debug}" = "Xtrue" ]] && echo ${l_Element} 97 eval export ${l_Element} 98 done 99 } 100 101 function setValues { 102 # 103 ocegrid=${ocegrid,,} 104 atmgrid=${atmgrid,,} 105 OCEGRID=${ocegrid^^} 106 ATMGRID=${atmgrid^^} 107 108 case ${Order} in 109 ( 1st ) numOrder=1 ;; 110 ( 2nd ) numOrder=2 ;; 111 esac 112 case ${Renormalize} in 113 ( true ) NormName=Normalized ;; 114 ( false ) NormName=UnNormalized ;; 115 esac 116 case ${Quantity} in 117 ( true ) QuantName=Integrated ;; 118 ( false ) QuantName=Surfacic ;; 119 esac 120 case ${useArea} in 121 ( true ) AreaName=Area ;; 122 ( false ) AreaName=NoArea ;; 123 esac 124 125 Suffix=${Order}Order_${NormName}_${QuantName}_${AreaName} 126 127 case ${Direction} in 128 ( o2a ) 129 src=${oce} ; SRC=${OCE} ; srcGrid=${ocegrid} ; srcDomainType=${oceDomainType} ; SRCGRID=${OCEGRID} ; srcArea=area_grid_${OCEGRID} 130 dst=${atm} ; DST=${ATM} ; dstGrid=${atmgrid} ; dstDomainType=${atmDomainType} ; DSTGRID=${ATMGRID} ; dstArea=aire 131 ;; 132 ( a2o ) 133 src=${atm} ; SRC=${ATM} ; srcGrid=${atmgrid} ; srcDomainType=${atmDomainType} ; SRCGRID=${ATMGRID} ; srcArea=aire 134 dst=${oce} ; DST=${OCE} ; dstGrid=${ocegrid} ; dstDomainType=${oceDomainType} ; DSTGRID=${OCEGRID} ; dstArea=area_grid_${OCEGRID} 135 ;; 136 esac 137 echo ${Green}"${SRC} ${SRCGRID} toward ${DST} ${DSTGRID} - ${Order} Order - Normalize: ${Renormalize} - Quantity: ${QuantName} - Area: ${AreaName} "${Norm} 138 } 139 80 140 # 81 141 # Defines computer 82 142 # ================ 83 if [[ $(hostname) = curie* ]] ; then arch=curie ; center=tgcc ; fi84 143 if [[ $(hostname) = irene* ]] ; then arch=irene ; center=tgcc ; fi 85 if [[ $(hostname) = lsce 3005*]] ; then arch=spip ; center=spip ; fi144 if [[ $(hostname) = lsce* ]] ; then arch=spip ; center=spip ; fi 86 145 87 146 PROGRAM=$(basename ${0}) 88 147 89 148 case ${arch} in 90 149 ( irene ) 91 150 set +vx 92 module purge93 source $(ccc_home -u igcmg)/MachineEnvironment/irene/env_irene94 module load python/2.7.895 module load datadir/igcmg96 151 R_IN=$(ccc_home -u igcmg --cccwork)/IGCM 97 152 TMPDIR=${CCCWORKDIR}/TMP … … 99 154 PROGRAM=${BRIDGE_MSUB_REQNAME} 100 155 MPIRUN=ccc_mprun 156 source ${SUBMIT_DIR}/arch.env 157 module load nco 158 module load cdo 159 #source $(ccc_home -u igcmg)/MachineEnvironment/irene/env_irene 160 module load python/2.7.8 161 module load datadir/igcmg 101 162 module list 102 163 ;; … … 119 180 # Suffixes 120 181 # --------------------------------------------------------------------------- 121 Listocegrid=${ListOCEGRID,,}122 182 123 183 case ${OCE} in 124 ( *ORC* ) oce=orc ; oce _domain_type=curvilinear ;;184 ( *ORC* ) oce=orc ; oceDomainType=curvilinear ;; 125 185 esac 126 186 case ${ATM} in 127 ( *dynamico* ) atm=ico ; atm _domain_type=unstructured ;;128 ( *ICO* ) atm=ico ; atm _domain_type=unstructured ;;129 ( *lmd* | *LMD* ) atm=lmd ; atm _domain_type=rectilinear ;;187 ( *dynamico* ) atm=ico ; atmDomainType=unstructured ;; 188 ( *ICO* ) atm=ico ; atmDomainType=unstructured ;; 189 ( *lmd* | *LMD* ) atm=lmd ; atmDomainType=rectilinear ;; 130 190 esac 131 191 … … 143 203 cp ${SUBMIT_DIR}/bin/interpol.exe . 144 204 cp ${SUBMIT_DIR}/*.py . 205 cp ${SUBMIT_DIR}/iodef_atm_to_oce.xml . 206 cp ${SUBMIT_DIR}/iodef_oce_to_atm.xml . 145 207 146 208 cp ${R_IN}/OCE/NEMO/${OCE}/${OCE}_coordinates_mask.nc . … … 181 243 ## NEMO T point towards ATM - 1st order 182 244 ## =========================================================================== 183 echo ${Green}"Initial case - ${OCE} T toward ${ATM} - 1stOrder - UnNormalized - Surfacic"${Norm} 184 cp ${SUBMIT_DIR}/iodef_oce_to_atm.xml iodef.xml 185 Suffix=1stOrder_UnNormalized_Surfacic 245 echo "Command parameters : ${Command}" 246 read_Command ${DefaultValues} 247 read_Command ${Command} 248 setValues 249 250 cp iodef_oce_to_atm.xml iodef.xml 186 251 187 252 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="mask_src"]' -k name -v maskutil_T 188 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type} 189 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type} 253 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="area_src"]' -k name -v area_grid_T 254 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} 255 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 256 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 257 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v false 258 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false 259 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v false 190 260 python 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 191 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_t${oce}_to_t${atm}_${Suffix} 192 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${OCE} mask interpolated to ${ATM}" 193 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${oce_domain_type} 194 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${atm_domain_type} 261 python 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 262 python 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} 263 python 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}" 264 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType} 265 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType} 195 266 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t 1 196 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${ oce_domain_type}197 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${ atm_domain_type}198 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_ t${oce}_to_t${atm}_${Suffix}.nc199 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1267 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} 268 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 269 python 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}.nc 270 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 200 271 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t false 201 272 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t false 273 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t false 202 274 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false 203 275 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v false 204 205 cp iodef.xml iodef_t${oce}_to_t${atm}_${Suffix}.xml 276 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v false 277 278 cp iodef.xml iodef_${srcGrid}${src}_to_${dstGrid}${dst}_${Suffix}.xml 206 279 ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc 207 280 ln -fs ${ATM}_grid.nc atm_grid.nc 208 281 209 time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src= yes --mask_dst=no282 time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} 210 283 ## 211 284 ## Correct spurious values (extremes) … … 266 339 [[ ${atm} = *ico* ]] && ncks --alphabetize --history --append --variable bounds_lon,bounds_lat atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc 267 340 268 269 ##270 ## NEMO, other case, towards ATM271 ## ===========================================================================272 for order in ${ListOrder} ; do273 case ${order} in274 ( 1st ) num_order=1 ;;275 ( 2nd ) num_order=2 ;;276 esac277 for normalize in ${ListNormalize} ; do278 for quantity in ${ListQuantity} ; do279 for OCEGRID in ${ListOCEGRID} ; do280 ocegrid=${OCEGRID,,}281 282 case ${normalize} in283 ( true ) NormName=Normalized ;;284 ( false ) NormName=UnNormalized ;;285 esac286 case ${quantity} in287 ( true ) QuantName=Integrated ;;288 ( false ) QuantName=Surfacic ;;289 esac290 291 Suffix=${order}Order_${NormName}_${QuantName}292 293 if [[ ! -f rmp_${ocegrid}${oce}_to_t${atm}_${Suffix}.nc ]] ; then294 295 echo ${Green}"${OCE} ${OCEGRID} toward ${ATM} - ${order}Order - normalize: ${normalize} - quantity: ${quantity}"${Norm}296 297 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="mask_src"]' -k name -v maskutil_${OCEGRID}298 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type}299 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type}300 python 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_${OCEGRID}301 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${ocegrid}${oce}_to_t${atm}_${Suffix}302 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${OCE} mask interpolated to ${ATM}"303 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${oce_domain_type}304 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${atm_domain_type}305 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${num_order}306 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${normalize}307 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t ${quantity}308 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type}309 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type}310 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${num_order}311 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${ocegrid}${oce}_to_t${atm}_${Suffix}.nc312 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${normalize}313 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v ${quantity}314 315 cp iodef.xml iodef_${ocegrid}${oce}_t${atm}_${Suffix}.xml316 317 ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc318 ln -fs ${ATM}_grid.nc atm_grid.nc319 time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src=yes --mask_dst=yes320 fi321 322 done323 done324 done325 done326 ##327 ## ATM towards NEMO points328 ## ===========================================================================329 cp ${SUBMIT_DIR}/iodef_atm_to_oce.xml iodef.xml330 331 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type}332 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type}333 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${ATM} mask interpolated to ${OCE}"334 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${atm_domain_type}335 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${oce_domain_type}336 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type}337 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type}338 339 for order in ${ListOrder} ; do340 case ${order} in341 ( 1st ) num_order=1 ;;342 ( 2nd ) num_order=2 ;;343 esac344 for normalize in ${ListNormalize} ; do345 for quantity in ${ListQuantity} ; do346 case ${normalize} in347 ( true ) NormName=Normalized ;;348 ( false ) NormName=UnNormalized ;;349 esac350 case ${quantity} in351 ( true ) QuantName=Integrated ;;352 ( false ) QuantName=Surfacic ;;353 esac354 355 Suffix=${order}Order_${NormName}_${QuantName}356 357 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${num_order}358 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${num_order}359 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${normalize}360 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t ${quantity}361 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${normalize}362 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v ${quantity}363 364 for OCEGRID in ${ListOCEGRID} ; do365 ocegrid=${OCEGRID,,}366 367 echo ${Green}"${ATM} toward ${OCE} ${OCEGRID} - ${order}Order - normalize: ${normalize} - quantity: ${quantity}"${Norm}368 python 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_${OCEGRID}369 python 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_${OCEGRID}370 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_t${atm}_to_${ocegrid}${oce}_${Suffix}371 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_t${atm}_to_${ocegrid}${oce}_${Suffix}.nc372 cp iodef.xml iodef_t${atm}_to_${ocegrid}${oce}_${Suffix}.xml373 374 ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc375 ln -fs ${ATM}_grid.nc atm_grid.nc376 time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src=yes --mask_dst=yes377 378 done379 done380 done381 done382 341 ## 383 342 ## Creates mask of coastal OCE points … … 396 355 ncks --alphabetize --history --overwrite --fl_fmt=${FMT_OASIS} ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}_${FMT_OASIS}.nc 397 356 398 ## 399 ## ATM towards NEMO points - runoff 400 ## =========================================================================== 401 cp ${SUBMIT_DIR}/iodef_atm_to_oce.xml iodef.xml 402 for normalize in ${ListNormalize} ; do 403 for quantity in ${ListQuantity} ; do 404 case ${normalize} in 405 ( true ) NormName=Normalized ;; 406 ( false ) NormName=UnNormalized ;; 407 esac 408 case ${quantity} in 409 ( true ) QuantName=Integrated ;; 410 ( false ) QuantName=Surfacic ;; 411 esac 357 358 ## 359 ## Other weigths files 360 ## =========================================================================== 361 # Loop on commands 362 for Command in ${CommandList[@]} 363 do 364 echo "Command parameters : ${Command}" 365 read_Command ${DefaultValues} 366 read_Command ${Command} 367 setValues 368 369 ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc 370 ln -fs ${ATM}_grid.nc atm_grid.nc 371 372 case ${Direction} in 373 ( o2a ) 374 cp iodef_oce_to_atm.xml iodef.xml 412 375 413 Suffix=${order}Order_${NormName}_${QuantName} 376 python 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} 377 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_dst"]/field[@id="mask_dst"]' -k name -v OceMask 414 378 415 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} 416 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} 417 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${ATM} coastal mask interpolated to ${OCE}" 418 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${atm_domain_type} 419 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${oce_domain_type} 420 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} 421 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} 422 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 423 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t 1 424 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${normalize} 425 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t ${quantity} 426 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]' -k name -v ${ATM}_grid_maskFrom_${OCE} 427 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="mask_src"]' -k name -v AtmCoastal 428 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_dst"]/field[@id="mask_dst"]' -k name -v OceCoastal 429 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_o${atm}_to_c${oce}_${Suffix} 430 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_o${atm}_to_c${oce}_${Suffix}.nc 431 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${normalize} 432 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v ${quantity} 379 python 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} 380 python 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} 381 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_dst"]/field[@id="mask_dest"]' -k name -v OceMask 382 python 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 383 ;; 384 ( a2o ) 385 cp iodef_atm_to_oce.xml iodef.xml 433 386 434 cp iodef.xml iodef_o${atm}_to_c${oce}_${Suffix}.xml 387 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="mask_src"]' -k name -v OceMask 388 python 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} 435 389 436 ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc 437 ln -fs ${ATM}_grid.nc atm_grid.nc 438 time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src=yes --mask_dst=yes 439 440 # Now we should divide weight par source (atm) grid area : run-off is a quantity/s integrated on the grid mox, not a flux 441 done 390 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_src"]/field[@id="mask_source"]' -k name -v OceMask 391 python 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 392 python 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} 393 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_dst"]/field[@id="area_dest"]' -k name -v area_grid_${DSTGRID} 394 ;; 395 esac 396 397 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 398 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} 399 400 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} 401 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 402 403 python 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}.nc 404 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${numOrder} 405 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v ${Quantity} 406 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${Renormalize} 407 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v ${useArea} 408 409 python 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} 410 python 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}" 411 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType} 412 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType} 413 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${Renormalize} 414 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${numOrder} 415 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t ${Quantity} 416 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t ${useArea} 417 418 cp iodef.xml iodef_${srcGrid}${src}_to_${dstGrid}${dst}_${Suffix}.xml 419 time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} 442 420 done 443 ## 421 422 ## 444 423 ## Copy all NetCDF files to NetCDF 3 format (needed for OASIS) 445 424 ## =========================================================================== 446 425 for InFile in *.nc ; do 447 426 OuFile=$(basename ${InFile} .nc)_${FMT_OASIS}.nc 448 if [[ ! -f ${OuFile} ]] ; then 449 ncks --alphabetize --history --fl_fmt=${FMT_OASIS} ${InFile} ${OuFile} 450 fi 427 [[ ! -f ${OuFile} ]] && ncks --alphabetize --history --fl_fmt=${FMT_OASIS} ${InFile} ${OuFile} 451 428 done 452 429 … … 573 550 ncatted --history \ 574 551 --attribute title,global,o,c,"Weights ${OCE} to ${ATM}" \ 575 --attribute source_grid,global,o,c,"${oce _domain_type}" \576 --attribute dest_grid,global,o,c,"${atm _domain_type}" \552 --attribute source_grid,global,o,c,"${oceDomainType}" \ 553 --attribute dest_grid,global,o,c,"${atmDomainType}" \ 577 554 ${rmpFile} 578 555 ;; … … 580 557 ncatted --history \ 581 558 --attribute title,global,o,c,"Weights ${ATM} to ${OCE}" \ 582 --attribute source_grid,global,o,c,"${atm _domain_type}" \583 --attribute dest_grid,global,o,c,"${oce _domain_type}" \559 --attribute source_grid,global,o,c,"${atmDomainType}" \ 560 --attribute dest_grid,global,o,c,"${oceDomainType}" \ 584 561 ${rmpFile} 585 562 ;; -
TOOLS/MOSAIX/check_conserv.py
r4089 r4153 14 14 ## personal. 15 15 ## 16 # 17 # python3 -i check_conserv.py --file dia_tORCA2.3_to_tLMD9695_1stOrder_Normalized_Surfacic_NoArea.nc --grids grids_ORCA2.3xLMD9695.nc --areas areas_ORCA2.3xLMD9695.nc --masks masks_ORCA2.3xLMD9695.nc --frac LMD9695_grid_maskFrom_ORCA2.3.nc 18 # 16 19 ## SVN information 17 20 __Author__ = "$Author$" … … 21 24 __HeadURL = "$HeadURL$" 22 25 23 import cdms226 import netCDF4 24 27 import numpy as np 25 28 import glob 26 29 import sys, argparse, textwrap 27 30 import nemo 31 import os 28 32 29 33 # Creating a parser … … 50 54 name_input = myargs.file 51 55 52 # Determination des modeles 53 Elements = myargs.file.split('_') 54 55 # 56 # Get dir and file 57 InDir = os.path.dirname (os.path.abspath(myargs.file)) 58 InFile = os.path.basename (os.path.abspath(myargs.file)) 59 60 print ('InDir : ' + InDir ) 61 print ('InFile : ' + InFile ) 62 63 Elements = InFile.split('_') 64 65 # Get models 56 66 Name_src = Elements[1][1:] ; Name_dst = Elements[3][1:] 57 67 grid_src = Elements[1][0] ; grid_dst = Elements[3][0] … … 84 94 if Name_dst.count('ORC') : CplModel = Name_dst + 'x' + Name_src 85 95 86 print ('CplModel : ' + CplModel )87 print ('Input file : ' + name_input )96 print ('CplModel : ' + CplModel ) 97 print ('Input file : ' + name_input ) 88 98 89 99 # Coordonnees et masques 90 100 if myargs.fracs == None : 91 if Name_src.count('ORC') : name_frc = Name_dst + '_grid_maskFrom_' + Name_src + '.nc'92 if Name_dst.count('ORC') : name_frc = Name_src + '_grid_maskFrom_' + Name_dst + '.nc'101 if Name_src.count('ORC') : name_frc = InDir + '/' + Name_dst + '_grid_maskFrom_' + Name_src + '.nc' 102 if Name_dst.count('ORC') : name_frc = InDir + '/' + Name_src + '_grid_maskFrom_' + Name_dst + '.nc' 93 103 else: 94 104 name_frc = myargs.fracs 95 105 96 106 if myargs.guess : 97 n_grids = 'grids_' + CplModel + '.nc'98 n_masks = 'masks_' + CplModel + '.nc'99 n_areas = 'areas_' + CplModel + '.nc'107 n_grids = InDir + '/grids_' + CplModel + '.nc' 108 n_masks = InDir + '/masks_' + CplModel + '.nc' 109 n_areas = InDir + '/areas_' + CplModel + '.nc' 100 110 else : 101 111 n_grids = myargs.grids … … 104 114 105 115 print ('Opening grids file: ' + n_grids ) 106 f_grids = cdms2.open( n_grids )116 f_grids = netCDF4.Dataset ( n_grids ) 107 117 print ('Opening masks file: ' + n_masks ) 108 f_masks = cdms2.open( n_masks )118 f_masks = netCDF4.Dataset ( n_masks ) 109 119 print ('Opening areas file: ' + n_areas ) 110 f_areas = cdms2.open( n_areas )120 f_areas = netCDF4.Dataset ( n_areas ) 111 121 print ('Opening fracs file: ' + name_frc ) 112 f_frac = cdms2.open( name_frc )113 114 # 115 msk_src = np.float64(1.0) - f_masks ( grid_src + name_src + '.msk', squeeze=True)116 lon_src = f_grids ( grid_src + name_src + '.lon', squeeze=True)117 lat_src = f_grids ( grid_src + name_src + '.lat', squeeze=True)118 if myargs.src_int : srf_src = np.ones ( (msk_src.shape), dtype=np.float64 ) 119 else : srf_src = f_areas ( grid_src + name_src + '.srf', squeeze=True)120 121 # 122 msk_dst = np.float64(1.0) - f_masks ( grid_dst + name_dst + '.msk', squeeze=True )123 lon_dst = f_grids ( grid_dst + name_dst + '.lon', squeeze=True)124 lat_dst = f_grids ( grid_dst + name_dst + '.lat', squeeze=True)125 if myargs.dst_int : srf_dst = np.ones ( (msk_dst.shape), dtype=np.float64) 126 else : srf_dst = f_areas ( grid_dst + name_dst + '.srf')122 f_frac = netCDF4.Dataset ( name_frc ) 123 124 # 125 msk_src = np.float64(1.0) - f_masks.variables[ grid_src + name_src + '.msk'][:].squeeze() 126 lon_src = f_grids.variables [grid_src + name_src + '.lon'][:].squeeze() 127 lat_src = f_grids.variables [grid_src + name_src + '.lat'][:].squeeze() 128 if myargs.src_int : srf_src = np.ones ( (msk_src.shape), dtype=np.float64 )[:] 129 else : srf_src = f_areas.variables [grid_src + name_src + '.srf'][:].squeeze() 130 131 # 132 msk_dst = np.float64(1.0) - f_masks.variables[grid_dst + name_dst + '.msk'][:] 133 lon_dst = f_grids.variables [grid_dst + name_dst + '.lon'][:].squeeze() 134 lat_dst = f_grids.variables [grid_dst + name_dst + '.lat'][:].squeeze() 135 if myargs.dst_int : srf_dst = np.ones ( (msk_dst.shape), dtype=np.float64)[:] 136 else : srf_dst = f_areas.variables [grid_dst + name_dst + '.srf'][:].squeeze() 127 137 128 138 # 129 139 if name_src in ( 'ico', 'lmd' ) : 130 140 if myargs.src_nofrac : frc_src = np.ones ( (msk_src.shape), dtype=np.float64) 131 else : frc_src = f_frac ( 'OceFrac', squeeze=True ) 141 else : frc_src = f_frac.variables ['OceFrac'][:].squeeze() 142 132 143 if name_src == 'orc' : frc_src = np.ones ( (msk_src.shape), dtype=np.float64) 144 133 145 if name_dst in ( 'ico', 'lmd' ) : 134 146 if myargs.dst_nofrac : frc_dst = np.ones ( (msk_dst.shape), dtype=np.float64) 135 else : frc_dst = f_frac ( 'OceFrac', squeeze=True ) 147 else : frc_dst = f_frac.variables['OceFrac'][:].squeeze() 148 136 149 if name_dst == 'orc' : frc_dst = np.ones ( (msk_dst.shape), dtype=np.float64) 137 150 … … 156 169 157 170 print ( Name_src ) 158 print 'mask: {:12.3} {:12.3} {:12.3}'.format( np.min(msk_src), np.max(msk_src), np.sum(msk_src) )159 print 'frac: {:12.3} {:12.3} {:12.3}'.format( np.min(frc_src), np.max(frc_src), np.sum(frc_src) )160 print 'area: {:12.3} {:12.3} {:12.3}'.format( np.min(srf_src), np.max(srf_src), np.sum(srf_src) )171 print ( 'mask: {:12.3} {:12.3} {:12.3}'.format( np.min(msk_src), np.max(msk_src), np.sum(msk_src) ) ) 172 print ( 'frac: {:12.3} {:12.3} {:12.3}'.format( np.min(frc_src), np.max(frc_src), np.sum(frc_src) ) ) 173 print ( 'area: {:12.3} {:12.3} {:12.3}'.format( np.min(srf_src), np.max(srf_src), np.sum(srf_src) ) ) 161 174 162 175 print ( Name_dst ) 163 print 'mask: {:12.3} {:12.3} {:12.3}'.format( np.min(msk_dst), np.max(msk_dst), np.sum(msk_dst) )164 print 'frac: {:12.3} {:12.3} {:12.3}'.format( np.min(frc_dst), np.max(frc_dst), np.sum(frc_dst) )165 print 'area: {:12.3} {:12.3} {:12.3}'.format( np.min(srf_dst), np.max(srf_dst), np.sum(srf_dst) )176 print ( 'mask: {:12.3} {:12.3} {:12.3}'.format( np.min(msk_dst), np.max(msk_dst), np.sum(msk_dst) ) ) 177 print ( 'frac: {:12.3} {:12.3} {:12.3}'.format( np.min(frc_dst), np.max(frc_dst), np.sum(frc_dst) ) ) 178 print ( 'area: {:12.3} {:12.3} {:12.3}'.format( np.min(srf_dst), np.max(srf_dst), np.sum(srf_dst) ) ) 166 179 print (' ') 167 180 print ( "Surfaces : %14.6e %14.6e %11.3e"%( area_src, area_dst, (area_src-area_dst)/(area_src+area_dst)*0.5 ) ) … … 169 182 170 183 ## 171 f_input = cdms2.open( name_input )184 f_input = netCDF4.Dataset( name_input ) 172 185 # Loop over fields 173 186 for num in np.arange (1, 7) : … … 177 190 178 191 # Reading field 179 v_src = f_input ( name_src )180 v_dst = f_input ( name_dst )192 v_src = f_input [ name_src ][:] 193 v_dst = f_input [ name_dst ][:] 181 194 182 195 # Compute integrals -
TOOLS/MOSAIX/iodef_atm_to_oce.xml
r4082 r4153 1 1 <?xml version="1.0"?> 2 3 <!-- Earth radius NEMO ra = 6371229 --> 4 <!-- Earth radius LMDZ RA=6371229. --> 5 2 6 <simulation> 3 7 … … 9 13 <file id="file_src" name="atm_grid" mode="read" output_freq="1ts" enabled=".TRUE."> 10 14 <field id="mask_src" name="OceMask" operation="instant" domain_ref="domain_src" /> 15 <field id="area_src" name="aire" operation="instant" domain_ref="domain_src" /> 11 16 </file> 12 17 13 18 <file id="file_dst" name="oce_grid" mode="read" output_freq="1ts" enabled=".TRUE."> 14 <field id="mask_dst" name="mask_T" operation="instant" domain_ref="domain_dst" /> 19 <field id="mask_dst" name="mask_T" operation="instant" domain_ref="domain_dst" /> 20 <field id="area_dst" name="area_grid_T" operation="instant" domain_ref="domain_dst" /> 15 21 </file> 16 22 … … 59 65 <file id="file_src" name="atm_grid" mode="read" output_freq="1ts" enabled=".TRUE."> 60 66 <field id="mask_source" name="OceMask" operation="instant" domain_ref="domain_src" /> 67 <field id="area_source" name="aire" operation="instant" domain_ref="domain_src" /> 61 68 </file> 62 69 63 70 <file id="file_dst" name="oce_grid" mode="read" output_freq="1ts" enabled=".TRUE."> 64 <field id="mask_dest" name="mask_T" operation="instant" domain_ref="domain_dst" /> 71 <field id="mask_dest" name="mask_T" operation="instant" domain_ref="domain_dst" /> 72 <field id="area_dest" name="area_grid_T" operation="instant" domain_ref="domain_dst" /> 65 73 </file> 66 74 … … 74 82 <variable name="normalization" type="string">none</variable> 75 83 <variable name="quantity" type="string">none</variable> 84 <variable name="use_area" type="string">none</variable> 76 85 <variable name="source_grid" type="string">curvilinear</variable> 77 86 <variable name="dest_grid" type="string">unstructured</variable> … … 102 111 103 112 <domain_definition> 104 <domain id="domain_src" type="unstructured" >113 <domain id="domain_src" type="unstructured" radius="6371229.0" > 105 114 <generate_rectilinear_domain/> 106 115 </domain> 107 116 108 <domain id="domain_dst" type="curvilinear" prec="8" >117 <domain id="domain_dst" type="curvilinear" prec="8" radius="6371229.0" > 109 118 <generate_rectilinear_domain/> 110 <interpolate_domain order="1" renormalize="false" quantity="false" write_weight="true" weight_filename="rmp_tatm_to_toce_1storder.nc"/>119 <interpolate_domain order="1" renormalize="false" quantity="false" use_area="false" write_weight="true" weight_filename="rmp_tatm_to_toce.nc" /> 111 120 </domain> 112 121 </domain_definition> -
TOOLS/MOSAIX/iodef_oce_to_atm.xml
r4082 r4153 8 8 9 9 <file id="file_src" name="oce_grid" mode="read" output_freq="1ts" enabled=".TRUE."> 10 <field id="mask_src" name="maskutil_T" operation="instant" domain_ref="domain_src" /> 10 <field id="mask_src" name="maskutil_T" operation="instant" domain_ref="domain_src" /> 11 <field id="area_src" name="area_grid_T" operation="instant" domain_ref="domain_src" /> 11 12 </file> 12 13 13 14 <file id="file_dst" name="atm_grid" mode="read" output_freq="1ts" enabled=".TRUE."> 14 15 <field id="mask_dst" name="OceMask" operation="instant" domain_ref="domain_dst" /> 16 <field id="area_dst" name="aire" operation="instant" domain_ref="domain_dst" /> 15 17 </file> 16 18 … … 58 60 59 61 <file id="file_src" name="oce_grid" mode="read" output_freq="1ts" enabled=".TRUE."> 60 <field id="mask_source" name="maskutil_T" operation="instant" domain_ref="domain_src" /> 62 <field id="mask_source" name="maskutil_T" operation="instant" domain_ref="domain_src" /> 63 <field id="area_source" name="area_grid_T" operation="instant" domain_ref="domain_src" /> 61 64 </file> 62 65 63 66 <file id="file_dst" name="atm_grid" mode="read" output_freq="1ts" enabled=".TRUE."> 64 <field id="aire" name="aire" operation="instant" domain_ref="domain_dst" /> 67 <field id="mask_dest" name="OceMask" operation="instant" domain_ref="domain_dst" /> 68 <field id="area_dest" name="aire" operation="instant" domain_ref="domain_dst" /> 65 69 </file> 66 70 … … 74 78 <variable name="normalization" type="string">none</variable> 75 79 <variable name="quantity" type="string">none</variable> 80 <variable name="use_area" type="string">none</variable> 76 81 <variable name="source_grid" type="string">curvilinear</variable> 77 82 <variable name="dest_grid" type="string">unstructured</variable> … … 105 110 106 111 <domain_definition> 107 <domain id="domain_src" type="curvilinear" >112 <domain id="domain_src" type="curvilinear" radius="6371229.0" > 108 113 <generate_rectilinear_domain/> 109 114 </domain> 110 115 111 <domain id="domain_dst" type="unstructured" prec="8" >116 <domain id="domain_dst" type="unstructured" prec="8" radius="6371229.0" > 112 117 <generate_rectilinear_domain/> 113 <interpolate_domain order="1" renormalize="false" quantity="false" write_weight="true" weight_filename="rmp_toce_to_tatm_1storder.nc"/>118 <interpolate_domain order="1" renormalize="false" quantity="false" use_area="false" write_weight="true" weight_filename="rmp_toce_to_tatm.nc" /> 114 119 </domain> 115 120 </domain_definition> -
TOOLS/MOSAIX/rangement.bash
r4092 r4153 17 17 # ============================================================ 18 18 19 for ATM in LMD144 X142 LMD9695 ICO30 ICO40 ICO450 dynamico30 dynamico40 dynamico45019 for ATM in LMD144142 LMD9695 ICO30 ICO40 ICO450 dynamico30 dynamico40 dynamico450 20 20 do 21 21 for OCE in ORCA2.3 eORCA1.2 ORCA025 … … 27 27 else 28 28 echo "${ATM} : ${OCE} : ${Liste}" 29 echo "${WORK_MOSAIC}/${OCE}x${ATM}" 29 30 mkdir -p ${WORK_MOSAIC}/${OCE}x${ATM} 30 31 mv ${Liste} ${WORK_MOSAIC}/${OCE}x${ATM} -
TOOLS/MOSAIX/src/MOSAIX/interpol.f90
r3940 r4153 16 16 INTEGER :: ni_src, nj_src !< Dimensions of the source grid 17 17 INTEGER :: ni_dst, nj_dst !< Dimensions of the source grid 18 REAL (kind=rl), ALLOCATABLE :: imask_src (:,:), imask_dst (:,:) 18 REAL (kind=rl), ALLOCATABLE :: imask_src (:,:), imask_dst (:,:), area_src(:,:), area_dst(:,:) 19 19 REAL (kind=rl), ALLOCATABLE :: lon_src(:,:), lat_src(:,:), field_src(:,:) 20 20 LOGICAL, ALLOCATABLE :: lmask_src (:,:), lmask_dst (:,:) 21 21 INTEGER :: nout = 0, jf 22 22 CHARACTER (LEN=20) :: nchar, type_src, type_dst 23 LOGICAL :: l_mask_src = .TRUE. , l_mask_dst = .TRUE. 23 LOGICAL :: l_mask_src = .TRUE. , l_mask_dst = .TRUE., l_use_area = .FALSE. 24 24 ! 25 25 REAL (kind=rl), PARAMETER :: rpi = ACOS ( -1.0_rl) … … 64 64 CALL getarg ( ja, cmd_arg ) 65 65 SELECT CASE ( TRIM (cmd_arg) ) 66 CASE ( '--mask_src=yes' ) ; l_mask_src = .TRUE. 67 CASE ( '--mask_src=no' ) ; l_mask_src = .FALSE. 68 CASE ( '--mask_dst=yes' ) ; l_mask_dst = .TRUE. 69 CASE ( '--mask_dst=no' ) ; l_mask_dst = .FALSE. 66 CASE ( '--mask_src=true' ) ; l_mask_src = .TRUE. 67 CASE ( '--mask_src=false' ) ; l_mask_src = .FALSE. 68 CASE ( '--mask_dst=true' ) ; l_mask_dst = .TRUE. 69 CASE ( '--mask_dst=false' ) ; l_mask_dst = .FALSE. 70 CASE ( '--use_area=true' ) ; l_use_area = .TRUE. 71 CASE ( '--use_area=no' ) ; l_use_area = .FALSE. 70 72 END SELECT 71 73 END DO … … 73 75 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- mask_src : ', 1L)" ) rank, l_mask_src 74 76 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- mask_dst : ', 1L)" ) rank, l_mask_dst 77 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- use_area : ', 1L)" ) rank, l_use_area 75 78 76 79 !< Context interpol_read : read masks 77 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- debutinterpol_read')" ) rank80 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Starting interpol_read')" ) rank 78 81 CALL xios_context_initialize ("interpol_read", comm) 79 82 CALL xios_get_handle ("interpol_read", ctx_hdl) 80 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- set current context interpol_read')" ) rank83 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Set current context interpol_read')" ) rank 81 84 CALL xios_set_current_context (ctx_hdl) 82 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- close context definition interpol_read')" ) rank85 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Close context definition interpol_read')" ) rank 83 86 CALL xios_close_context_definition () 84 87 85 88 !< Read characteristics of the source grid 86 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- lecturedomain_src')" ) rank89 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Reading domain_src')" ) rank 87 90 CALL xios_get_domain_attr ("domain_src", ni=ni_src, nj=nj_src) 88 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- lecturedomain_src ', 6I9)") rank, ni_src, nj_src91 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Reading domain_src ', 6I9)") rank, ni_src, nj_src 89 92 ALLOCATE ( lon_src (ni_src, nj_src), lat_src (ni_src, nj_src) ) 90 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- lecturelon lat src ', 6I9)") rank, SIZE (lon_src), &93 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Reading lon lat src ', 6I9)") rank, SIZE (lon_src), & 91 94 & SHAPE (lon_src), SIZE (lat_src), SHAPE (lat_src) 92 95 !! 93 96 ! 94 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- lecturetype src ', 6I9)") rank97 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Reading type src ', 6I9)") rank 95 98 CALL xios_get_domain_attr ("domain_src", TYPE=type_src ) 96 99 SELECT CASE ( TRIM (type_src)) 97 100 CASE ( "rectilinear" ) 98 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- lecturelon lat src rectilinear', 6I9)") rank101 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Reading lon lat src rectilinear', 6I9)") rank 99 102 CALL xios_get_domain_attr ("domain_src", lonvalue_1d=lon_src(:,1), latvalue_1d=lat_src(1,:) ) 100 103 lon_src (:,:) = SPREAD ( lon_src(:,1), DIM=2, ncopies=nj_src) … … 102 105 CASE default 103 106 IF ( nj_src == 1 .AND. ni_src==1) THEN 104 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- lecturelon lat src 2D ', 6I9)") rank107 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Reading lon lat src 2D ', 6I9)") rank 105 108 CALL xios_get_domain_attr ("domain_src", lonvalue_2d=lon_src(:,:), latvalue_2d=lat_src(:,:) ) 106 109 ELSE IF ( nj_src == 1 ) THEN 107 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- lecturelon lat src 1D ', 6I9)") rank110 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Reading lon lat src 1D ', 6I9)") rank 108 111 CALL xios_get_domain_attr ("domain_src", lonvalue_1d=lon_src(:,1), latvalue_1d=lat_src(:,1) ) 109 112 ELSE 110 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- lecturelon lat src 2D ', 6I9)") rank113 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Reading lon lat src 2D ', 6I9)") rank 111 114 CALL xios_get_domain_attr ("domain_src", lonvalue_2d=lon_src(:,:), latvalue_2d=lat_src(:,:) ) 112 115 ENDIF 113 116 END SELECT 117 114 118 !< Read mask on the source grid 115 119 ALLOCATE ( imask_src (ni_src, nj_src), lmask_src (ni_src, nj_src) ) 116 120 IF ( l_mask_src ) THEN 117 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- receive field mask_src')" ) rank121 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Receive field mask_src')" ) rank 118 122 CALL xios_recv_field ("mask_src", imask_src) 119 123 lmask_src = .FALSE. … … 122 126 imask_src (:,:) = 1 ; lmask_src (:,:) = .TRUE. 123 127 ENDIF 124 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- counting mask_src : ', 1I8)" ) rank, COUNT(lmask_src) 128 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Counting mask_src : ', 1I8)" ) rank, COUNT(lmask_src) 129 130 !< Read area on the source grid 131 ALLOCATE ( area_src (ni_src, nj_src) ) 132 IF ( l_use_area ) THEN 133 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Receive field area_src')" ) rank 134 CALL xios_recv_field ("area_src", area_src) 135 ELSE 136 area_src (:,:) = 1 137 ENDIF 138 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Sum area_src : ', 2E15.3)" ) rank, SUM(area_src) !, SUM(area_src, mask=lmask_src) 125 139 126 140 !< Read mask on the destination grid 127 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- lecturedomain_dst')" ) rank141 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Reading domain_dst')" ) rank 128 142 CALL xios_get_domain_attr ("domain_dst", ni=ni_dst, nj=nj_dst) 129 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- lecturedomain_dst ', 6I7)") rank, ni_dst, nj_dst143 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Reading domain_dst ', 6I7)") rank, ni_dst, nj_dst 130 144 ALLOCATE ( imask_dst (ni_dst, nj_dst), lmask_dst (ni_dst, nj_dst) ) 131 145 IF ( l_mask_dst ) THEN 132 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- receive field mask_dst')" ) rank146 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Receive field mask_dst')" ) rank 133 147 CALL xios_recv_field ("mask_dst", imask_dst) 134 148 lmask_dst = .FALSE. … … 139 153 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- counting mask_dst : ', 1I8)" ) rank, COUNT(lmask_dst) 140 154 141 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- fin interpol_read (1)')") rank 155 !< Read area on the destination grid 156 ALLOCATE ( area_dst (ni_dst, nj_dst) ) 157 IF ( l_use_area ) THEN 158 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- receive field area_dst')" ) rank 159 CALL xios_recv_field ("area_dst", area_dst) 160 ELSE 161 area_dst (:,:) = 1.0 162 ENDIF 163 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Counting mask_dst : ', 2E15.3)" ) rank, SUM(area_dst) !, SUM(area_dst,mask=lmask_dst) 164 165 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- End interpol_read (1)')") rank 142 166 CALL xios_context_finalize () 143 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- fininterpol_read (2)')") rank167 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- End interpol_read (2)')") rank 144 168 145 169 !< Context interpol run : generates weights, interpolate mask from source to destination 146 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- debutinterpol_run')" ) rank170 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Starting interpol_run')" ) rank 147 171 CALL xios_context_initialize ("interpol_run", comm) 148 172 CALL xios_get_handle ("interpol_run", ctx_hdl) 149 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- set context interpol_run')" ) rank173 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Set context interpol_run')" ) rank 150 174 CALL xios_set_current_context (ctx_hdl) 151 175 152 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- get attributes domain_src')" ) rank176 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Get attributes domain_src')" ) rank 153 177 IF ( l_mask_src ) CALL xios_set_domain_attr ("domain_src", mask_2d=lmask_src) 178 IF ( l_use_area ) CALL xios_set_domain_attr ("domain_src", area =area_src ) 179 !CALL xios_set_domain_attr ("domain_src", radius= 6371229.0 ) 154 180 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- get attributes domain_src')" ) rank 155 181 IF ( l_mask_dst ) CALL xios_set_domain_attr ("domain_dst", mask_2d=lmask_dst) 156 157 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- close context definition')" ) rank 182 IF ( l_use_area ) CALL xios_set_domain_attr ("domain_dst", area =area_dst ) 183 !CALL xios_set_domain_attr ("domain_dst", radius= 6371229.0 ) 184 185 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Close context definition')" ) rank 158 186 CALL xios_close_context_definition () 159 187 160 188 CALL xios_update_calendar (1) 161 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- send field mask_src')" ) rank189 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Send field mask_src')" ) rank 162 190 CALL xios_send_field ("mask_src", imask_src) 163 191 … … 166 194 167 195 DO jf = 1, 6 168 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- working on test case ', 1I2.2)" ) rank, jf196 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- Working on test case ', 1I2.2)" ) rank, jf 169 197 SELECT CASE ( jf) 170 198 CASE ( 1) ; field_src (:,:) = REAL ( imask_src, kind=rl) … … 181 209 !!< 182 210 183 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- fininterpol_run')" ) rank211 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- End interpol_run')" ) rank 184 212 CALL xios_context_finalize () 185 213 … … 193 221 CALL MPI_FINALIZE (ierr) 194 222 195 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- fini')" ) rank223 WRITE (UNIT=nout, FMT="('-- ', 1I4.4, ' -- The end')" ) rank 196 224 197 225 END PROGRAM interpol -
TOOLS/MOSAIX/update_xml.py
r3671 r4153 108 108 109 109 if FileOut == None : FileOut = FileIn 110 110 111 ## Remove white spaces at beginning and end of line 112 Node = Node.rstrip().lstrip() 113 111 114 ## Get XML tree from input file 112 115 iodef = xml.etree.ElementTree.parse ( FileIn )
Note: See TracChangeset
for help on using the changeset viewer.