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