[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 |
---|
[3719] | 6 | #MSUB -n 4 # Number of processors |
---|
| 7 | #MSUB -T 1800 # Time limit (seconds) |
---|
[3620] | 8 | #MSUB -q standard |
---|
| 9 | #MSUB -Q test |
---|
| 10 | #MSUB -p devcmip6 |
---|
| 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$ |
---|
[3620] | 38 | |
---|
| 39 | ## |
---|
| 40 | ## Configuration |
---|
| 41 | ## =========================================================================== |
---|
| 42 | |
---|
| 43 | # |
---|
| 44 | # Defines models |
---|
| 45 | # ============== |
---|
[3686] | 46 | OCE=ORCA2.3 |
---|
| 47 | #OCE=eORCA1.2 |
---|
[3620] | 48 | #OCE=ORCA025 |
---|
| 49 | |
---|
[3734] | 50 | #ATM=ICO30 |
---|
[3620] | 51 | #ATM=ICO40 |
---|
| 52 | #ATM=ICO450 |
---|
[3734] | 53 | ATM=LMD9695 |
---|
[3620] | 54 | #ATM=LMD144X142 |
---|
| 55 | |
---|
| 56 | # |
---|
| 57 | # Defines OCE grids to handle |
---|
| 58 | # =========================== |
---|
| 59 | ListOCEGRID="T U V" |
---|
[3719] | 60 | ListOrder="1st" # " 2nd |
---|
| 61 | ListNormalize="false true" |
---|
[3620] | 62 | |
---|
| 63 | ## =========================================================================== |
---|
| 64 | ## |
---|
| 65 | ## You should not change anything below this line .... |
---|
| 66 | ## |
---|
| 67 | ## =========================================================================== |
---|
| 68 | SUBMIT_DIR=$(pwd) |
---|
| 69 | |
---|
| 70 | # |
---|
| 71 | # Defines computer |
---|
| 72 | # ================ |
---|
[3734] | 73 | if [[ $(hostname) = curie* ]] ; then arch=curie ; center=tgcc ; fi |
---|
| 74 | if [[ $(hostname) = irene* ]] ; then arch=irene ; center=tgcc ; fi |
---|
| 75 | if [[ $(hostname) = lsce3005* ]] ; then arch=spip ; center=spip ; fi |
---|
| 76 | |
---|
[3620] | 77 | PROGRAM=$(basename ${0}) |
---|
| 78 | |
---|
| 79 | case ${arch} in |
---|
| 80 | ( curie | irene ) |
---|
| 81 | set +vx |
---|
[3686] | 82 | module purge |
---|
| 83 | source /ccc/cont003/home/dsm/p86ipsl/.env_intel17.0.2_curie; |
---|
| 84 | source /ccc/cont003/home/dsm/p86ipsl/.env_netcdf4.3.3.1_curie |
---|
[3620] | 85 | R_IN=$(ccc_home -u igcmg --cccwork)/IGCM |
---|
| 86 | TMPDIR=${SCRATCHDIR}/TMP |
---|
| 87 | SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}} |
---|
| 88 | PROGRAM=${BRIDGE_MSUB_REQNAME} |
---|
[3734] | 89 | MPIRUN=ccc_mprun |
---|
[3620] | 90 | ;; |
---|
[3734] | 91 | ( spip ) |
---|
| 92 | R_IN=${HOME}/Scratch/IGCM |
---|
| 93 | TMPDIR=${HOME}/Scratch/TMP |
---|
| 94 | SUBMIT_DIR=$(pwd) |
---|
| 95 | MPIRUN=/opt/local/bin/mpirun-openmpi-gcc49 -n 2 |
---|
| 96 | ;; |
---|
[3620] | 97 | ( * ) |
---|
| 98 | exit -1 |
---|
| 99 | ;; |
---|
| 100 | esac |
---|
| 101 | |
---|
| 102 | set -x ; set -e |
---|
| 103 | |
---|
| 104 | mkdir -p ${TMPDIR}/${OCE}x${ATM} || exit 1 |
---|
| 105 | cd ${TMPDIR}/${OCE}x${ATM} || exit 1 |
---|
| 106 | rm -f * |
---|
| 107 | |
---|
| 108 | # |
---|
| 109 | # Suffixes |
---|
| 110 | # --------------------------------------------------------------------------- |
---|
[3719] | 111 | Listocegrid=${ListOCEGRID,,} |
---|
[3620] | 112 | |
---|
| 113 | case ${OCE} in |
---|
| 114 | ( *ORC* ) oce=orc ; oce_domain_type=curvilinear ;; |
---|
| 115 | esac |
---|
| 116 | case ${ATM} in |
---|
| 117 | ( *dynamico* ) atm=ico ; atm_domain_type=unstructured ;; |
---|
| 118 | ( *ICO* ) atm=ico ; atm_domain_type=unstructured ;; |
---|
| 119 | ( *lmd* | *LMD* ) atm=lmd ; atm_domain_type=rectilinear ;; |
---|
| 120 | esac |
---|
| 121 | |
---|
[3723] | 122 | case ${OCE} in |
---|
| 123 | ( ORCA2.3* ) OcePerio=4 ;; |
---|
| 124 | ( ORCA1* | eORCA1* ) OcePerio=6 ;; |
---|
| 125 | esac |
---|
[3620] | 126 | # |
---|
| 127 | # Format for OASIS files : should be NetCDF3 classic or NetCDF3 64 bits |
---|
| 128 | # --------------------------------------------------------------------------- |
---|
| 129 | FL_FMT=64bit |
---|
| 130 | |
---|
| 131 | |
---|
[3723] | 132 | cp ${SUBMIT_DIR}/bin/interpol.exe . |
---|
| 133 | cp ${SUBMIT_DIR}/*.py . |
---|
[3620] | 134 | |
---|
| 135 | ## |
---|
| 136 | ## NEMO T point towards ATM - 1st order |
---|
| 137 | ## =========================================================================== |
---|
| 138 | cp ${R_IN}/OCE/NEMO/${OCE}/${OCE}_coordinates_mask.nc . |
---|
[3639] | 139 | cp ${R_IN}/ATM/GRID/${ATM}_grid.nc . |
---|
[3620] | 140 | |
---|
| 141 | ln -s ${OCE}_coordinates_mask.nc oce_grid.nc |
---|
| 142 | ln -s ${ATM}_grid.nc atm_grid.nc |
---|
| 143 | |
---|
| 144 | echo ${Green}"${OCE} T toward ${ATM} - 1storder"${Norm} |
---|
| 145 | cp ${SUBMIT_DIR}/iodef_oce_to_atm.xml iodef.xml |
---|
| 146 | |
---|
| 147 | python 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 |
---|
| 148 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type} |
---|
| 149 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type} |
---|
| 150 | python 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 |
---|
[3719] | 151 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_t${oce}_to_t${atm}_1storder_false |
---|
[3620] | 152 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${OCE} mask interpolated to ${ATM}" |
---|
| 153 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${oce_domain_type} |
---|
| 154 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${atm_domain_type} |
---|
| 155 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t 1 |
---|
| 156 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type} |
---|
| 157 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type} |
---|
[3719] | 158 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_t${oce}_to_t${atm}_1storder_false.nc |
---|
[3620] | 159 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 |
---|
[3719] | 160 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t false |
---|
| 161 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false |
---|
[3620] | 162 | |
---|
[3719] | 163 | cp iodef.xml iodef_t${oce}_to_t${atm}_1storder_false.xml |
---|
[3620] | 164 | |
---|
[3734] | 165 | time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src=yes --mask_dst=no |
---|
[3620] | 166 | |
---|
| 167 | ## |
---|
| 168 | ## Correct spurious values (extremes) |
---|
| 169 | ## =========================================================================== |
---|
| 170 | cat <<EOF > correction_masque.nco |
---|
| 171 | where (OceFrac < 0.00001 ) OceFrac=OceFrac.get_miss() ; |
---|
| 172 | where (OceFrac > 0.99999 ) OceFrac=1.0 ; |
---|
| 173 | OceFrac.delete_miss() ; |
---|
| 174 | // Fill masked values to land values |
---|
| 175 | where (OceFrac > 1.0 ) OceFrac=0.0 ; |
---|
| 176 | where (OceFrac < 0.0 ) OceFrac=0.0 ; |
---|
| 177 | EOF |
---|
[3719] | 178 | ncap2 --history --overwrite --script-file correction_masque.nco dia_t${oce}_to_t${atm}_1storder_false.nc tmp_dia_t${oce}_to_t${atm}_1storder_false.nc ; mv tmp_dia_t${oce}_to_t${atm}_1storder_false.nc dia_t${oce}_to_t${atm}_1storder_false.nc |
---|
| 179 | ncatted --history -a missing_value,OceFrac,d,,"" -a _FillValue,OceFrac,d,,"" dia_t${oce}_to_t${atm}_1storder_false.nc |
---|
[3620] | 180 | |
---|
| 181 | ## |
---|
| 182 | ## Creates mask on ATM grid |
---|
| 183 | ## =========================================================================== |
---|
[3719] | 184 | cp dia_t${oce}_to_t${atm}_1storder_false.nc dia_t${oce}_to_t${atm}_1storder_false_mask.nc |
---|
| 185 | ncks --alphabetize --history --overwrite --variable OceFrac dia_t${oce}_to_t${atm}_1storder_false_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 186 | ncks --alphabetize --history --append --variable aire atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 187 | [[ ${atm} = *ico* ]] && ncks --alphabetize --history --append --variable bounds_lon,bounds_lat atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[3620] | 188 | |
---|
| 189 | cat <<EOF > creation_masque.nco |
---|
| 190 | where (OceFrac > 0.0 ) OceFrac=1 ; |
---|
| 191 | where (OceFrac <= 0.0 ) OceFrac=0 ; |
---|
| 192 | EOF |
---|
[3719] | 193 | ncap2 --history --overwrite --script-file creation_masque.nco dia_t${oce}_to_t${atm}_1storder_false_mask.nc tmp_dia_t${oce}_to_t${atm}_1storder_false_mask.nc ; mv tmp_dia_t${oce}_to_t${atm}_1storder_false_mask.nc dia_t${oce}_to_t${atm}_1storder_false_mask.nc |
---|
| 194 | ncrename --history --variable OceFrac,OceMask dia_t${oce}_to_t${atm}_1storder_false_mask.nc |
---|
[3620] | 195 | |
---|
[3719] | 196 | ncks --alphabetize --history --append --variable OceMask dia_t${oce}_to_t${atm}_1storder_false_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[3723] | 197 | rm dia_t${oce}_to_t${atm}_1storder_false_mask.nc |
---|
[3620] | 198 | |
---|
[3718] | 199 | ## |
---|
[3723] | 200 | ## Creates mask of coastal OCE points |
---|
[3718] | 201 | ## =========================================================================== |
---|
[3723] | 202 | python ComputeNemoCoast.py -n ${OcePerio} -i oce_grid.nc |
---|
| 203 | |
---|
| 204 | ## |
---|
| 205 | ## Creates mask of coastal ATM points |
---|
| 206 | ## =========================================================================== |
---|
[3718] | 207 | cat <<EOF > coastal.nco |
---|
| 208 | AtmCoastal = OceFrac * 0.0 ; |
---|
| 209 | where (OceFrac > 0.0 && OceFrac < 1.0 ) AtmCoastal = 1.0 ; |
---|
| 210 | EOF |
---|
| 211 | ncap2 --history --overwrite --script-file coastal.nco ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_coastal_maskFrom_${OCE}.nc |
---|
| 212 | ncks --history --append --variable AtmCoastal ${ATM}_coastal_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 213 | rm ${ATM}_coastal_maskFrom_${OCE}.nc |
---|
[3620] | 214 | |
---|
| 215 | ## |
---|
| 216 | ## NEMO, other case, towards ATM |
---|
| 217 | ## =========================================================================== |
---|
[3719] | 218 | for order in ${ListOrder} ; do |
---|
[3620] | 219 | case ${order} in |
---|
| 220 | ( 1st ) num_order=1 ;; |
---|
| 221 | ( 2nd ) num_order=2 ;; |
---|
| 222 | esac |
---|
[3719] | 223 | for normalize in ${ListNormalize} ; do |
---|
| 224 | for OCEGRID in ${ListOCEGRID} ; do |
---|
| 225 | ocegrid=${OCEGRID,,} |
---|
[3620] | 226 | |
---|
[3719] | 227 | if [[ ! -f rmp_${ocegrid}${oce}_to_t${atm}_${order}order_${normalize}.nc ]] ; then |
---|
| 228 | |
---|
| 229 | echo ${Green}"${OCE} ${OCEGRID} toward ${ATM} - ${order}order - normalize: ${normalize}"${Norm} |
---|
| 230 | |
---|
| 231 | python 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_${OCEGRID} |
---|
| 232 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type} |
---|
| 233 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type} |
---|
| 234 | python 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_${OCEGRID} |
---|
| 235 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_${ocegrid}${oce}_to_t${atm}_${order}order_${normalize} |
---|
| 236 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${OCE} mask interpolated to ${ATM}" |
---|
| 237 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${oce_domain_type} |
---|
| 238 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${atm_domain_type} |
---|
| 239 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${num_order} |
---|
| 240 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${normalize} |
---|
| 241 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type} |
---|
| 242 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type} |
---|
| 243 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${num_order} |
---|
| 244 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_${ocegrid}${oce}_to_t${atm}_${order}order_${normalize}.nc |
---|
| 245 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${normalize} |
---|
| 246 | |
---|
| 247 | cp iodef.xml iodef_${ocegrid}${oce}_t${atm}_${order}order_${normalize}.xml |
---|
| 248 | |
---|
[3734] | 249 | time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src=yes --mask_dst=yes |
---|
[3719] | 250 | fi |
---|
| 251 | |
---|
| 252 | done |
---|
[3620] | 253 | done |
---|
| 254 | done |
---|
| 255 | |
---|
| 256 | ## |
---|
| 257 | ## ATM towards NEMO points |
---|
| 258 | ## =========================================================================== |
---|
| 259 | cp ${SUBMIT_DIR}/iodef_atm_to_oce.xml iodef.xml |
---|
| 260 | |
---|
| 261 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} |
---|
| 262 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} |
---|
| 263 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${ATM} mask interpolated to ${OCE}" |
---|
| 264 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${atm_domain_type} |
---|
| 265 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${oce_domain_type} |
---|
| 266 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} |
---|
| 267 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} |
---|
| 268 | |
---|
[3719] | 269 | for order in ${ListOrder} ; do |
---|
[3620] | 270 | case ${order} in |
---|
| 271 | ( 1st ) num_order=1 ;; |
---|
| 272 | ( 2nd ) num_order=2 ;; |
---|
| 273 | esac |
---|
[3719] | 274 | for normalize in ${ListNormalize} ; do |
---|
| 275 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${num_order} |
---|
| 276 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${num_order} |
---|
| 277 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${normalize} |
---|
| 278 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${normalize} |
---|
[3620] | 279 | |
---|
[3719] | 280 | for OCEGRID in ${ListOCEGRID} ; do |
---|
| 281 | ocegrid=${OCEGRID,,} |
---|
| 282 | |
---|
| 283 | echo ${Green}"${ATM} toward ${OCE} ${OCEGRID} - ${order}order - normalize: ${normalize}"${Norm} |
---|
| 284 | python 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_${OCEGRID} |
---|
| 285 | python 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_${OCEGRID} |
---|
| 286 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_t${atm}_to_${ocegrid}${oce}_${order}order_${normalize} |
---|
| 287 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_t${atm}_to_${ocegrid}${oce}_${order}order_${normalize}.nc |
---|
| 288 | cp iodef.xml iodef_t${atm}_to_${ocegrid}${oce}_${order}order_${normalize}.xml |
---|
| 289 | |
---|
[3734] | 290 | time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src=yes --mask_dst=yes |
---|
[3719] | 291 | |
---|
| 292 | done |
---|
[3620] | 293 | done |
---|
| 294 | done |
---|
| 295 | |
---|
| 296 | ## |
---|
[3718] | 297 | ## ATM towards NEMO points - runoff |
---|
| 298 | ## =========================================================================== |
---|
| 299 | cp ${SUBMIT_DIR}/iodef_atm_to_oce.xml iodef.xml |
---|
[3719] | 300 | for normalize in ${ListNormalize} ; do |
---|
| 301 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} |
---|
| 302 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} |
---|
| 303 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="title"]' -t "${ATM} coastal mask interpolated to ${OCE}" |
---|
| 304 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${atm_domain_type} |
---|
| 305 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]' -t ${oce_domain_type} |
---|
| 306 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} |
---|
| 307 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} |
---|
| 308 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 |
---|
| 309 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t 1 |
---|
| 310 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${normalize} |
---|
| 311 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]' -k name -v ${ATM}_grid_maskFrom_${OCE} |
---|
| 312 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_src"]/field[@id="mask_src"]' -k name -v AtmCoastal |
---|
[3723] | 313 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/file_definition/file[@id="file_dst"]/field[@id="mask_dst"]' -k name -v OceCoastal |
---|
[3719] | 314 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]' -k name -v dia_c${atm}_to_t${oce}_1storder_${normalize} |
---|
| 315 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k weight_filename -v rmp_c${atm}_to_t${oce}_1storder_${normalize}.nc |
---|
| 316 | python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${normalize} |
---|
| 317 | |
---|
| 318 | cp iodef.xml iodef_c${atm}_to_t${oce}_1storder_${normalize}.xml |
---|
| 319 | |
---|
[3734] | 320 | time /usr/bin/time ${MPIRUN} ./interpol.exe --mask_src=yes --mask_dst=yes |
---|
[3719] | 321 | done |
---|
[3718] | 322 | ## |
---|
[3620] | 323 | ## Change all NetCDF files to NetCDF 3 format (needed for OASIS) |
---|
| 324 | ## =========================================================================== |
---|
| 325 | for InFile in *.nc ; do |
---|
[3718] | 326 | mv ${InFile} tmp_${InFile} |
---|
| 327 | ncks --alphabetize --fl_fmt=${FL_FMT} --history tmp_${InFile} ${InFile} |
---|
[3620] | 328 | done |
---|
| 329 | |
---|
| 330 | ## |
---|
| 331 | ## Add time axis and coordinates information |
---|
| 332 | ## (needed if files need to be read by XIOS) |
---|
| 333 | ## =========================================================================== |
---|
[3719] | 334 | #ncatted --history -a coordinates,aire,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc |
---|
| 335 | 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 |
---|
| 336 | |
---|
[3620] | 337 | if [[ ${atm} = ico ]] ; then |
---|
| 338 | cat <<EOF > add_time.nco |
---|
[3719] | 339 | OceFrac [time_counter,cell] = OceFrac (:) ; |
---|
| 340 | OceMask [time_counter,cell] = OceMask (:) ; |
---|
| 341 | AtmCoastal [time_counter,cell] = AtmCoastal (:) ; |
---|
[3620] | 342 | EOF |
---|
[3719] | 343 | 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] | 344 | ncatted --history \ |
---|
[3719] | 345 | -a coordinates,OceFrac,c,c,"time_counter cell" \ |
---|
| 346 | -a coordinates,OceMask,c,c,"time_counter cell" \ |
---|
| 347 | -a coordinates,AtmCoastal,c,c,"time_counter cell" \ |
---|
| 348 | -a coordinates,aire,c,c,"cell" \ |
---|
| 349 | ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[3620] | 350 | fi |
---|
| 351 | if [[ ${atm} = lmd ]] ; then |
---|
| 352 | cat <<EOF > add_time.nco |
---|
[3719] | 353 | OceFrac [time_counter,lat,lon] = OceFrac (:,:) ; |
---|
| 354 | OceMask [time_counter,lat,lon] = OceMask (:,:) ; |
---|
| 355 | AtmCoastal [time_counter,lat,lon] = AtmCoastal (:,:) ; |
---|
[3620] | 356 | EOF |
---|
[3719] | 357 | 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] | 358 | ncatted --history \ |
---|
[3719] | 359 | -a coordinates,OceFrac,c,c,"time_counter lat lon" \ |
---|
| 360 | -a coordinates,OceMask,c,c,"time_counter lat lon" \ |
---|
| 361 | -a coordinates,AtmCoastal,c,c,"time_counter lat lon" \ |
---|
| 362 | -a coordinates,aire,c,c,"lat lon" \ |
---|
| 363 | ${ATM}_grid_maskFrom_${OCE}.nc |
---|
[3620] | 364 | fi |
---|
[3719] | 365 | ncks --alphabetize --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 |
---|
[3620] | 366 | |
---|
[3719] | 367 | |
---|
[3620] | 368 | ## |
---|
[3719] | 369 | ## Add some metadata in file headers |
---|
[3620] | 370 | ## =========================================================================== |
---|
| 371 | |
---|
| 372 | UUID=$(uuid) |
---|
| 373 | NCO="$(ncks --version |& tail -1|sed 's/ncks //')" |
---|
| 374 | PYTHON_VER=$( python -i -c "import sys ; print (sys.version.split(' ')[0])" ) |
---|
| 375 | for InFile in *${oce}_to_*${atm}_*.nc *${atm}_to_*${oce}_*.nc ${ATM}_grid_maskFrom_${OCE}.nc ; do |
---|
[3639] | 376 | ncatted --history \ |
---|
[3620] | 377 | --attribute uuid,global,d,, \ |
---|
| 378 | --attribute LongName,global,d,, \ |
---|
| 379 | --attribute nco_openmp_thread_number,global,d,, \ |
---|
| 380 | --attribute Conventions,global,o,c,"CF-1.6" \ |
---|
| 381 | --attribute source,global,o,c,"IPSL Earth system model" \ |
---|
| 382 | --attribute group,global,o,c,"ICMC IPSL Climate Modelling Center" \ |
---|
| 383 | --attribute Institution,global,o,c,"IPSL https://www.ipsl.fr" \ |
---|
| 384 | --attribute Ocean,global,o,c,"${OCE} https://www.nemo-ocean.eu" \ |
---|
| 385 | --attribute Atmosphere,global,o,c,"${ATM} http://lmdz.lmd.jussieu.fr" \ |
---|
| 386 | --attribute production,global,o,c,"$(finger ${LOGNAME} | head -1 | awk '{print $4, $5}') " \ |
---|
| 387 | --attribute originalFiles,global,o,c,"${OCE}_coordinates_mask.nc ${ATM}_grid_mask.nc" \ |
---|
| 388 | --attribute associatedFiles,global,o,c,"grids_${OCE}x${ATM}.nc areas_${OCE}x${ATM}.nc masks_${OCE}x${ATM}.nc" \ |
---|
| 389 | --attribute directory,global,o,c,"$(pwd)" \ |
---|
| 390 | --attribute description,global,o,c,"Fields needed by OASIS-MCT" \ |
---|
| 391 | --attribute title,global,o,c,"${InFile}.nc" \ |
---|
| 392 | --attribute Program,global,o,c,"Generated by ${PROGRAM}" \ |
---|
| 393 | --attribute timeStamp,global,o,c,"$(date)" \ |
---|
| 394 | --attribute uuid,global,o,c,"${UUID}" \ |
---|
| 395 | --attribute HOSTNAME,global,o,c,"$(hostname)" \ |
---|
| 396 | --attribute LOGNAME,global,o,c,"$(whoami)" \ |
---|
| 397 | --attribute NCO,global,o,c,"NCO netCDF Operator ${NCO} http://nco.sourceforge.net" \ |
---|
| 398 | --attribute Python,global,o,c,"Python version ${PYTHON_VER}" \ |
---|
| 399 | --attribute OS,global,o,c,"$(uname -o)" \ |
---|
| 400 | --attribute release,global,o,c,"$(uname -r)" \ |
---|
| 401 | --attribute hardware,global,o,c,"$(uname -i)" \ |
---|
| 402 | --attribute directory,global,o,c,"$(pwd)" \ |
---|
[3624] | 403 | --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" \ |
---|
[3620] | 404 | --attribute Comment,global,o,c,"Preliminary attempt - Do not trust !" \ |
---|
[3665] | 405 | --attribute SVN_Author,global,o,c,"$Author$" \ |
---|
| 406 | --attribute SVN_Date,global,o,c,"$Date$" \ |
---|
| 407 | --attribute SVN_Revision,global,o,c,"$Revision$" \ |
---|
| 408 | --attribute SVN_Id,global,o,c,"$Id$" \ |
---|
[3620] | 409 | ${InFile} |
---|
| 410 | done |
---|
| 411 | |
---|
| 412 | |
---|
| 413 | ## |
---|
| 414 | ## Update and complete weights file to fit OASIS requested format |
---|
| 415 | ## =========================================================================== |
---|
| 416 | cat <<EOF > add_dim.nco |
---|
| 417 | defdim("num_wgts",1) ; |
---|
| 418 | weight[n_weight, num_wgts] = weight ; |
---|
| 419 | EOF |
---|
| 420 | |
---|
[3719] | 421 | for rmpFile in rmp_*.nc ; do |
---|
| 422 | mv ${rmpFile} xios_${rmpFile} |
---|
| 423 | ncap2 --fl_fmt=${FL_FMT} --history --script-file add_dim.nco xios_${rmpFile} ${rmpFile} |
---|
[3620] | 424 | |
---|
[3719] | 425 | ncrename --history --dimension n_weight,num_links ${rmpFile} |
---|
| 426 | ncrename --history --variable src_idx,src_address ${rmpFile} |
---|
| 427 | ncrename --history --variable dst_idx,dst_address ${rmpFile} |
---|
| 428 | ncrename --history --variable weight,remap_matrix ${rmpFile} |
---|
| 429 | case ${rmpFile} in |
---|
| 430 | ( *_1storder_*.nc ) ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" ${rmpFile} ;; |
---|
| 431 | ( *_2ndorder_*.nc ) ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 2nd order" ${rmpFile} ;; |
---|
[3620] | 432 | esac |
---|
[3719] | 433 | case ${rmpFile} in |
---|
| 434 | ( *_true.nc ) ncatted --history --attribute map_method,global,o,c,"Normalization: true" ${rmpFile} ;; |
---|
| 435 | ( *_false.nc ) ncatted --history --attribute map_method,global,o,c,"Normalization: false" ${rmpFile} ;; |
---|
| 436 | esac |
---|
| 437 | ncatted --history --attribute conventions,global,o,c,"SCRIP" ${rmpFile} |
---|
| 438 | ncatted --history --attribute normalization,global,o,c,"none" ${rmpFile} |
---|
[3620] | 439 | |
---|
[3719] | 440 | case ${rmpFile} in |
---|
[3620] | 441 | ( rmp_*${oce}_to_t${atm}_* ) |
---|
[3639] | 442 | ncatted --history \ |
---|
[3620] | 443 | --attribute title,global,o,c,"Weights ${OCE} to ${ATM}" \ |
---|
| 444 | --attribute source_grid,global,o,c,"${oce_domain_type}" \ |
---|
| 445 | --attribute dest_grid,global,o,c,"${atm_domain_type}" \ |
---|
[3719] | 446 | ${rmpFile} |
---|
[3620] | 447 | ;; |
---|
| 448 | ( rmp_*${atm}_to_*${oce}_* ) |
---|
[3639] | 449 | ncatted --history \ |
---|
[3620] | 450 | --attribute title,global,o,c,"Weights ${ATM} to ${OCE}" \ |
---|
| 451 | --attribute source_grid,global,o,c,"${atm_domain_type}" \ |
---|
| 452 | --attribute dest_grid,global,o,c,"${oce_domain_type}" \ |
---|
[3719] | 453 | ${rmpFile} |
---|
[3620] | 454 | ;; |
---|
| 455 | esac |
---|
| 456 | done |
---|
| 457 | |
---|
| 458 | ## |
---|
[3639] | 459 | ## Add missing variables in rmp files |
---|
| 460 | ## =========================================================================== |
---|
[3719] | 461 | for rmpFile in rmp_* ; do |
---|
| 462 | a_to_o=false ; o_to_a=false |
---|
| 463 | case ${rmpFile} in |
---|
| 464 | ( rmp_?${oce}_to_?${atm}_*.nc ) o_to_a=true ;; |
---|
| 465 | ( rmp_?${atm}_to_?${oce}_*.nc ) a_to_o=true ;; |
---|
| 466 | esac |
---|
| 467 | |
---|
| 468 | for Grid in t u v c ; do # Identify grids |
---|
| 469 | case ${rmpFile} in |
---|
| 470 | ( rmp_${Grid}${oce}_to_?${atm}_*.nc ) ogrid=${Grid} ;; |
---|
| 471 | ( rmp_?${oce}_to_${Grid}${atm}_*.nc ) agrid=${Grid} ;; |
---|
| 472 | ( rmp_${Grid}${atm}_to_?${oce}_*.nc ) agrid=${Grid} ;; |
---|
| 473 | ( rmp_?${atm}_to_${Grid}${oce}_*.nc ) ogrid=${Grid} ;; |
---|
| 474 | esac |
---|
| 475 | done |
---|
| 476 | OGRID=${ogrid^} |
---|
| 477 | AGRID=${agrid^} |
---|
[3639] | 478 | |
---|
[3719] | 479 | cat <<EOF >add_varoce.nco |
---|
[3639] | 480 | defdim ("src_grid_size" , \$x_grid_${OGRID}.size*\$y_grid_${OGRID}.size) ; |
---|
| 481 | defdim ("src_grid_corners", 4) ; |
---|
| 482 | defdim ("src_grid_rank" , 2) ; |
---|
| 483 | // |
---|
| 484 | src_grid_dims[src_grid_rank] = { \$y_grid_${OGRID}.size, \$x_grid_${OGRID}.size } ; |
---|
| 485 | // |
---|
| 486 | src_grid_center_lat [src_grid_size] = 0.0d ; |
---|
| 487 | src_grid_center_lon [src_grid_size] = 0.0d ; |
---|
| 488 | src_grid_center_lat (:) = nav_lat_grid_${OGRID}(:,:) ; |
---|
| 489 | src_grid_center_lon (:) = nav_lon_grid_${OGRID}(:,:) ; |
---|
| 490 | // |
---|
| 491 | src_grid_corner_lat [src_grid_size, src_grid_corners] = 0.0d ; |
---|
| 492 | src_grid_corner_lon [src_grid_size, src_grid_corners] = 0.0d ; |
---|
| 493 | src_grid_corner_lat(:,:) = bounds_lat_grid_${OGRID}(:,:,:) ; |
---|
| 494 | src_grid_corner_lon(:,:) = bounds_lon_grid_${OGRID}(:,:,:) ; |
---|
| 495 | // |
---|
| 496 | src_grid_imask [src_grid_size] = 0 ; |
---|
| 497 | src_grid_area [src_grid_size] = 0.0d ; |
---|
| 498 | src_grid_frac [src_grid_size] = 1.0d ; |
---|
| 499 | src_grid_imask (:) = 1 - mask_${OGRID}(:,:) ; |
---|
| 500 | src_grid_imask.int() ; |
---|
| 501 | src_grid_area (:) = area_grid_${OGRID}(:,:) ; |
---|
| 502 | EOF |
---|
| 503 | |
---|
[3719] | 504 | [[ ${o_to_a} = true ]] && ncap2 --history --append --script-file add_varoce.nco oce_grid.nc ${rmpFile} |
---|
| 505 | sed --in-place "s/src_/dst_/g" add_varoce.nco |
---|
| 506 | [[ ${a_to_o} = true ]] && ncap2 --history --append --script-file add_varoce.nco oce_grid.nc ${rmpFile} |
---|
| 507 | |
---|
| 508 | if [[ ${atm} = ico ]] ; then |
---|
| 509 | cat <<EOF >add_varatm.nco |
---|
[3639] | 510 | defdim ("dst_grid_size" , \$cell.size) ; |
---|
| 511 | defdim ("dst_grid_corners", 6) ; |
---|
| 512 | defdim ("dst_grid_rank" , 2) ; |
---|
| 513 | // |
---|
| 514 | dst_grid_dims[dst_grid_rank] = { \$cell.size, 1 } ; |
---|
| 515 | // |
---|
| 516 | dst_grid_center_lat [dst_grid_size] = 0.0d ; |
---|
| 517 | dst_grid_center_lon [dst_grid_size] = 0.0d ; |
---|
| 518 | dst_grid_center_lat (:) = lat(:) ; |
---|
| 519 | dst_grid_center_lon (:) = lon(:) ; |
---|
| 520 | // |
---|
| 521 | dst_grid_corner_lat [dst_grid_size, dst_grid_corners] = 0.0d ; |
---|
| 522 | dst_grid_corner_lon [dst_grid_size, dst_grid_corners] = 0.0d ; |
---|
| 523 | dst_grid_corner_lat(:,:) = bounds_lat(:,:) ; |
---|
| 524 | dst_grid_corner_lon(:,:) = bounds_lon(:,:) ; |
---|
| 525 | // |
---|
| 526 | dst_grid_imask [dst_grid_size] = 0 ; |
---|
| 527 | dst_grid_area [dst_grid_size] = 0.0d ; |
---|
| 528 | dst_grid_frac [dst_grid_size] = 1.0d ; |
---|
| 529 | dst_grid_imask (:) = 1 - OceMask(0,:) ; |
---|
| 530 | dst_grid_imask.int() ; |
---|
| 531 | dst_grid_area (:) = aire(:) ; |
---|
| 532 | EOF |
---|
[3719] | 533 | if [[ ${o_to_a} = true ]] ; then |
---|
| 534 | ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} |
---|
| 535 | 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 |
---|
| 536 | mv rmp_tmp.nc ${rmpFile} |
---|
| 537 | fi |
---|
[3718] | 538 | |
---|
[3719] | 539 | sed --in-place "s/dst_/src_/g" add_varatm.nco |
---|
| 540 | if [[ ${a_to_o} = true ]] ; then |
---|
| 541 | ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} |
---|
| 542 | 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 |
---|
| 543 | mv rmp_tmp.nc ${rmpFile} |
---|
| 544 | fi |
---|
| 545 | fi |
---|
| 546 | if [[ ${atm} = lmd ]] ; then |
---|
| 547 | cat <<EOF >add_varatm.nco |
---|
[3639] | 548 | defdim ("dst_grid_size" , \$lon.size*\$lat.size) ; |
---|
| 549 | defdim ("dst_grid_corners", 4) ; |
---|
| 550 | defdim ("dst_grid_rank" , 2) ; |
---|
| 551 | // |
---|
| 552 | dst_grid_dims[dst_grid_rank] = { \$lat.size, \$lon.size } ; |
---|
| 553 | // |
---|
| 554 | dst_grid_center_lat [dst_grid_size] = 0.0d ; |
---|
| 555 | dst_grid_center_lon [dst_grid_size] = 0.0d ; |
---|
| 556 | lat0lon[lat,lon] = lat(:)+0*lon(:) ; |
---|
| 557 | lon0lat[lat,lon] = lon(:)+0*lat(:) ; |
---|
| 558 | dst_grid_center_lat (:) = lat0lon(:,:) ; |
---|
| 559 | dst_grid_center_lon (:) = lon0lat(:,:) ; |
---|
| 560 | // |
---|
| 561 | //dst_grid_corner_lat [dst_grid_size, dst_grid_corners] = 0.0d ; // Not available for LMDZ lon/lat grid |
---|
| 562 | //dst_grid_corner_lon [dst_grid_size, dst_grid_corners] = 0.0d ; |
---|
| 563 | //dst_grid_corner_lat(:,:) = bounds_lat(:,:) ; |
---|
| 564 | //dst_grid_corner_lon(:,:) = bounds_lon(:,:) ; |
---|
| 565 | // |
---|
| 566 | dst_grid_imask [dst_grid_size] = 0 ; |
---|
| 567 | dst_grid_area [dst_grid_size] = 0.0d ; |
---|
| 568 | dst_grid_frac [dst_grid_size] = 1.0d ; |
---|
| 569 | dst_grid_imask (:) = 1 - OceMask(0,:,:) ; |
---|
| 570 | dst_grid_imask.int() ; |
---|
| 571 | dst_grid_area (:) = aire(:,:) ; |
---|
| 572 | dst_grid_frac (:) = OceFrac(0,:,:) ; |
---|
| 573 | EOF |
---|
[3719] | 574 | if [[ ${o_to_a} = true ]] ; then |
---|
| 575 | ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} |
---|
| 576 | 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 |
---|
| 577 | mv rmp_tmp.nc ${rmpFile} |
---|
| 578 | fi |
---|
| 579 | |
---|
| 580 | sed --in-place "s/dst/src/g" add_varatm.nco |
---|
| 581 | if [[ ${a_to_o} = true ]] ; then |
---|
| 582 | ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} |
---|
| 583 | 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 |
---|
| 584 | mv rmp_tmp.nc ${rmpFile} |
---|
| 585 | fi |
---|
| 586 | fi |
---|
[3639] | 587 | done |
---|
| 588 | |
---|
| 589 | ## |
---|
[3620] | 590 | ## Save results |
---|
| 591 | ## =========================================================================== |
---|
| 592 | cp ${ATM}_grid_maskFrom_${OCE}.nc ${SUBMIT_DIR} |
---|
[3719] | 593 | for File in dia_*.nc rmp_*.nc |
---|
[3620] | 594 | do |
---|
[3719] | 595 | NewFile=$(echo ${File} | sed -e "s/${atm}/${ATM}/" -e "s/${oce}/${OCE}/" ) |
---|
| 596 | cp ${File} ${SUBMIT_DIR}/${NewFile} |
---|
[3620] | 597 | done |
---|
| 598 | |
---|
| 599 | ## |
---|
| 600 | ## Creates and save auxiliary files for OASIS |
---|
| 601 | ## =========================================================================== |
---|
| 602 | bash ${SUBMIT_DIR}/CreateOasisGrids.bash --oce ${OCE} --atm ${ATM} |
---|
| 603 | |
---|
| 604 | cp areas_${OCE}x${ATM}.nc ${SUBMIT_DIR} |
---|
| 605 | cp grids_${OCE}x${ATM}.nc ${SUBMIT_DIR} |
---|
| 606 | cp masks_${OCE}x${ATM}.nc ${SUBMIT_DIR} |
---|
| 607 | |
---|
| 608 | |
---|
| 609 | ## =========================================================================== |
---|
| 610 | ## |
---|
| 611 | ## That's all folk's !!! |
---|
| 612 | ## |
---|
| 613 | ## =========================================================================== |
---|
| 614 | |
---|