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