- Timestamp:
- 03/15/19 17:39:05 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/MOSAIX/CreateWeightsMask.bash
r4317 r4320 41 41 # CplModel=ORCA2.3xICO40 42 42 # CplModel=eORCA1.2xICO40 43 # CplModel=eORCA1.2xICO450 43 44 # CplModel=eORCA1.2xLMD256256 44 # CplModel=eORCA 1.2xICO45045 # CplModel=eORCA025.1xLMD144142 45 46 # CplModel=eORCA025.1xLMD256256 46 47 # … … 64 65 echo ${Titre}"Defines model"${Norm} 65 66 # ================================= 66 #CplModel=ORCA2.3xLMD969567 CplModel=ORCA2.3xLMD9695 67 68 #CplModel=ORCA2.3xICO30 68 69 #CplModel=ORCA2.3xICO40 69 CplModel=eORCA1.2xLMD14414270 #CplModel=eORCA1.2xLMD144142 70 71 #CplModel=eORCA1.2xLMD256256 71 72 #CplModel=eORCA1.2xICO40 … … 73 74 #CplModel=eORCA025.1xLMD256256 74 75 75 Version="v 3" ; Comment="Preliminary attempt - Do not trust !"76 Version="v0" ; Comment="Fully tested in IPSLCM6 eORCA1.2 x LMD 144x142" 76 77 77 78 # If available, get model name from job name … … 120 121 ## Classic cases for IPSLCM6 121 122 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 122 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, albedo123 OceAtmTemp2nd=" Direction=o2a,Order=2nd,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=TempIceAlb" # Temperature, sea-ice fraction, albedo124 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 point125 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 point126 AtmOceQuantity=" Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=t,oceGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=Quantity" # e.g. runoff123 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 124 OceAtmTemp2nd=" Direction=o2a,Order=2nd,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=TempIceAlb" # Temperature, sea-ice fraction, albedo 125 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 126 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 127 AtmOceQuantity=" Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=t,oceGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=Quantity" # e.g. runoff 127 128 # For new parameterization 128 129 AtmOceTemp=" Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=OceTemp" # e.g. T and S correction from DWL parametrization … … 148 149 #CommandList=( ${AtmOceFluxes} Runoff Calving Grids ) 149 150 #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ) 151 #CommandList=( ${AtmOceFluxes} ) 150 152 #CommandList=( Runoff ) 151 153 #CommandList=( Runoff Calving Grids ) … … 232 234 if [[ $(hostname) = lsce* ]] ; then arch=spip ; center=spip ; fi 233 235 234 PROGRAM=$(basename ${0})235 236 236 case ${arch} in 237 237 ( irene ) … … 241 241 TMPDIR=${CCCWORKDIR}/TMP 242 242 SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}} 243 PROGRAM=${BRIDGE_MSUB_REQNAME}244 243 MpiRun="time ccc_mprun" 245 244 PyRun="time ccc_mprun -n 1" # Needed to force python to run on one process only … … 319 318 setValues ${DefaultValues} 320 319 320 OutFileName=${srcGrid}${src}_to_${dstGrid}${dst}_${FullName} 321 321 322 cp iodef_oce_to_atm.xml iodef.xml 322 323 … … 331 332 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_src"]/field[@id="mask_source"]' -k name -v maskutil_T 332 333 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_src"]/field[@id="area_source"]' -k name -v area_grid_T 333 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${ srcGrid}${src}_to_${dstGrid}${dst}_${FullName}334 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${OutFileName} 334 335 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${SRC} mask interpolated to ${DST}" 335 336 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType} … … 338 339 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} 339 340 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 340 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${ srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.nc341 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${OutFileName}.nc 341 342 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 342 343 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t false … … 347 348 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v false 348 349 349 cp iodef.xml iodef_${ srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.xml350 cp iodef.xml iodef_${OutFileName}.xml 350 351 ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc 351 352 ln -fs ${ATM}_grid.nc atm_grid.nc 352 353 353 354 ${MpiRun} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} 355 356 ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" rmp_${OutFileName}.nc 357 ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" dia_${OutFileName}.nc 358 359 ncatted --history --attribute normalization,global,o,c,"false" rmp_${OutFileName}.nc 360 ncatted --history --attribute normalization,global,o,c,"false" dia_${OutFileName}.nc 361 362 ncatted --history --attribute Quantity,global,o,c,"false" rmp_${OutFileName}.nc 363 ncatted --history --attribute Quantity,global,o,c,"false" dia_${OutFileName}.nc 364 365 ncatted --history --attribute UseArea,global,o,c,"false" rmp_${OutFileName}.nc 366 ncatted --history --attribute UseArea,global,o,c,"false" dia_${OutFileName}.nc 354 367 355 368 ## … … 419 432 fi 420 433 421 ncks --history --alphabetize 434 ncks --history --alphabetize --append --variable aire atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc 422 435 ncatted --history --attribute units,aire,m,c,"m^2" ${ATM}_grid_maskFrom_${OCE}.nc 423 436 424 437 [[ ${atm} = *ico* ]] && ncks --alphabetize --history --append --variable bounds_lon,bounds_lat atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc 438 425 439 426 440 … … 481 495 ;; 482 496 esac 497 498 OutFileName=${srcGrid}${src}_to_${dstGrid}${dst}_${FullName} 483 499 484 500 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} … … 488 504 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} 489 505 490 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${ srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.nc506 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${OutFileName}.nc 491 507 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${numOrder} 492 508 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v ${Quantity} … … 494 510 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k use_area -v ${useArea} 495 511 496 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${ srcGrid}${src}_to_${dstGrid}${dst}_${FullName}512 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${OutFileName} 497 513 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${SRC} mask interpolated to ${DST}" 498 514 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType} … … 503 519 python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t ${useArea} 504 520 505 cp iodef.xml iodef_${ srcGrid}${src}_to_${dstGrid}${dst}_${FullName}.xml521 cp iodef.xml iodef_${OutFileName}.xml 506 522 ${MpiRun} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} 523 524 case ${numOrder} in 525 ( 1 ) 526 ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" rmp_${OutFileName}.nc 527 ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" dia_${OutFileName}.nc 528 ;; 529 ( 2 ) 530 ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 2nd order" rmp_${OutFileName}.nc 531 ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 2nd order" dia_${OutFileName}.nc 532 ;; 533 esac 534 535 ncatted --history --attribute normalization,global,o,c,"${Renormalize}" rmp_${OutFileName}.nc 536 ncatted --history --attribute normalization,global,o,c,"${Renormalize}" dia_${OutFileName}.nc 537 538 ncatted --history --attribute Quantity,global,o,c,"${Quantity}" rmp_${OutFileName}.nc 539 ncatted --history --attribute Quantity,global,o,c,"${Quantity}" dia_${OutFileName}.nc 540 541 ncatted --history --attribute UseArea,global,o,c,"${useArea}" rmp_${OutFileName}.nc 542 ncatted --history --attribute UseArea,global,o,c,"${useArea}" dia_${OutFileName}.nc 543 507 544 done 508 545 … … 529 566 --attribute description,global,o,c,"Fields needed by OASIS-MCT" \ 530 567 --attribute title,global,o,c,"${InFile}.nc" \ 531 --attribute Program,global,o,c,"Generated by ${PROGRAM}"\568 --attribute Program,global,o,c,"Generated by CreateWeightsMask" \ 532 569 --attribute timeStamp,global,o,c,"$(date)" \ 533 570 --attribute HOSTNAME,global,o,c,"$(hostname)" \ … … 545 582 ${InFile} 546 583 done 584 585 # Duplicate with no global attribute to avoid erasing attributes in other files 586 cp ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}_noglobal.nc 587 ncatted --history --attribute ,global,d,c, ${ATM}_grid_maskFrom_${OCE}_noglobal.nc 588 547 589 ## 548 590 echo ${Titre}"Update and complete weight files to fit OASIS requested format"${Norm} … … 561 603 ncrename --history --variable dst_idx,dst_address ${rmpFile} 562 604 ncrename --history --variable weight,remap_matrix ${rmpFile} 563 case ${rmpFile} in 564 ( *1storder* ) ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" ${rmpFile} ;; 565 ( *2ndorder* ) ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 2nd order" ${rmpFile} ;; 566 esac 567 case ${rmpFile} in 568 ( *_Normalized* ) ncatted --history --attribute map_method,global,o,c,"Normalization: true" ${rmpFile} ;; 569 ( *_UnNormalized* ) ncatted --history --attribute map_method,global,o,c,"Normalization: false" ${rmpFile} ;; 570 esac 571 case ${rmpFile} in 572 ( *Integrated* ) ncatted --history --attribute map_method,global,o,c,"Quantity: true" ${rmpFile} ;; 573 ( *Surfacic* ) ncatted --history --attribute map_method,global,o,c,"Quantity: false" ${rmpFile} ;; 574 esac 605 606 575 607 ncatted --history --attribute conventions,global,o,c,"SCRIP" ${rmpFile} 576 608 ncatted --history --attribute normalization,global,o,c,"none" ${rmpFile} … … 674 706 cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco 675 707 if [[ ${o_to_a} = true ]] ; then 676 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE} .nc ${rmpFile}708 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE}_noglobal.nc ${rmpFile} 677 709 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc 678 710 mv rmp_tmp.nc ${rmpFile} … … 682 714 cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco 683 715 if [[ ${a_to_o} = true ]] ; then 684 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} 716 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE}_noglobal.nc ${rmpFile} 717 exit 685 718 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc 686 719 mv rmp_tmp.nc ${rmpFile} … … 718 751 cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco 719 752 if [[ ${o_to_a} = true ]] ; then 720 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE} .nc ${rmpFile}753 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE}_noglobal.nc ${rmpFile} 721 754 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc 722 755 mv rmp_tmp.nc ${rmpFile} … … 726 759 cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco 727 760 if [[ ${a_to_o} = true ]] ; then 728 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE} .nc ${rmpFile}761 ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE}_noglobal.nc ${rmpFile} 729 762 ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${rmpFile} rmp_tmp.nc 730 763 mv rmp_tmp.nc ${rmpFile} … … 733 766 done 734 767 ls -al ${OCE}_coordinates_mask.nc 735 736 768 ## 737 769 ## ============================================================================ … … 882 914 883 915 for file in $(ls dia_*.nc rmp_*.nc ${ATM}_grid_maskFrom_${OCE}*.nc areas_${OCE}x${ATM}*.nc grids_${OCE}x${ATM}*.nc masks_${OCE}x${ATM}*.nc 2> /dev/null ) ; do 884 ncatted -- attribute uuid,global,o,c,"${UUID}" ${file}916 ncatted --history --attribute uuid,global,o,c,"${UUID}" ${file} 885 917 echo "$(shasum ${file})" >> README.txt 886 918 done
Note: See TracChangeset
for help on using the changeset viewer.