Changeset 3718 for TOOLS/MOSAIX/CreateWeightsMask.bash
- Timestamp:
- 03/29/18 10:56:01 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/MOSAIX/CreateWeightsMask.bash
r3686 r3718 48 48 #OCE=ORCA025 49 49 50 ATM=ICO3050 #ATM=ICO30 51 51 #ATM=ICO40 52 52 #ATM=ICO450 53 #ATM=LMD969553 ATM=LMD9695 54 54 #ATM=LMD144X142 55 55 … … 180 180 ncks --alphabetize --history --append --variable OceMask dia_t${oce}_to_t${atm}_1storder_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc 181 181 182 ## 183 ## Create mask of coastal ATM point 184 ## =========================================================================== 185 cat <<EOF > coastal.nco 186 AtmCoastal = OceFrac * 0.0 ; 187 where (OceFrac > 0.0 && OceFrac < 1.0 ) AtmCoastal = 1.0 ; 188 EOF 189 ncap2 --history --overwrite --script-file coastal.nco ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_coastal_maskFrom_${OCE}.nc 190 ncks --history --append --variable AtmCoastal ${ATM}_coastal_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc 191 rm ${ATM}_coastal_maskFrom_${OCE}.nc 182 192 183 193 ## … … 255 265 256 266 ## 267 ## ATM towards NEMO points - runoff 268 ## =========================================================================== 269 cp ${SUBMIT_DIR}/iodef_atm_to_oce.xml iodef.xml 270 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} 271 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} 272 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}" 273 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} 274 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} 275 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} 276 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} 277 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 278 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t 1 279 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} 280 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 281 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_c${atm}_to_t${oce}_1storder 282 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_c${atm}_to_t${oce}_1storder.nc 283 284 cp iodef.xml iodef_c${atm}_to_t${oce}_1storder.xml 285 286 time /usr/bin/time ccc_mprun ./interpol.exe --mask_src=yes --mask_dst=yes 287 288 ## 257 289 ## Change all NetCDF files to NetCDF 3 format (needed for OASIS) 258 290 ## =========================================================================== 259 291 for InFile in *.nc ; do 260 if [[ $(ncdump -k ${InFile}) = *netCDF-4* ]] ; then 261 mv ${InFile} tmp_${InFile} 262 ncks --alphabetize --fl_fmt=${FL_FMT} --history tmp_${InFile} ${InFile} 263 fi 292 mv ${InFile} tmp_${InFile} 293 ncks --alphabetize --fl_fmt=${FL_FMT} --history tmp_${InFile} ${InFile} 264 294 done 265 295 … … 385 415 ## =========================================================================== 386 416 for OGRID in ${ListOCEGRID} ; do 387 for order in ${Listorder} ; do 388 ogrid=${OGRID~} 389 agrid=t 417 for AGRID in T C ; do 418 for order in ${Listorder} ; do 419 ogrid=${OGRID~} 420 agrid=${AGRID~} 390 421 391 file_o_to_a=rmp_${ogrid}${oce}_to_${agrid}${atm}_${order}order.nc392 file_a_to_o=rmp_${agrid}${atm}_to_${ogrid}${oce}_${order}order.nc393 394 cat <<EOF >add_varoce.nco422 file_o_to_a=rmp_${ogrid}${oce}_to_${agrid}${atm}_${order}order.nc 423 file_a_to_o=rmp_${agrid}${atm}_to_${ogrid}${oce}_${order}order.nc 424 425 cat <<EOF >add_varoce.nco 395 426 defdim ("src_grid_size" , \$x_grid_${OGRID}.size*\$y_grid_${OGRID}.size) ; 396 427 defdim ("src_grid_corners", 4) ; … … 417 448 EOF 418 449 419 ncap2 --history --append --script-file add_varoce.nco oce_grid.nc ${file_o_to_a}420 sed --in-place "s/src_/dst_/g" add_varoce.nco421 ncap2 --history --append --script-file add_varoce.nco oce_grid.nc ${file_a_to_o}422 423 if [[ ${atm} = ico ]] ; then424 450 [[ -f ${file_o_to_a} ]] && ncap2 --history --append --script-file add_varoce.nco oce_grid.nc ${file_o_to_a} 451 sed --in-place "s/src_/dst_/g" add_varoce.nco 452 [[ -f ${file_a_to_o} ]] && ncap2 --history --append --script-file add_varoce.nco oce_grid.nc ${file_a_to_o} 453 454 if [[ ${atm} = ico ]] ; then 455 cat <<EOF >add_varatm.nco 425 456 defdim ("dst_grid_size" , \$cell.size) ; 426 457 defdim ("dst_grid_corners", 6) ; … … 446 477 dst_grid_area (:) = aire(:) ; 447 478 EOF 448 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_o_to_a} 449 sed --in-place "s/dst_/src_/g" add_varatm.nco 450 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_a_to_o} 451 452 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_o_to_a} rmp_tmp.nc 453 mv rmp_tmp.nc ${file_o_to_a} 454 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_a_to_o} rmp_tmp.nc 455 mv rmp_tmp.nc ${file_a_to_o} 456 457 fi 458 if [[ ${atm} = lmd ]] ; then 459 cat <<EOF >add_varatm.nco 479 if [[ -f ${file_o_to_a} ]] ; then 480 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_o_to_a} 481 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_o_to_a} rmp_tmp.nc 482 mv rmp_tmp.nc ${file_o_to_a} 483 fi 484 485 sed --in-place "s/dst_/src_/g" add_varatm.nco 486 if [[ -f ${file_a_to_o} ]] ; then 487 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_a_to_o} 488 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_a_to_o} rmp_tmp.nc 489 mv rmp_tmp.nc ${file_a_to_o} 490 fi 491 fi 492 if [[ ${atm} = lmd ]] ; then 493 cat <<EOF >add_varatm.nco 460 494 defdim ("dst_grid_size" , \$lon.size*\$lat.size) ; 461 495 defdim ("dst_grid_corners", 4) ; … … 484 518 dst_grid_frac (:) = OceFrac(0,:,:) ; 485 519 EOF 486 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_o_to_a} 487 sed --in-place "s/dst/src/g" add_varatm.nco 488 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_a_to_o} 489 490 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_area,dst_grid_imask ${file_o_to_a} rmp_tmp.nc 491 mv rmp_tmp.nc ${file_o_to_a} 492 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_a_to_o} rmp_tmp.nc 493 mv rmp_tmp.nc ${file_a_to_o} 494 495 fi 520 if [[ -f ${file_o_to_a} ]] ; then 521 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_o_to_a} 522 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_area,dst_grid_imask ${file_o_to_a} rmp_tmp.nc 523 mv rmp_tmp.nc ${file_o_to_a} 524 fi 525 526 sed --in-place "s/dst/src/g" add_varatm.nco 527 if [[ -f ${file_a_to_o} ]] ; then 528 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_a_to_o} 529 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_a_to_o} rmp_tmp.nc 530 mv rmp_tmp.nc ${file_a_to_o} 531 fi 532 fi 533 done 496 534 done 497 535 done … … 501 539 ## =========================================================================== 502 540 cp ${ATM}_grid_maskFrom_${OCE}.nc ${SUBMIT_DIR} 541 542 cp rmp_c${atm}_to_t${oce}_${order}order.nc ${SUBMIT_DIR}/rmp_c${ATM}_to_t${OCE}_1storder.nc 543 cp dia_c${atm}_to_t${oce}_${order}order.nc ${SUBMIT_DIR}/dia_c${ATM}_to_t${OCE}_1storder.nc 544 503 545 for order in ${Listorder} 504 546 do 505 547 cp dia_t${oce}_to_t${atm}_${order}order.nc ${SUBMIT_DIR}/dia_t${OCE}_to_t${ATM}_${order}order.nc 506 548 cp rmp_t${oce}_to_t${atm}_${order}order.nc ${SUBMIT_DIR}/rmp_t${OCE}_to_t${ATM}_${order}order.nc 549 507 550 for grid in ${Listocegrid} ; do 508 551 cp rmp_t${atm}_to_${grid}${oce}_${order}order.nc ${SUBMIT_DIR}/rmp_t${ATM}_to_${grid}${OCE}_${order}order.nc
Note: See TracChangeset
for help on using the changeset viewer.