[5158] | 1 | #!/bin/bash |
---|
[3719] | 2 | #MSUB -r WeightsMask # Job name |
---|
| 3 | #MSUB -o Out_WeightsMask # Standard output |
---|
| 4 | #MSUB -e Out_WeightsMask # Error output |
---|
[4402] | 5 | #MSUB -n 4 # Number of processors |
---|
[5925] | 6 | ##MSUB -T 7200 # Time limit (seconds) |
---|
| 7 | #MSUB -T 1800 |
---|
| 8 | #MSUB -Q test |
---|
[3966] | 9 | #MSUB -q skylake |
---|
| 10 | #MSUB -p gen2212 |
---|
[5158] | 11 | #MSUB -m work,store |
---|
[3620] | 12 | |
---|
| 13 | ### =========================================================================== |
---|
| 14 | ### |
---|
[3719] | 15 | ### Creates interpolation weights between ORCA and atmosphere grids. |
---|
[3620] | 16 | ### Interpolates ORCA mask to atmosphere grid. |
---|
| 17 | ### Weight files are at OASIS-MCT format. |
---|
| 18 | ### |
---|
| 19 | ### Atmosphere grid may be lon/lat LMDZ or DYNAMICO icosahedron |
---|
[3627] | 20 | ### |
---|
| 21 | ### Documentation : https://forge.ipsl.jussieu.fr/igcmg/wiki/IPSLCM6/MOSAIX |
---|
[3620] | 22 | ### =========================================================================== |
---|
| 23 | ## |
---|
| 24 | ## Warning, to install, configure, run, use any of Olivier Marti's |
---|
| 25 | ## software or to read the associated documentation you'll need at least |
---|
| 26 | ## one (1) brain in a reasonably working order. Lack of this implement |
---|
| 27 | ## will void any warranties (either express or implied). |
---|
| 28 | ## O. Marti assumes no responsability for errors, omissions, |
---|
| 29 | ## data loss, or any other consequences caused directly or indirectly by |
---|
| 30 | ## the usage of his software by incorrectly or partially configured |
---|
| 31 | ## personal. |
---|
| 32 | ## |
---|
[3623] | 33 | ## SVN information |
---|
[3665] | 34 | # $Author$ |
---|
| 35 | # $Date$ |
---|
| 36 | # $Revision$ |
---|
| 37 | # $Id$ |
---|
[3632] | 38 | # $HeadURL$ |
---|
[4090] | 39 | # |
---|
[4317] | 40 | # CplModel=eORCA1.2xLMD144142 ; qsub -r ${CplModel} -o Out_${CplModel} -e Out_${CplModel} CreateWeightsMask.bash |
---|
| 41 | # CplModel=ORCA2.3xLMD9695 |
---|
| 42 | # CplModel=ORCA2.3xICO30 |
---|
| 43 | # CplModel=ORCA2.3xICO40 |
---|
| 44 | # CplModel=eORCA1.2xICO40 |
---|
[4320] | 45 | # CplModel=eORCA1.2xICO450 |
---|
[4317] | 46 | # CplModel=eORCA1.2xLMD256256 |
---|
[4320] | 47 | # CplModel=eORCA025.1xLMD144142 |
---|
[4317] | 48 | # CplModel=eORCA025.1xLMD256256 |
---|
[4195] | 49 | # |
---|
| 50 | |
---|
[4172] | 51 | set +vx |
---|
[3901] | 52 | export Bold=$(tput bold) |
---|
| 53 | export Unde=$(tput smul) ; export OffUnde=$(tput rmul) |
---|
| 54 | export Stou=$(tput smso) ; export OffStou=$(tput rmso) |
---|
| 55 | export Reve=$(tput rev ) |
---|
| 56 | couleurs=( "Black" "Blue" "Green" "Cyan" "Red" "Magenta" "Yellow" "White" ) |
---|
[4259] | 57 | for i in $(seq 0 7) ; do eval "export ${couleurs[$i]}=$(tput setf ${i})" ; done |
---|
[4186] | 58 | export Norm=$(tput sgr0) |
---|
[4172] | 59 | export Titre=${Bold}${Blue} |
---|
[3620] | 60 | |
---|
| 61 | ## |
---|
| 62 | ## Configuration |
---|
| 63 | ## =========================================================================== |
---|
[4159] | 64 | set -e |
---|
[5158] | 65 | echo BASH Version ${BASH_VERSION} |
---|
| 66 | echo SHELL ${SHELL} |
---|
[3620] | 67 | |
---|
| 68 | # |
---|
[4317] | 69 | echo ${Titre}"Defines model"${Norm} |
---|
| 70 | # ================================= |
---|
[5925] | 71 | CplModel=ORCA2.3xLMD9695 |
---|
[4317] | 72 | #CplModel=ORCA2.3xICO30 |
---|
| 73 | #CplModel=ORCA2.3xICO40 |
---|
[5925] | 74 | #CplModel=eORCA1.2xLMD144142 |
---|
[4317] | 75 | #CplModel=eORCA1.2xLMD256256 |
---|
| 76 | #CplModel=eORCA1.2xICO40 |
---|
| 77 | #CplModel=eORCA1.2xICO450 |
---|
| 78 | #CplModel=eORCA025.1xLMD256256 |
---|
[3620] | 79 | |
---|
[4402] | 80 | #Version="v0" ; Comment="Fully tested in IPSLCM6 eORCA1.2 x LMD 144x142" |
---|
| 81 | Version="v1" ; Comment="Fully tested in IPSLCM6 eORCA1.2 x LMD 144x142" |
---|
[3620] | 82 | |
---|
[4317] | 83 | # If available, get model name from job name |
---|
[4195] | 84 | if [[ X${SLURM_JOB_NAME} = X*ORC* || X${SLURM_JOB_NAME} = X*LMD* || X${SLURM_JOB_NAME} = X*ICO* ]] ; then |
---|
[4317] | 85 | CplModel=${SLURM_JOB_NAME} ; |
---|
[4195] | 86 | fi |
---|
[4317] | 87 | OCE=${CplModel//x*} ; ATM=${CplModel##*x} |
---|
[4195] | 88 | |
---|
[4186] | 89 | echo ${Titre}"ATM model : ${ATM}"${Norm} |
---|
| 90 | echo ${Titre}"OCE model : ${OCE}"${Norm} |
---|
[4195] | 91 | echo ${Titre}"Cpl model : ${CplModel}"${Norm} |
---|
[5548] | 92 | echo ${Titre}"Version : ${Version}"${Norm} |
---|
[4172] | 93 | |
---|
[4186] | 94 | # Runoff parameter. atmCoastWidth and oceCoastWidth in grid points, searchRadius in km |
---|
[4402] | 95 | atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=550.0 |
---|
[4298] | 96 | runOff_atmQuantity=Quantity ; runOff_oceQuantity=Surfacic |
---|
[4172] | 97 | |
---|
[4402] | 98 | # Specific cases |
---|
[4298] | 99 | [[ ${ATM} = ICO* ]] && atmCoastWidth=0 # Parameter relevant for LMD rectilinear grid only |
---|
| 100 | [[ ${ATM} = LMD* ]] && atmCoastWidth=2 |
---|
[5548] | 101 | [[ ${OCE} = ORCA2.* ]] && oceCoastWidth=1 |
---|
| 102 | [[ ${OCE} = eORCA1.* ]] && oceCoastWidth=2 |
---|
[4298] | 103 | [[ ${OCE} = eORCA025* ]] && oceCoastWidth=1 |
---|
[4186] | 104 | |
---|
[4402] | 105 | # More specific cases |
---|
[5548] | 106 | [[ ${CplModel} = eORCA1.2xLMD144142 ]] && { atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=550.0 ; Version="v1" ; Comment="Fully tested in IPSLCM6 eORCA1.2 x LMD 144x142" ; } |
---|
[4402] | 107 | |
---|
[4153] | 108 | # Default values, used to create ocean fraction on atmospheric grid |
---|
[4186] | 109 | DefaultValues=( Direction=o2a,oceGrid=t,atmGrid=t,Order=1st,Quantity=false,Renormalize=false,useArea=false,maskSrc=true,maskDst=false,Name=OceFrac ) |
---|
[3620] | 110 | |
---|
[4172] | 111 | ## List of weights to build |
---|
| 112 | ## ==================================================================================================================================== |
---|
| 113 | # |
---|
| 114 | # Each item in CommandList describes the properties of interpolation weights to generate. |
---|
[4159] | 115 | # White spaces separate analysis. No spaces in any analysis. |
---|
| 116 | # |
---|
[4172] | 117 | # Specific commands : 'Runoff', 'Calving' |
---|
| 118 | # |
---|
[4159] | 119 | # Keywords : |
---|
[4298] | 120 | # Direction : o2a for ocean to atmosphere, a2o for atmosphere to ocean. |
---|
| 121 | # Order : 1st or 2nd. |
---|
[4159] | 122 | # Quantity : true if integrated quantity over a grid box, false for flux (quantity / m^2) |
---|
[4298] | 123 | # or intensive value (temperature, salinity, sea-ice fraction, ...). |
---|
| 124 | # Renormalize : used when source grid is masked, to use values on non masked points only. |
---|
| 125 | # oceGrid : t, u or v point for NEMO C grid. |
---|
| 126 | # atmGrid : up to know, only t grid used in the atmosphere. |
---|
| 127 | # useArea : if true area from the model metrics is used. If false, areas are computed by XIOS from grid corners. |
---|
| 128 | # maskSrc : true to use the source grid mask, false to used all grid points. |
---|
| 129 | # maskDst : true to use the destination grid mask, false to use all grid points. |
---|
[4159] | 130 | # |
---|
[4259] | 131 | ## Classic cases for IPSLCM6 |
---|
| 132 | 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 |
---|
[4320] | 133 | 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 |
---|
| 134 | 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 |
---|
| 135 | 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 |
---|
| 136 | 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 |
---|
| 137 | AtmOceQuantity=" Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=t,oceGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=Quantity" # e.g. runoff |
---|
[4298] | 138 | # For new parameterization |
---|
| 139 | 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 |
---|
[4259] | 140 | 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 |
---|
[4298] | 141 | # Test to do with 2nd order |
---|
| 142 | AtmOceFluxes2nd="Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=HeatWaterFluxes" # Heat and water fluxes |
---|
[4259] | 143 | OceAtmFluxes2nd="Direction=o2a,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=OceAtmFluxes" # e.g. CO2 fluxes |
---|
[4317] | 144 | AtmOceTemp2nd=" Direction=o2a,Order=2nd,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 |
---|
[4159] | 145 | |
---|
[4259] | 146 | ## Creates the list |
---|
| 147 | |
---|
[4186] | 148 | # Standard list for IPSLCM6 |
---|
| 149 | #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} Runoff Calving Grids ) |
---|
[4172] | 150 | |
---|
[4259] | 151 | # More comprehensive list for IPSLCM6 with new features |
---|
[4317] | 152 | #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${AtmOceTemp} Runoff Calving Grids ) |
---|
[4172] | 153 | |
---|
[4259] | 154 | # With 2nd order |
---|
[4317] | 155 | CommandList=( ${AtmOceFluxes} ${AtmOceFluxes2nd} ${OceAtmTemp} ${OceAtmTemp2nd} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${OceAtmFluxes2nd} ${AtmOceTemp} ${AtmOceTemp2nd} Runoff Calving Grids ) |
---|
[4259] | 156 | |
---|
[4186] | 157 | # Debugs |
---|
| 158 | #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} Runoff Calving Grids ) |
---|
[4199] | 159 | #CommandList=( ${AtmOceFluxes} Runoff Calving Grids ) |
---|
[4317] | 160 | #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ) |
---|
[4320] | 161 | #CommandList=( ${AtmOceFluxes} ) |
---|
[4259] | 162 | #CommandList=( Runoff ) |
---|
| 163 | #CommandList=( Runoff Calving Grids ) |
---|
[4186] | 164 | #CommandList=( Calving ) |
---|
| 165 | #CommandList=( Grids ) |
---|
[4172] | 166 | |
---|
[4402] | 167 | if [[ ${Version} = test_runoff_* ]] ; then |
---|
| 168 | CommandList=( Runoff ) |
---|
| 169 | fi |
---|
| 170 | |
---|
[3620] | 171 | ## =========================================================================== |
---|
| 172 | ## |
---|
| 173 | ## You should not change anything below this line .... |
---|
| 174 | ## |
---|
| 175 | ## =========================================================================== |
---|
[4199] | 176 | Tag="MOSAIX" |
---|
[3620] | 177 | SUBMIT_DIR=$(pwd) |
---|
[4259] | 178 | FMT_XIOS=netcdf4 |
---|
[4159] | 179 | |
---|
| 180 | # Functions to handle command parameters |
---|
| 181 | # ====================================== |
---|
[4153] | 182 | function read_Command { |
---|
| 183 | # Decipher the command line to set bash variables |
---|
| 184 | local l_Debug="no" l_Element |
---|
| 185 | while [[ ${1} = -* ]] ; do |
---|
| 186 | case ${1} in |
---|
| 187 | ( -- ) shift ; break ;; |
---|
| 188 | ( -d | --debug ) l_Debug="true" ; shift ;; |
---|
| 189 | esac |
---|
| 190 | done |
---|
| 191 | local l_Command=${1} |
---|
[4159] | 192 | for l_Element in $(echo ${l_Command} | tr "," "\n" ) ; do |
---|
[4153] | 193 | [[ "X${l_Debug}" = "Xtrue" ]] && echo ${l_Element} |
---|
| 194 | eval export ${l_Element} |
---|
| 195 | done |
---|
| 196 | } |
---|
[3620] | 197 | |
---|
[4153] | 198 | function setValues { |
---|
[4317] | 199 | # Set default values |
---|
[4186] | 200 | read_Command "Direction=None,Order=None,Quantity=None,Renormalize=None,atmGrid=None,oceGrid=None,useArea=None,maskSrc=None,maskDst=None" |
---|
[4317] | 201 | # Read command line |
---|
[4186] | 202 | read_Command ${1} |
---|
| 203 | # |
---|
[4317] | 204 | oceGrid=${oceGrid,,} ; atmGrid=${atmGrid,,} # Model names to lower case |
---|
| 205 | OCEGRID=${oceGrid^^} ; ATMGRID=${atmGrid^^} # Model names to upper case |
---|
[4153] | 206 | |
---|
| 207 | case ${Order} in |
---|
| 208 | ( 1st ) numOrder=1 ;; |
---|
| 209 | ( 2nd ) numOrder=2 ;; |
---|
| 210 | esac |
---|
| 211 | case ${Renormalize} in |
---|
| 212 | ( true ) NormName=Normalized ;; |
---|
| 213 | ( false ) NormName=UnNormalized ;; |
---|
| 214 | esac |
---|
| 215 | case ${Quantity} in |
---|
| 216 | ( true ) QuantName=Integrated ;; |
---|
| 217 | ( false ) QuantName=Surfacic ;; |
---|
| 218 | esac |
---|
| 219 | case ${useArea} in |
---|
| 220 | ( true ) AreaName=Area ;; |
---|
| 221 | ( false ) AreaName=NoArea ;; |
---|
| 222 | esac |
---|
| 223 | |
---|
[4186] | 224 | if [[ "${Name}" != "None" ]] ; then |
---|
[4259] | 225 | FullName=${Name}_${Order}Order |
---|
[4186] | 226 | else |
---|
[4199] | 227 | FullName=${Order}Order_${NormName}_${QuantName}_${AreaName} |
---|
[4186] | 228 | fi |
---|
| 229 | |
---|
[4153] | 230 | case ${Direction} in |
---|
| 231 | ( o2a ) |
---|
[4159] | 232 | src=${oce} ; SRC=${OCE} ; srcGrid=${oceGrid} ; srcDomainType=${oceDomainType} ; SRCGRID=${OCEGRID} ; srcArea=area_grid_${OCEGRID} |
---|
| 233 | dst=${atm} ; DST=${ATM} ; dstGrid=${atmGrid} ; dstDomainType=${atmDomainType} ; DSTGRID=${ATMGRID} ; dstArea=aire |
---|
[4153] | 234 | ;; |
---|
| 235 | ( a2o ) |
---|
[4159] | 236 | src=${atm} ; SRC=${ATM} ; srcGrid=${atmGrid} ; srcDomainType=${atmDomainType} ; SRCGRID=${ATMGRID} ; srcArea=aire |
---|
| 237 | dst=${oce} ; DST=${OCE} ; dstGrid=${oceGrid} ; dstDomainType=${oceDomainType} ; DSTGRID=${OCEGRID} ; dstArea=area_grid_${OCEGRID} |
---|
[4153] | 238 | ;; |
---|
| 239 | esac |
---|
[4186] | 240 | echo ${Green}"${SRC} ${SRCGRID} toward ${DST} ${DSTGRID} - ${Order} Order - Normalize: ${Renormalize} - Quantity: ${QuantName} - Area: ${AreaName} "${Norm} |
---|
[4199] | 241 | echo ${Green}"FullName : ${FullName}"${Norm} |
---|
[4153] | 242 | } |
---|
[4186] | 243 | |
---|
[3620] | 244 | # |
---|
[5925] | 245 | #Defines computer |
---|
[3620] | 246 | # ================ |
---|
[3901] | 247 | if [[ $(hostname) = irene* ]] ; then arch=irene ; center=tgcc ; fi |
---|
[4153] | 248 | if [[ $(hostname) = lsce* ]] ; then arch=spip ; center=spip ; fi |
---|
[3734] | 249 | |
---|
[3620] | 250 | case ${arch} in |
---|
[4153] | 251 | ( irene ) |
---|
[3620] | 252 | set +vx |
---|
[4259] | 253 | set +e |
---|
[3966] | 254 | R_IN=$(ccc_home -u igcmg --cccwork)/IGCM |
---|
| 255 | TMPDIR=${CCCWORKDIR}/TMP |
---|
| 256 | SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}} |
---|
[4172] | 257 | MpiRun="time ccc_mprun" |
---|
[4195] | 258 | PyRun="time ccc_mprun -n 1" # Needed to force python to run on one process only |
---|
[4259] | 259 | #module purge |
---|
| 260 | source $(ccc_home -u igcmg)/MachineEnvironment/irene/env_irene |
---|
[4153] | 261 | source ${SUBMIT_DIR}/arch.env |
---|
[4259] | 262 | #module load nco |
---|
[4172] | 263 | module load python3 |
---|
[4153] | 264 | module load datadir/igcmg |
---|
[3966] | 265 | module list |
---|
[4259] | 266 | set -e |
---|
[3966] | 267 | ;; |
---|
[3734] | 268 | ( spip ) |
---|
| 269 | R_IN=${HOME}/Scratch/IGCM |
---|
| 270 | TMPDIR=${HOME}/Scratch/TMP |
---|
| 271 | SUBMIT_DIR=$(pwd) |
---|
[4172] | 272 | MpiRun="/opt/local/bin/mpirun -n 4" |
---|
| 273 | PyRun="time" |
---|
[3734] | 274 | ;; |
---|
[3901] | 275 | ( * ) exit -1 ;; |
---|
[3620] | 276 | esac |
---|
| 277 | |
---|
| 278 | set -x ; set -e |
---|
| 279 | |
---|
[4195] | 280 | mkdir -p ${TMPDIR}/${CplModel} || exit 1 |
---|
| 281 | cd ${TMPDIR}/${CplModel} || exit 1 |
---|
[4146] | 282 | rm -fr * |
---|
[3620] | 283 | |
---|
| 284 | # |
---|
| 285 | # Suffixes |
---|
| 286 | # --------------------------------------------------------------------------- |
---|
| 287 | |
---|
| 288 | case ${OCE} in |
---|
[4153] | 289 | ( *ORC* ) oce=orc ; oceDomainType=curvilinear ;; |
---|
[3620] | 290 | esac |
---|
[4159] | 291 | |
---|
[3620] | 292 | case ${ATM} in |
---|
[4153] | 293 | ( *dynamico* ) atm=ico ; atmDomainType=unstructured ;; |
---|
| 294 | ( *ICO* ) atm=ico ; atmDomainType=unstructured ;; |
---|
| 295 | ( *lmd* | *LMD* ) atm=lmd ; atmDomainType=rectilinear ;; |
---|
[3620] | 296 | esac |
---|
| 297 | |
---|
[4159] | 298 | case ${OCE} in # Periodicity type of ORCA grid |
---|
[5925] | 299 | ( ORCA2* ) OcePerio=6 ;; # 4 ORCA 6 PALEORCA |
---|
[4172] | 300 | ( ORCA1* | eORCA1* ) OcePerio=6 ;; |
---|
[4298] | 301 | ( ORCA025* | eORCA025* ) OcePerio=6 ;; |
---|
[3723] | 302 | esac |
---|
[3620] | 303 | # |
---|
| 304 | |
---|
[4195] | 305 | cp ${SUBMIT_DIR}/bin/interpol.exe . |
---|
| 306 | cp ${SUBMIT_DIR}/*.py . |
---|
[4153] | 307 | cp ${SUBMIT_DIR}/iodef_atm_to_oce.xml . |
---|
| 308 | cp ${SUBMIT_DIR}/iodef_oce_to_atm.xml . |
---|
[3620] | 309 | |
---|
[5925] | 310 | #cp ${R_IN}/OCE/NEMO/${OCE}/${OCE}_coordinates_mask.nc . |
---|
| 311 | #cp ${SUBMIT_DIR}/${OCE}_coordinates_mask_ref.nc ${OCE}_coordinates_mask.nc |
---|
| 312 | #cp ${SUBMIT_DIR}/eORCA_R1_coordinates_mask_test_1105.nc ${OCE}_coordinates_mask.nc |
---|
| 313 | #cp ${SUBMIT_DIR}/TEST2REMOVE_coordinates_mask.test.nc ${OCE}_coordinates_mask.nc |
---|
| 314 | #cp ${SUBMIT_DIR}/TEST-CM61-LR-pi-01_mesh_mask.nc ${OCE}_coordinates_mask.nc |
---|
| 315 | #cp ${SUBMIT_DIR}/eORCA_R1_coordinates_mask_test_TUVW.nc ${OCE}_coordinates_mask.nc |
---|
| 316 | #cp ${SUBMIT_DIR}/eORCA_R1_coordinates_mask_test_1106.nc ${OCE}_coordinates_mask.nc |
---|
| 317 | #cp ${SUBMIT_DIR}/ORCA2.3_coordinates_mask_test_1106.nc ${OCE}_coordinates_mask.nc |
---|
| 318 | #cp ${SUBMIT_DIR}/coordinates_xios_ORCA2_1p_2806.nc ${OCE}_coordinates_mask.nc |
---|
| 319 | cp ${SUBMIT_DIR}/ORCA2.3_coordinates_mask_ref_0208.nc ${OCE}_coordinates_mask.nc |
---|
[3639] | 320 | cp ${R_IN}/ATM/GRID/${ATM}_grid.nc . |
---|
[3620] | 321 | |
---|
[4317] | 322 | # Soucis a corriger plus tard |
---|
| 323 | if [[ ${ATM} = LMD9695 ]] ; then |
---|
| 324 | cat <<EOF > toDouble.nco |
---|
| 325 | lat = double (lat) ; |
---|
| 326 | lon = double (lon) ; |
---|
| 327 | aire = double (aire) ; |
---|
| 328 | fract_oce = double (fract_oce) ; |
---|
| 329 | fract_sic = double (fract_sic) ; |
---|
| 330 | fract_oce_plus_sic = double (fract_oce_plus_sic) ; |
---|
| 331 | EOF |
---|
| 332 | ncap2 --history --overwrite --script-file toDouble.nco ${ATM}_grid.nc tmp_${ATM}_grid.nc |
---|
| 333 | mv tmp_${ATM}_grid.nc ${ATM}_grid.nc |
---|
| 334 | fi |
---|
[3620] | 335 | |
---|
[3912] | 336 | |
---|
[3901] | 337 | ## |
---|
[4172] | 338 | echo ${Titre}"NEMO T point towards ATM - 1st order"${Norm} |
---|
[3901] | 339 | ## =========================================================================== |
---|
[4153] | 340 | echo "Command parameters : ${Command}" |
---|
[4186] | 341 | setValues ${DefaultValues} |
---|
[3620] | 342 | |
---|
[4320] | 343 | OutFileName=${srcGrid}${src}_to_${dstGrid}${dst}_${FullName} |
---|
| 344 | |
---|
[4153] | 345 | cp iodef_oce_to_atm.xml iodef.xml |
---|
| 346 | |
---|
[4172] | 347 | python3 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 |
---|
| 348 | python3 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 |
---|
| 349 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} |
---|
| 350 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} |
---|
| 351 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 |
---|
| 352 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v false |
---|
| 353 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false |
---|
| 354 | 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 |
---|
| 355 | 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 |
---|
| 356 | 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 |
---|
[4320] | 357 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${OutFileName} |
---|
[4172] | 358 | 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}" |
---|
| 359 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType} |
---|
| 360 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType} |
---|
| 361 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t 1 |
---|
| 362 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} |
---|
| 363 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} |
---|
[4320] | 364 | 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 |
---|
[4172] | 365 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 |
---|
| 366 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t false |
---|
| 367 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t false |
---|
| 368 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t false |
---|
| 369 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false |
---|
| 370 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v false |
---|
| 371 | 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 |
---|
[3620] | 372 | |
---|
[4320] | 373 | cp iodef.xml iodef_${OutFileName}.xml |
---|
[3901] | 374 | ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc |
---|
| 375 | ln -fs ${ATM}_grid.nc atm_grid.nc |
---|
[3620] | 376 | |
---|
[4172] | 377 | ${MpiRun} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} |
---|
| 378 | |
---|
[4320] | 379 | ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" rmp_${OutFileName}.nc |
---|
| 380 | ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" dia_${OutFileName}.nc |
---|
| 381 | |
---|
| 382 | ncatted --history --attribute normalization,global,o,c,"false" rmp_${OutFileName}.nc |
---|
| 383 | ncatted --history --attribute normalization,global,o,c,"false" dia_${OutFileName}.nc |
---|
| 384 | |
---|
| 385 | ncatted --history --attribute Quantity,global,o,c,"false" rmp_${OutFileName}.nc |
---|
| 386 | ncatted --history --attribute Quantity,global,o,c,"false" dia_${OutFileName}.nc |
---|
| 387 | |
---|
| 388 | ncatted --history --attribute UseArea,global,o,c,"false" rmp_${OutFileName}.nc |
---|
| 389 | ncatted --history --attribute UseArea,global,o,c,"false" dia_${OutFileName}.nc |
---|
| 390 | |
---|
[3620] | 391 | ## |
---|
[4172] | 392 | echo ${Titre}"Correct spurious values (extremes)"${Norm} |
---|
[3620] | 393 | ## =========================================================================== |
---|
| 394 | cat <<EOF > correction_masque.nco |
---|
| 395 | where (OceFrac < 0.00001 ) OceFrac=OceFrac.get_miss() ; |
---|
| 396 | where (OceFrac > 0.99999 ) OceFrac=1.0 ; |
---|
| 397 | OceFrac.delete_miss() ; |
---|
| 398 | // Fill masked values to land values |
---|
| 399 | where (OceFrac > 1.0 ) OceFrac=0.0 ; |
---|
| 400 | where (OceFrac < 0.0 ) OceFrac=0.0 ; |
---|
[4298] | 401 | OceMask = OceFrac ; |
---|
[3620] | 402 | EOF |
---|
[4199] | 403 | ncap2 --history --overwrite --script-file correction_masque.nco dia_t${oce}_to_t${atm}_${FullName}.nc tmp_dia_t${oce}_to_t${atm}_${FullName}.nc ; mv tmp_dia_t${oce}_to_t${atm}_${FullName}.nc dia_t${oce}_to_t${atm}_${FullName}.nc |
---|
| 404 | ncatted --history -a missing_value,OceFrac,d,,"" -a _FillValue,OceFrac,d,,"" dia_t${oce}_to_t${atm}_${FullName}.nc |
---|
[4298] | 405 | ncatted --history -a missing_value,OceMask,d,,"" -a _FillValue,OceMask,d,,"" dia_t${oce}_to_t${atm}_${FullName}.nc |
---|
| 406 | |
---|
[3620] | 407 | ## |
---|
[4298] | 408 | echo ${Titre}"Creates mask on ATM grid"${Norm} |
---|
[3620] | 409 | ## =========================================================================== |
---|
[4199] | 410 | cp dia_t${oce}_to_t${atm}_${FullName}.nc dia_t${oce}_to_t${atm}_${FullName}_mask.nc |
---|
[4298] | 411 | ncks --alphabetize --history --overwrite --variable OceFrac dia_t${oce}_to_t${atm}_${FullName}_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4317] | 412 | ncatted --history --attribute name,global,m,c,"${ATM}_grid_maskFrom_${OCE}.nc" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[3620] | 413 | |
---|
| 414 | cat <<EOF > creation_masque.nco |
---|
[4298] | 415 | Oce2AtmMask = OceMask ; |
---|
| 416 | where (OceMask > 0.0 ) Oce2AtmMask=1 ; |
---|
| 417 | where (OceMask <= 0.0 ) Oce2AtmMask=0 ; |
---|
[3620] | 418 | EOF |
---|
[4081] | 419 | |
---|
[4298] | 420 | ncap2 --history --overwrite --script-file creation_masque.nco dia_t${oce}_to_t${atm}_${FullName}.nc tmp_dia_${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 421 | ncks --overwrite --history --variable OceMask,OceFrac,Oce2AtmMask tmp_dia_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[3620] | 422 | |
---|
[4081] | 423 | if [[ $(ncdump -h ${ATM}_grid_maskFrom_${OCE}.nc | grep domain_dst | wc -l) -gt 0 ]] ; then |
---|
[4317] | 424 | echo "Change dimension names, and some attributes accordingly" |
---|
| 425 | ## =========================================================== |
---|
[4081] | 426 | case ${atm} in |
---|
| 427 | ( *ico* ) |
---|
[4088] | 428 | ncrename --history --dimension cell_domain_dst,cell ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 429 | ncrename --history --dimension nvertex_domain_dst,nvertex ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 430 | ncrename --history --variable lat_domain_dst,lat ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 431 | ncrename --history --variable lon_domain_dst,lon ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 432 | ncrename --history --variable bounds_lat_domain_dst,bounds_lat ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 433 | ncrename --history --variable bounds_lon_domain_dst,bounds_lon ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 434 | ncatted --history --attribute bounds,lat,m,c,"bounds_lat" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 435 | ncatted --history --attribute bounds,lon,m,c,"bounds_lon" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4081] | 436 | ;; |
---|
[4317] | 437 | ( *lmd* ) |
---|
[5158] | 438 | ncrename --history --variable lon_domain_dst,lon ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4317] | 439 | ncrename --history --variable lat_domain_dst,lat ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 440 | ncrename --history --dimension lon_domain_dst,lon ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 441 | ncrename --history --dimension lat_domain_dst,lat ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4081] | 442 | ;; |
---|
| 443 | esac |
---|
| 444 | ncatted --history --attribute coordinates,OceFrac,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 445 | ncatted --history --attribute coordinates,OceMask,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4298] | 446 | ncatted --history --attribute coordinates,Oce2AtmMask,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4317] | 447 | |
---|
| 448 | ncatted --history --attribute long_name,OceFrac,c,c,"fraction of ocean in a grid cell" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 449 | ncatted --history --attribute units,OceFrac,c,c,"[0,1]" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 450 | ncatted --history --attribute long_name,OceMask,c,c,"fraction of ocean in a grid cell" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 451 | ncatted --history --attribute units,OceMask,c,c,"[0,1]" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 452 | ncatted --history --attribute long_name,Oce2AtmMask,c,c,"land mask" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 453 | ncatted --history --attribute units,Oce2AtmMask,c,c,"Land:0, Ocean:1" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4088] | 454 | |
---|
[4081] | 455 | fi |
---|
| 456 | |
---|
[4320] | 457 | ncks --history --alphabetize --append --variable aire atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[4317] | 458 | ncatted --history --attribute units,aire,m,c,"m^2" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 459 | |
---|
[4081] | 460 | [[ ${atm} = *ico* ]] && ncks --alphabetize --history --append --variable bounds_lon,bounds_lat atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 461 | |
---|
[4298] | 462 | |
---|
[4320] | 463 | |
---|
[4298] | 464 | ## |
---|
[4199] | 465 | #echo ${Titre}"Creates mask of coastal OCE points"${Norm} |
---|
[3901] | 466 | ## =========================================================================== |
---|
[4199] | 467 | #${PyRun} python3 -u ComputeNemoCoast.py -n ${OcePerio} -i ${OCE}_coordinates_mask.nc # Creates OceCoastal |
---|
[4172] | 468 | |
---|
[3901] | 469 | ## |
---|
[4199] | 470 | #echo ${Titre}"Creates mask of coastal ATM points"${Norm} |
---|
[3901] | 471 | ## =========================================================================== |
---|
[4199] | 472 | #cat <<EOF > coastal.nco |
---|
| 473 | #AtmCoastal = OceFrac * 0.0 ; |
---|
| 474 | #where (OceFrac > 0.0 && OceFrac < 1.0 ) AtmCoastal = 1.0 ; |
---|
| 475 | #EOF |
---|
| 476 | #ncap2 --history --overwrite --script-file coastal.nco ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_coastal_maskFrom_${OCE}.nc |
---|
| 477 | #ncks --history --append --variable AtmCoastal ${ATM}_coastal_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 478 | #rm ${ATM}_coastal_maskFrom_${OCE}.nc |
---|
[4081] | 479 | |
---|
[3901] | 480 | ## |
---|
[4172] | 481 | echo ${Titre}"Other weights files"${Norm} |
---|
[3718] | 482 | ## =========================================================================== |
---|
[4153] | 483 | # Loop on commands |
---|
| 484 | for Command in ${CommandList[@]} |
---|
| 485 | do |
---|
| 486 | echo "Command parameters : ${Command}" |
---|
[4186] | 487 | setValues ${Command} |
---|
[4172] | 488 | if [[ ${Command} = "Runoff" ]] ; then okRunoff=yes ; continue ; fi |
---|
| 489 | if [[ ${Command} = "Calving" ]] ; then okCalving=yes ; continue ; fi |
---|
[4186] | 490 | if [[ ${Command} = "Grids" ]] ; then okGrids=yes ; continue ; fi |
---|
[4172] | 491 | |
---|
[4153] | 492 | ln -fs ${OCE}_coordinates_mask.nc oce_grid.nc |
---|
[4298] | 493 | #ln -fs ${ATM}_grid.nc atm_grid.nc |
---|
| 494 | ln -fs ${ATM}_grid_maskFrom_${OCE}.nc atm_grid.nc |
---|
[4153] | 495 | |
---|
| 496 | case ${Direction} in |
---|
| 497 | ( o2a ) |
---|
| 498 | cp iodef_oce_to_atm.xml iodef.xml |
---|
[4082] | 499 | |
---|
[4317] | 500 | python3 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_${DSTGRID} |
---|
[4298] | 501 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_dst"]/field[@id="mask_dst"]' -k name -v Oce2AtmMask |
---|
[4082] | 502 | |
---|
[4172] | 503 | 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_${SRCGRID} |
---|
| 504 | 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_${SRCGRID} |
---|
[4298] | 505 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="file_dst"]/field[@id="mask_dest"]' -k name -v Oce2AtmMask |
---|
[4172] | 506 | python3 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 |
---|
[4153] | 507 | ;; |
---|
| 508 | ( a2o ) |
---|
| 509 | cp iodef_atm_to_oce.xml iodef.xml |
---|
[4082] | 510 | |
---|
[4298] | 511 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="mask_src"]' -k name -v Oce2AtmMask |
---|
[4172] | 512 | python3 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} |
---|
[4082] | 513 | |
---|
[4298] | 514 | 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 Oce2AtmMask |
---|
[4172] | 515 | 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 aire |
---|
| 516 | python3 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} |
---|
| 517 | python3 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} |
---|
[4153] | 518 | ;; |
---|
| 519 | esac |
---|
[4320] | 520 | |
---|
| 521 | OutFileName=${srcGrid}${src}_to_${dstGrid}${dst}_${FullName} |
---|
[4153] | 522 | |
---|
[4172] | 523 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} |
---|
| 524 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} |
---|
[4153] | 525 | |
---|
[4172] | 526 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${srcDomainType} |
---|
| 527 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${dstDomainType} |
---|
[4153] | 528 | |
---|
[4320] | 529 | 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 |
---|
[4172] | 530 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${numOrder} |
---|
| 531 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k quantity -v ${Quantity} |
---|
| 532 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${Renormalize} |
---|
| 533 | 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} |
---|
[4153] | 534 | |
---|
[4320] | 535 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${OutFileName} |
---|
[4172] | 536 | 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}" |
---|
| 537 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${dstDomainType} |
---|
| 538 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${srcDomainType} |
---|
| 539 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${Renormalize} |
---|
| 540 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${numOrder} |
---|
| 541 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="quantity"]' -t ${Quantity} |
---|
| 542 | python3 update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="use_area"]' -t ${useArea} |
---|
[4153] | 543 | |
---|
[4320] | 544 | cp iodef.xml iodef_${OutFileName}.xml |
---|
[4172] | 545 | ${MpiRun} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} |
---|
[4320] | 546 | |
---|
| 547 | case ${numOrder} in |
---|
| 548 | ( 1 ) |
---|
| 549 | ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" rmp_${OutFileName}.nc |
---|
| 550 | ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" dia_${OutFileName}.nc |
---|
| 551 | ;; |
---|
| 552 | ( 2 ) |
---|
| 553 | ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 2nd order" rmp_${OutFileName}.nc |
---|
| 554 | ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 2nd order" dia_${OutFileName}.nc |
---|
| 555 | ;; |
---|
| 556 | esac |
---|
| 557 | |
---|
| 558 | ncatted --history --attribute normalization,global,o,c,"${Renormalize}" rmp_${OutFileName}.nc |
---|
| 559 | ncatted --history --attribute normalization,global,o,c,"${Renormalize}" dia_${OutFileName}.nc |
---|
| 560 | |
---|
| 561 | ncatted --history --attribute Quantity,global,o,c,"${Quantity}" rmp_${OutFileName}.nc |
---|
| 562 | ncatted --history --attribute Quantity,global,o,c,"${Quantity}" dia_${OutFileName}.nc |
---|
| 563 | |
---|
| 564 | ncatted --history --attribute UseArea,global,o,c,"${useArea}" rmp_${OutFileName}.nc |
---|
| 565 | ncatted --history --attribute UseArea,global,o,c,"${useArea}" dia_${OutFileName}.nc |
---|
| 566 | |
---|
[3719] | 567 | done |
---|
[4153] | 568 | |
---|
[3620] | 569 | ## |
---|
[4172] | 570 | echo ${Titre}"Add some metadata in file headers"${Norm} |
---|
[3620] | 571 | ## =========================================================================== |
---|
| 572 | |
---|
| 573 | NCO="$(ncks --version |& tail -1|sed 's/ncks //')" |
---|
[4172] | 574 | PYTHON_VER=$( python3 -c "import sys ; print (sys.version.split(' ')[0])" ) |
---|
[4199] | 575 | for InFile in $(ls *${oce}_to_*${atm}_*.nc *${atm}_to_*${oce}_*.nc ${ATM}_grid_maskFrom_${OCE}.nc 2> /dev/null) ; do |
---|
[3639] | 576 | ncatted --history \ |
---|
[3620] | 577 | --attribute LongName,global,d,, \ |
---|
| 578 | --attribute nco_openmp_thread_number,global,d,, \ |
---|
| 579 | --attribute Conventions,global,o,c,"CF-1.6" \ |
---|
| 580 | --attribute source,global,o,c,"IPSL Earth system model" \ |
---|
| 581 | --attribute group,global,o,c,"ICMC IPSL Climate Modelling Center" \ |
---|
| 582 | --attribute Institution,global,o,c,"IPSL https://www.ipsl.fr" \ |
---|
| 583 | --attribute Ocean,global,o,c,"${OCE} https://www.nemo-ocean.eu" \ |
---|
| 584 | --attribute Atmosphere,global,o,c,"${ATM} http://lmdz.lmd.jussieu.fr" \ |
---|
| 585 | --attribute production,global,o,c,"$(finger ${LOGNAME} | head -1 | awk '{print $4, $5}') " \ |
---|
| 586 | --attribute originalFiles,global,o,c,"${OCE}_coordinates_mask.nc ${ATM}_grid_mask.nc" \ |
---|
[4195] | 587 | --attribute associatedFiles,global,o,c,"grids_${CplModel}.nc areas_${CplModel}.nc masks_${CplModel}.nc" \ |
---|
[3620] | 588 | --attribute directory,global,o,c,"$(pwd)" \ |
---|
| 589 | --attribute description,global,o,c,"Fields needed by OASIS-MCT" \ |
---|
| 590 | --attribute title,global,o,c,"${InFile}.nc" \ |
---|
[4320] | 591 | --attribute Program,global,o,c,"Generated by CreateWeightsMask" \ |
---|
[3620] | 592 | --attribute timeStamp,global,o,c,"$(date)" \ |
---|
| 593 | --attribute HOSTNAME,global,o,c,"$(hostname)" \ |
---|
| 594 | --attribute LOGNAME,global,o,c,"$(whoami)" \ |
---|
| 595 | --attribute NCO,global,o,c,"NCO netCDF Operator ${NCO} http://nco.sourceforge.net" \ |
---|
[4172] | 596 | --attribute Python,global,o,c,"Python3 version ${PYTHON_VER}" \ |
---|
[3620] | 597 | --attribute OS,global,o,c,"$(uname -o)" \ |
---|
| 598 | --attribute release,global,o,c,"$(uname -r)" \ |
---|
| 599 | --attribute directory,global,o,c,"$(pwd)" \ |
---|
[3624] | 600 | --attribute description,global,o,c,"Generated with XIOS http://forge.ipsl.jussieu.fr/ioserver and MOSAIX https://forge.ipsl.jussieu.fr/igcmg/browser/TOOLS/MOSAIX" \ |
---|
[4090] | 601 | --attribute SVN_Author,global,o,c,'$Author$' \ |
---|
| 602 | --attribute SVN_Date,global,o,c,'$Date$' \ |
---|
| 603 | --attribute SVN_Revision,global,o,c,'$Revision$' \ |
---|
| 604 | --attribute SVN_Id,global,o,c,'$Id$' \ |
---|
[3620] | 605 | ${InFile} |
---|
| 606 | done |
---|
[4320] | 607 | |
---|
| 608 | # Duplicate with no global attribute to avoid erasing attributes in other files |
---|
| 609 | cp ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}_noglobal.nc |
---|
| 610 | ncatted --history --attribute ,global,d,c, ${ATM}_grid_maskFrom_${OCE}_noglobal.nc |
---|
| 611 | |
---|
[3620] | 612 | ## |
---|
[4172] | 613 | echo ${Titre}"Update and complete weight files to fit OASIS requested format"${Norm} |
---|
[3620] | 614 | ## =========================================================================== |
---|
| 615 | cat <<EOF > add_dim.nco |
---|
| 616 | defdim("num_wgts",1) ; |
---|
| 617 | weight[n_weight, num_wgts] = weight ; |
---|
| 618 | EOF |
---|
| 619 | |
---|
[3719] | 620 | for rmpFile in rmp_*.nc ; do |
---|
[4199] | 621 | mv ${rmpFile} tmp_${rmpFile} |
---|
| 622 | ncap2 --history --script-file add_dim.nco tmp_${rmpFile} ${rmpFile} ; rm tmp_${rmpFile} |
---|
[3620] | 623 | |
---|
[3719] | 624 | ncrename --history --dimension n_weight,num_links ${rmpFile} |
---|
| 625 | ncrename --history --variable src_idx,src_address ${rmpFile} |
---|
| 626 | ncrename --history --variable dst_idx,dst_address ${rmpFile} |
---|
| 627 | ncrename --history --variable weight,remap_matrix ${rmpFile} |
---|
[4320] | 628 | |
---|
| 629 | |
---|
[3719] | 630 | ncatted --history --attribute conventions,global,o,c,"SCRIP" ${rmpFile} |
---|
| 631 | ncatted --history --attribute normalization,global,o,c,"none" ${rmpFile} |
---|
[3620] | 632 | |
---|
[3719] | 633 | case ${rmpFile} in |
---|
[3620] | 634 | ( rmp_*${oce}_to_t${atm}_* ) |
---|
[3639] | 635 | ncatted --history \ |
---|
[3620] | 636 | --attribute title,global,o,c,"Weights ${OCE} to ${ATM}" \ |
---|
[4153] | 637 | --attribute source_grid,global,o,c,"${oceDomainType}" \ |
---|
| 638 | --attribute dest_grid,global,o,c,"${atmDomainType}" \ |
---|
[3719] | 639 | ${rmpFile} |
---|
[3620] | 640 | ;; |
---|
| 641 | ( rmp_*${atm}_to_*${oce}_* ) |
---|
[3639] | 642 | ncatted --history \ |
---|
[3620] | 643 | --attribute title,global,o,c,"Weights ${ATM} to ${OCE}" \ |
---|
[4153] | 644 | --attribute source_grid,global,o,c,"${atmDomainType}" \ |
---|
| 645 | --attribute dest_grid,global,o,c,"${oceDomainType}" \ |
---|
[3719] | 646 | ${rmpFile} |
---|
[3620] | 647 | ;; |
---|
| 648 | esac |
---|
| 649 | done |
---|
| 650 | |
---|
[4186] | 651 | ls |
---|
[3620] | 652 | ## |
---|
[4172] | 653 | echo ${Titre}"Add missing variables in rmp files"${Norm} |
---|
[3639] | 654 | ## =========================================================================== |
---|
[4259] | 655 | for rmpFile in $(ls rmp_?${atm}_to_[tuv]${oce}_*.nc rmp_[tuv]${oce}_to_t${atm}_*.nc 2> /dev/null ) ; do |
---|
[3901] | 656 | echo ${rmpFile} |
---|
[3719] | 657 | a_to_o=false ; o_to_a=false |
---|
| 658 | case ${rmpFile} in |
---|
| 659 | ( rmp_?${oce}_to_?${atm}_*.nc ) o_to_a=true ;; |
---|
| 660 | ( rmp_?${atm}_to_?${oce}_*.nc ) a_to_o=true ;; |
---|
| 661 | esac |
---|
| 662 | |
---|
[3901] | 663 | for Grid in t u v o c ; do # Identify grids |
---|
| 664 | [[ ${rmpFile} = rmp_${Grid}${oce}_to_?${atm}_*.nc ]] && ogrid=${Grid} |
---|
| 665 | [[ ${rmpFile} = rmp_?${oce}_to_${Grid}${atm}_*.nc ]] && agrid=${Grid} |
---|
| 666 | [[ ${rmpFile} = rmp_${Grid}${atm}_to_?${oce}_*.nc ]] && agrid=${Grid} |
---|
| 667 | [[ ${rmpFile} = rmp_?${atm}_to_${Grid}${oce}_*.nc ]] && ogrid=${Grid} |
---|
[3719] | 668 | done |
---|
| 669 | OGRID=${ogrid^} |
---|
| 670 | AGRID=${agrid^} |
---|
[3639] | 671 | |
---|
[3719] | 672 | cat <<EOF >add_varoce.nco |
---|
[3639] | 673 | defdim ("src_grid_size" , \$x_grid_${OGRID}.size*\$y_grid_${OGRID}.size) ; |
---|
| 674 | defdim ("src_grid_corners", 4) ; |
---|
| 675 | defdim ("src_grid_rank" , 2) ; |
---|
| 676 | // |
---|
| 677 | src_grid_dims[src_grid_rank] = { \$y_grid_${OGRID}.size, \$x_grid_${OGRID}.size } ; |
---|
| 678 | // |
---|
| 679 | src_grid_center_lat [src_grid_size] = 0.0d ; |
---|
| 680 | src_grid_center_lon [src_grid_size] = 0.0d ; |
---|
| 681 | src_grid_center_lat (:) = nav_lat_grid_${OGRID}(:,:) ; |
---|
| 682 | src_grid_center_lon (:) = nav_lon_grid_${OGRID}(:,:) ; |
---|
| 683 | // |
---|
| 684 | src_grid_corner_lat [src_grid_size, src_grid_corners] = 0.0d ; |
---|
| 685 | src_grid_corner_lon [src_grid_size, src_grid_corners] = 0.0d ; |
---|
| 686 | src_grid_corner_lat(:,:) = bounds_lat_grid_${OGRID}(:,:,:) ; |
---|
| 687 | src_grid_corner_lon(:,:) = bounds_lon_grid_${OGRID}(:,:,:) ; |
---|
| 688 | // |
---|
| 689 | src_grid_imask [src_grid_size] = 0 ; |
---|
| 690 | src_grid_area [src_grid_size] = 0.0d ; |
---|
| 691 | src_grid_frac [src_grid_size] = 1.0d ; |
---|
| 692 | src_grid_imask (:) = 1 - mask_${OGRID}(:,:) ; |
---|
| 693 | src_grid_imask.int() ; |
---|
| 694 | src_grid_area (:) = area_grid_${OGRID}(:,:) ; |
---|
| 695 | EOF |
---|
| 696 | |
---|
[4146] | 697 | cp add_varoce.nco add_varoce_$(basename ${rmpFile} .nc)_o_to_a.nco |
---|
[4199] | 698 | [[ ${o_to_a} = true ]] && ncap2 --history --append --script-file add_varoce_$(basename ${rmpFile} .nc)_o_to_a.nco ${OCE}_coordinates_mask.nc ${rmpFile} |
---|
[3719] | 699 | sed --in-place "s/src_/dst_/g" add_varoce.nco |
---|
[4146] | 700 | cp add_varoce.nco add_varoce_$(basename ${rmpFile} .nc)_a_to_o.nco |
---|
[4199] | 701 | [[ ${a_to_o} = true ]] && ncap2 --history --append --script-file add_varoce_$(basename ${rmpFile} .nc)_a_to_o.nco ${OCE}_coordinates_mask.nc ${rmpFile} |
---|
[3719] | 702 | |
---|
| 703 | if [[ ${atm} = ico ]] ; then |
---|
| 704 | cat <<EOF >add_varatm.nco |
---|
[3639] | 705 | defdim ("dst_grid_size" , \$cell.size) ; |
---|
| 706 | defdim ("dst_grid_corners", 6) ; |
---|
| 707 | defdim ("dst_grid_rank" , 2) ; |
---|
| 708 | // |
---|
| 709 | dst_grid_dims[dst_grid_rank] = { \$cell.size, 1 } ; |
---|
| 710 | // |
---|
| 711 | dst_grid_center_lat [dst_grid_size] = 0.0d ; |
---|
| 712 | dst_grid_center_lon [dst_grid_size] = 0.0d ; |
---|
| 713 | dst_grid_center_lat (:) = lat(:) ; |
---|
| 714 | dst_grid_center_lon (:) = lon(:) ; |
---|
| 715 | // |
---|
| 716 | dst_grid_corner_lat [dst_grid_size, dst_grid_corners] = 0.0d ; |
---|
| 717 | dst_grid_corner_lon [dst_grid_size, dst_grid_corners] = 0.0d ; |
---|
| 718 | dst_grid_corner_lat(:,:) = bounds_lat(:,:) ; |
---|
| 719 | dst_grid_corner_lon(:,:) = bounds_lon(:,:) ; |
---|
| 720 | // |
---|
| 721 | dst_grid_imask [dst_grid_size] = 0 ; |
---|
| 722 | dst_grid_area [dst_grid_size] = 0.0d ; |
---|
| 723 | dst_grid_frac [dst_grid_size] = 1.0d ; |
---|
[4298] | 724 | dst_grid_imask (:) = 1 - Oce2AtmMask(:) ; |
---|
[3639] | 725 | dst_grid_imask.int() ; |
---|
| 726 | dst_grid_area (:) = aire(:) ; |
---|
[4259] | 727 | dst_grid_frac (:) = OceFrac(:) ; |
---|
[3639] | 728 | EOF |
---|
[4146] | 729 | cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco |
---|
[3719] | 730 | if [[ ${o_to_a} = true ]] ; then |
---|
[4320] | 731 | ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE}_noglobal.nc ${rmpFile} |
---|
[3719] | 732 | 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 |
---|
| 733 | mv rmp_tmp.nc ${rmpFile} |
---|
| 734 | fi |
---|
[3718] | 735 | |
---|
[3719] | 736 | sed --in-place "s/dst_/src_/g" add_varatm.nco |
---|
[4146] | 737 | cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco |
---|
[3719] | 738 | if [[ ${a_to_o} = true ]] ; then |
---|
[4320] | 739 | ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE}_noglobal.nc ${rmpFile} |
---|
[3719] | 740 | 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 |
---|
| 741 | mv rmp_tmp.nc ${rmpFile} |
---|
| 742 | fi |
---|
| 743 | fi |
---|
[3966] | 744 | |
---|
[3719] | 745 | if [[ ${atm} = lmd ]] ; then |
---|
| 746 | cat <<EOF >add_varatm.nco |
---|
[3639] | 747 | defdim ("dst_grid_size" , \$lon.size*\$lat.size) ; |
---|
| 748 | defdim ("dst_grid_corners", 4) ; |
---|
| 749 | defdim ("dst_grid_rank" , 2) ; |
---|
| 750 | // |
---|
| 751 | dst_grid_dims[dst_grid_rank] = { \$lat.size, \$lon.size } ; |
---|
| 752 | // |
---|
| 753 | dst_grid_center_lat [dst_grid_size] = 0.0d ; |
---|
| 754 | dst_grid_center_lon [dst_grid_size] = 0.0d ; |
---|
| 755 | lat0lon[lat,lon] = lat(:)+0*lon(:) ; |
---|
| 756 | lon0lat[lat,lon] = lon(:)+0*lat(:) ; |
---|
| 757 | dst_grid_center_lat (:) = lat0lon(:,:) ; |
---|
| 758 | dst_grid_center_lon (:) = lon0lat(:,:) ; |
---|
| 759 | // |
---|
| 760 | //dst_grid_corner_lat [dst_grid_size, dst_grid_corners] = 0.0d ; // Not available for LMDZ lon/lat grid |
---|
| 761 | //dst_grid_corner_lon [dst_grid_size, dst_grid_corners] = 0.0d ; |
---|
| 762 | //dst_grid_corner_lat(:,:) = bounds_lat(:,:) ; |
---|
| 763 | //dst_grid_corner_lon(:,:) = bounds_lon(:,:) ; |
---|
| 764 | // |
---|
| 765 | dst_grid_imask [dst_grid_size] = 0 ; |
---|
| 766 | dst_grid_area [dst_grid_size] = 0.0d ; |
---|
| 767 | dst_grid_frac [dst_grid_size] = 1.0d ; |
---|
[4298] | 768 | dst_grid_imask (:) = 1 - Oce2AtmMask(:,:) ; |
---|
[3639] | 769 | dst_grid_imask.int() ; |
---|
| 770 | dst_grid_area (:) = aire(:,:) ; |
---|
[4259] | 771 | dst_grid_frac (:) = OceFrac(:,:) ; |
---|
[3639] | 772 | EOF |
---|
[4146] | 773 | cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco |
---|
[3719] | 774 | if [[ ${o_to_a} = true ]] ; then |
---|
[4320] | 775 | ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco ${ATM}_grid_maskFrom_${OCE}_noglobal.nc ${rmpFile} |
---|
[3719] | 776 | 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 |
---|
| 777 | mv rmp_tmp.nc ${rmpFile} |
---|
| 778 | fi |
---|
| 779 | |
---|
| 780 | sed --in-place "s/dst/src/g" add_varatm.nco |
---|
[4146] | 781 | cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco |
---|
[3719] | 782 | if [[ ${a_to_o} = true ]] ; then |
---|
[4320] | 783 | ncap2 --history --append --script-file add_varatm_$(basename ${rmpFile} .nc)_a_to_o.nco ${ATM}_grid_maskFrom_${OCE}_noglobal.nc ${rmpFile} |
---|
[3719] | 784 | 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 |
---|
| 785 | mv rmp_tmp.nc ${rmpFile} |
---|
| 786 | fi |
---|
| 787 | fi |
---|
[3639] | 788 | done |
---|
[3901] | 789 | ls -al ${OCE}_coordinates_mask.nc |
---|
[3639] | 790 | ## |
---|
[4186] | 791 | ## ============================================================================ |
---|
[4172] | 792 | echo ${Titre}"Creates and save auxiliary files for OASIS : grids.nc, areas.nc and masks.nc"${Norm} |
---|
[4186] | 793 | cp ${SUBMIT_DIR}/CreateOasisGrids.bash . |
---|
| 794 | bash CreateOasisGrids.bash --oce ${OCE} --atm ${ATM} |
---|
[4097] | 795 | |
---|
| 796 | |
---|
| 797 | ## |
---|
[4172] | 798 | echo ${Titre}"Runoff weights"${Norm} |
---|
[4097] | 799 | ## =========================================================================== |
---|
[4186] | 800 | if [[ "X${okRunoff}" = "Xyes" ]] ; then |
---|
[4195] | 801 | ${PyRun} python3 -u RunoffWeights.py --oce=${OCE} --atm=${ATM} \ |
---|
[4172] | 802 | --atmCoastWidth=${atmCoastWidth} --oceCoastWidth=${oceCoastWidth} --searchRadius=${searchRadius} \ |
---|
[4195] | 803 | --grids=grids_${CplModel}.nc --areas=areas_${CplModel}.nc --masks=masks_${CplModel}.nc \ |
---|
[4199] | 804 | --o2a=${ATM}_grid_maskFrom_${OCE}.nc --output=rmp_t${atm}_to_t${oce}_runoff_${runOff_atmQuantity}_to_${runOff_oceQuantity}.nc \ |
---|
| 805 | --fmt=${FMT_XIOS} \ |
---|
[5925] | 806 | --atmQuantity=${runOff_atmQuantity} --oceQuantity=${runOff_oceQuantity} --ocePerio=${OcePerio} |
---|
[4172] | 807 | fi |
---|
[4097] | 808 | |
---|
| 809 | ## |
---|
[4172] | 810 | echo ${Titre}"Calving weights"${Norm} |
---|
[3620] | 811 | ## =========================================================================== |
---|
[4172] | 812 | if [[ "X${okCalving}" = "Xyes" ]] ; then |
---|
| 813 | case ${OCE} in |
---|
[4298] | 814 | ( eORCA025* ) |
---|
[4186] | 815 | cp /ccc/work/cont003/gencmip6/deshayej/eORCA_R025_runoff_v1.2.nc . |
---|
[4199] | 816 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth.nc --fmt=${FMT_XIOS} \ |
---|
[4186] | 817 | --oce=${OCE} --atm=${ATM} --type=nosouth --dir=. |
---|
[4199] | 818 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg.nc --fmt=${FMT_XIOS} \ |
---|
[4186] | 819 | --oce=${OCE} --atm=${ATM} --type=iceberg --dir=. --repartition_file=eORCA_R025_runoff_v1.2.nc --repartition_var=Icb_flux |
---|
[4199] | 820 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf.nc --fmt=${FMT_XIOS} \ |
---|
[4186] | 821 | --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=. --repartition_file=eORCA_R025_runoff_v1.2.nc --repartition_var=sornfisf |
---|
[4172] | 822 | ;; |
---|
| 823 | |
---|
| 824 | ( eORCA1.2 ) |
---|
| 825 | cp ${R_IN}/OCE/NEMO/ORCA1_LIM3_PISCES/v3.6_stable/runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc . |
---|
[4199] | 826 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth.nc --fmt=${FMT_XIOS}\ |
---|
[4172] | 827 | --oce=${OCE} --atm=${ATM} --type=nosouth --dir=. |
---|
[4199] | 828 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg.nc --fmt=${FMT_XIOS}\ |
---|
[4172] | 829 | --oce=${OCE} --atm=${ATM} --type=iceberg --dir=. --repartition_file=runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc --repartition_var=Icb_flux |
---|
[4199] | 830 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf.nc --fmt=${FMT_XIOS}\ |
---|
[4172] | 831 | --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=. --repartition_file=runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc --repartition_var=sornfisf |
---|
| 832 | ;; |
---|
| 833 | |
---|
| 834 | ( * ) |
---|
[4199] | 835 | ${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_full.nc --fmt=${FMT_XIOS} \ |
---|
[5925] | 836 | --oce=${OCE} --atm=${ATM} --type=full --dir=. --ocePerio=${OcePerio} |
---|
[4172] | 837 | ;; |
---|
| 838 | |
---|
| 839 | esac |
---|
| 840 | fi |
---|
| 841 | |
---|
| 842 | ## |
---|
[4199] | 843 | echo ${Titre}"Simplifies headers, add version and comment"${Norm} |
---|
[4172] | 844 | ## =========================================================================== |
---|
[4199] | 845 | 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 |
---|
[4037] | 846 | ncatted --history --attribute history_of_appended_files,global,d,c,"" ${File} |
---|
[4199] | 847 | ncatted --history --attribute history,global,d,c,"" ${File} |
---|
[4172] | 848 | [[ "X${Comment}" != "X" ]] && ncatted --history --attribute Comment,global,o,c,"${Comment}" ${File} |
---|
| 849 | [[ "X${Version}" != "X" ]] && ncatted --history --attribute Version,global,o,c,"${Version}" ${File} |
---|
[4199] | 850 | [[ "X${Tag}" != "X" ]] && ncatted --history --attribute Version,global,o,c,"${Tag}" ${File} |
---|
| 851 | done |
---|
| 852 | |
---|
| 853 | ## |
---|
| 854 | echo ${Titre}"Rename rmp and dia files"${Norm} |
---|
| 855 | ## =========================================================================== |
---|
[4259] | 856 | for File in $(ls *${oce}*${atm}* *${atm}*${oce}* 2> /dev/null ); do |
---|
[3719] | 857 | NewFile=$(echo ${File} | sed -e "s/${atm}/${ATM}/" -e "s/${oce}/${OCE}/" ) |
---|
[4259] | 858 | mv ${File} ${NewFile} |
---|
[3620] | 859 | done |
---|
| 860 | |
---|
[4199] | 861 | ## |
---|
| 862 | echo ${Titre}"Add Tag"${Norm} |
---|
| 863 | ## =========================================================================== |
---|
| 864 | if [[ "X${Tag}" != "X" ]] ; then |
---|
| 865 | 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 |
---|
| 866 | mv ${File} $(basename ${File} .nc)_${Tag}.nc |
---|
| 867 | done |
---|
[4186] | 868 | fi |
---|
[4199] | 869 | ## |
---|
| 870 | echo ${Titre}"Add Version"${Norm} |
---|
| 871 | ## =========================================================================== |
---|
| 872 | if [[ "X${Version}" != "X" ]] ; then |
---|
| 873 | 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 |
---|
| 874 | mv ${File} $(basename ${File} .nc)_${Version}.nc |
---|
| 875 | done |
---|
| 876 | fi |
---|
| 877 | |
---|
| 878 | ## =========================================================================== |
---|
| 879 | echo ${Titre}"Save results"${Norm} |
---|
| 880 | ## =========================================================================== |
---|
| 881 | 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 |
---|
| 882 | cp ${File} ${SUBMIT_DIR} |
---|
| 883 | done |
---|
[4172] | 884 | |
---|
[4199] | 885 | |
---|
[3620] | 886 | ## |
---|
[4172] | 887 | echo ${Titre}"Creates a README.txt file"${Norm} |
---|
[4090] | 888 | ## =========================================================================== |
---|
| 889 | [[ -f README.txt ]] && rm README.txt |
---|
[4298] | 890 | UUID=$(uuid) |
---|
[3620] | 891 | |
---|
[4090] | 892 | cat <<EOF > README.txt |
---|
| 893 | Files produced by CreateWeightsMask.bash and CreateOasisGrids.bash |
---|
| 894 | |
---|
| 895 | rmp_* are weights files |
---|
| 896 | dia_* are diagnostic files not needed for the coupler |
---|
[4195] | 897 | grids_${CplModel}.nc areas_${CplModel}.nc masks_${CplModel}.nc are auxiliary file needed by OASIS-MCT |
---|
[4090] | 898 | All files have the same uuid in the global attributes |
---|
| 899 | |
---|
| 900 | Description : Weigths and auxiliary files for coupling ${OCE} and ${ATM} needed by OASIS-MCT |
---|
| 901 | Conventions : CF-1.6 |
---|
| 902 | source : IPSL Earth system model |
---|
| 903 | group : ICMC IPSL Climate Modelling Center |
---|
| 904 | Institution : IPSL https://www.ipsl.fr |
---|
| 905 | Ocean : ${OCE} https://www.nemo-ocean.eu |
---|
| 906 | Atmosphere : ${ATM} http://lmdz.lmd.jussieu.fr |
---|
| 907 | production : $(finger ${LOGNAME} | head -1 | awk '{print $4, $5}') |
---|
| 908 | originalFiles : ${OCE}_coordinates_mask.nc ${ATM}_grid_mask.nc |
---|
[4195] | 909 | associatedFiles : grids_${CplModel}.nc areas_${CplModel}.nc masks_${CplModel}.nc |
---|
[4090] | 910 | directory : $(pwd) |
---|
| 911 | timeStamp : $(date) |
---|
| 912 | uuid : ${UUID} |
---|
| 913 | HOSTNAME : $(hostname) |
---|
| 914 | LOGNAME : $(whoami) |
---|
| 915 | NCO : NCO netCDF Operator ${NCO} http://nco.sourceforge.net |
---|
| 916 | Python version : ${PYTHON_VER} |
---|
| 917 | OS : $(uname -o) |
---|
| 918 | release : $(uname -r) |
---|
| 919 | hardware : $(uname -i) |
---|
[4091] | 920 | EOF |
---|
[4090] | 921 | |
---|
[4091] | 922 | echo 'SVN Information : ' >> README.txt |
---|
| 923 | echo '$Author$ ' >> README.txt |
---|
| 924 | echo '$Date$ ' >> README.txt |
---|
| 925 | echo '$Revision$ ' >> README.txt |
---|
| 926 | echo '$Id$ ' >> README.txt |
---|
| 927 | echo '$HeadURL$ ' >> README.txt |
---|
[4090] | 928 | |
---|
[4172] | 929 | echo ${Titre}"Compute checksums and add them to README"${Norm} |
---|
[4199] | 930 | # ------------------------------------------------------------ |
---|
[4091] | 931 | cat << EOF >> README.txt |
---|
[4090] | 932 | |
---|
[4159] | 933 | Files produced, with checksum produced by Unix command shasum (version $(shasum --version)) with default algorithm |
---|
[4090] | 934 | |
---|
| 935 | EOF |
---|
| 936 | |
---|
[4199] | 937 | 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 |
---|
[4320] | 938 | ncatted --history --attribute uuid,global,o,c,"${UUID}" ${file} |
---|
[4090] | 939 | echo "$(shasum ${file})" >> README.txt |
---|
| 940 | done |
---|
| 941 | |
---|
| 942 | cat <<EOF >> README.txt |
---|
| 943 | |
---|
| 944 | ================= That's all folk's ! ======================== |
---|
| 945 | EOF |
---|
| 946 | |
---|
[4259] | 947 | if [[ "X${Version}" != "X" ]] ; then |
---|
| 948 | cp README.txt ${SUBMIT_DIR}/README_${CplModel}_MOSAIX_${Version}.txt |
---|
| 949 | else |
---|
| 950 | cp README.txt ${SUBMIT_DIR}/README_${CplModel}_MOSAIX.txt |
---|
| 951 | fi |
---|
[3620] | 952 | ## =========================================================================== |
---|
| 953 | ## |
---|
[4172] | 954 | echo ${Titre}" That's all folk's !!! "${Norm} |
---|
[3620] | 955 | ## |
---|
| 956 | ## =========================================================================== |
---|
| 957 | |
---|