Changeset 4186 for TOOLS/MOSAIX/CreateWeightsMask.bash
- Timestamp:
- 12/12/18 11:26:20 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 ## ===========================================================================
Note: See TracChangeset
for help on using the changeset viewer.