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