Changeset 3719
- Timestamp:
- 03/29/18 14:46:17 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/MOSAIX/CreateWeightsMask.bash
r3718 r3719 1 1 #!/bin/bash 2 #MSUB -r WeightsMask # nom de la requete3 #MSUB -o Out_WeightsMask # nom du fichier de sortie4 #MSUB -e Out_WeightsMask # nom du fichier de sortie2 #MSUB -r WeightsMask # Job name 3 #MSUB -o Out_WeightsMask # Standard output 4 #MSUB -e Out_WeightsMask # Error output 5 5 #MSUB -eo 6 #MSUB -n 4 # Reservation des processeurs pour le job7 #MSUB -T 1800 # Limite temps (en secondes)6 #MSUB -n 4 # Number of processors 7 #MSUB -T 1800 # Time limit (seconds) 8 8 #MSUB -q standard 9 9 #MSUB -Q test … … 12 12 ### =========================================================================== 13 13 ### 14 ### Creates interpolation weights between ORCA and atmospher grids.14 ### Creates interpolation weights between ORCA and atmosphere grids. 15 15 ### Interpolates ORCA mask to atmosphere grid. 16 16 ### Weight files are at OASIS-MCT format. … … 58 58 # =========================== 59 59 ListOCEGRID="T U V" 60 Listorder="1st" # " 2nd 60 ListOrder="1st" # " 2nd 61 ListNormalize="false true" 61 62 62 63 ## =========================================================================== … … 99 100 # Suffixes 100 101 # --------------------------------------------------------------------------- 101 Listocegrid=${ListOCEGRID ~}102 Listocegrid=${ListOCEGRID,,} 102 103 103 104 case ${OCE} in … … 135 136 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type} 136 137 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 137 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 138 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 138 139 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}" 139 140 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} … … 142 143 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type} 143 144 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type} 144 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 .nc145 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 145 146 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 146 147 cp iodef.xml iodef_t${oce}_to_t${atm}_1storder.xml 147 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t false 148 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v false 149 150 cp iodef.xml iodef_t${oce}_to_t${atm}_1storder_false.xml 148 151 149 152 time /usr/bin/time ccc_mprun ./interpol.exe --mask_src=yes --mask_dst=no … … 160 163 where (OceFrac < 0.0 ) OceFrac=0.0 ; 161 164 EOF 162 ncap2 --history --overwrite --script-file correction_masque.nco dia_t${oce}_to_t${atm}_1storder .nc tmp_dia_t${oce}_to_t${atm}_1storder.nc ; mv tmp_dia_t${oce}_to_t${atm}_1storder.nc dia_t${oce}_to_t${atm}_1storder.nc163 ncatted --history -a missing_value,OceFrac,d,,"" -a _FillValue,OceFrac,d,,"" dia_t${oce}_to_t${atm}_1storder .nc165 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 166 ncatted --history -a missing_value,OceFrac,d,,"" -a _FillValue,OceFrac,d,,"" dia_t${oce}_to_t${atm}_1storder_false.nc 164 167 165 168 ## 166 169 ## Creates mask on ATM grid 167 170 ## =========================================================================== 168 cp dia_t${oce}_to_t${atm}_1storder .nc dia_t${oce}_to_t${atm}_1storder_mask.nc169 ncks --alphabetize --history --overwrite --variable OceFrac dia_t${oce}_to_t${atm}_1storder_ mask.nc ${ATM}_grid_maskFrom_${OCE}.nc170 ncks --alphabetize --history --append --variable aire atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc171 [[ ${atm} = *ico* ]] && ncks --alphabetize --history --append --variable bounds_lon,bounds_lat atm_grid.nc 171 cp dia_t${oce}_to_t${atm}_1storder_false.nc dia_t${oce}_to_t${atm}_1storder_false_mask.nc 172 ncks --alphabetize --history --overwrite --variable OceFrac dia_t${oce}_to_t${atm}_1storder_false_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc 173 ncks --alphabetize --history --append --variable aire atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc 174 [[ ${atm} = *ico* ]] && ncks --alphabetize --history --append --variable bounds_lon,bounds_lat atm_grid.nc ${ATM}_grid_maskFrom_${OCE}.nc 172 175 173 176 cat <<EOF > creation_masque.nco … … 175 178 where (OceFrac <= 0.0 ) OceFrac=0 ; 176 179 EOF 177 ncap2 --history --overwrite --script-file creation_masque.nco dia_t${oce}_to_t${atm}_1storder_mask.nc tmp_dia_t${oce}_to_t${atm}_1storder_mask.nc ; mv tmp_dia_t${oce}_to_t${atm}_1storder_mask.nc dia_t${oce}_to_t${atm}_1storder_mask.nc 178 ncrename --history --variable OceFrac,OceMask dia_t${oce}_to_t${atm}_1storder_mask.nc 179 180 ncks --alphabetize --history --append --variable OceMask dia_t${oce}_to_t${atm}_1storder_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc 181 182 ## 183 ## Create mask of coastal ATM point 180 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 181 ncrename --history --variable OceFrac,OceMask dia_t${oce}_to_t${atm}_1storder_false_mask.nc 182 183 ncks --alphabetize --history --append --variable OceMask dia_t${oce}_to_t${atm}_1storder_false_mask.nc ${ATM}_grid_maskFrom_${OCE}.nc 184 #rm dia_t${oce}_to_t${atm}_1storder_false_mask.nc 185 186 ## 187 ## Creates mask of coastal ATM point 184 188 ## =========================================================================== 185 189 cat <<EOF > coastal.nco … … 194 198 ## NEMO, other case, towards ATM 195 199 ## =========================================================================== 196 for order in ${List order} ; do200 for order in ${ListOrder} ; do 197 201 case ${order} in 198 202 ( 1st ) num_order=1 ;; 199 203 ( 2nd ) num_order=2 ;; 200 204 esac 201 202 for OCEGRID in ${ListOCEGRID} ; do 203 ocegrid=${OCEGRID~} 204 205 if [[ !( ${order} = 1st && ${OCEGRID} = T ) ]] ; then 206 207 echo ${Green}"${OCE} ${OCEGRID} toward ${ATM} - ${order}order"${Norm} 208 209 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} 210 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type} 211 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type} 212 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} 213 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 214 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}" 215 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} 216 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} 217 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${num_order} 218 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type} 219 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type} 220 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} 221 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.nc 222 cp iodef.xml iodef_${ocegrid}${oce}_t${atm}_${order}order.xml 205 for normalize in ${ListNormalize} ; do 206 for OCEGRID in ${ListOCEGRID} ; do 207 ocegrid=${OCEGRID,,} 223 208 224 time /usr/bin/time ccc_mprun ./interpol.exe --mask_src=yes --mask_dst=yes 225 fi 226 209 if [[ ! -f rmp_${ocegrid}${oce}_to_t${atm}_${order}order_${normalize}.nc ]] ; then 210 211 echo ${Green}"${OCE} ${OCEGRID} toward ${ATM} - ${order}order - normalize: ${normalize}"${Norm} 212 213 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} 214 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type} 215 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type} 216 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} 217 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} 218 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}" 219 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} 220 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} 221 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${num_order} 222 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${normalize} 223 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${oce_domain_type} 224 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${atm_domain_type} 225 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} 226 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 227 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${normalize} 228 229 cp iodef.xml iodef_${ocegrid}${oce}_t${atm}_${order}order_${normalize}.xml 230 231 time /usr/bin/time ccc_mprun ./interpol.exe --mask_src=yes --mask_dst=yes 232 fi 233 234 done 227 235 done 228 236 done … … 241 249 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} 242 250 243 for order in ${List order} ; do251 for order in ${ListOrder} ; do 244 252 case ${order} in 245 253 ( 1st ) num_order=1 ;; 246 254 ( 2nd ) num_order=2 ;; 247 255 esac 248 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} 249 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${num_order} 256 for normalize in ${ListNormalize} ; do 257 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} 258 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t ${num_order} 259 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${normalize} 260 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${normalize} 261 262 for OCEGRID in ${ListOCEGRID} ; do 263 ocegrid=${OCEGRID,,} 264 265 echo ${Green}"${ATM} toward ${OCE} ${OCEGRID} - ${order}order - normalize: ${normalize}"${Norm} 266 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} 267 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} 268 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} 269 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 270 cp iodef.xml iodef_t${atm}_to_${ocegrid}${oce}_${order}order_${normalize}.xml 271 272 time /usr/bin/time ccc_mprun ./interpol.exe --mask_src=yes --mask_dst=yes 273 274 done 275 done 276 done 277 278 ## 279 ## ATM towards NEMO points - runoff 280 ## =========================================================================== 281 cp ${SUBMIT_DIR}/iodef_atm_to_oce.xml iodef.xml 282 for normalize in ${ListNormalize} ; do 283 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} 284 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} 285 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}" 286 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} 287 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} 288 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} 289 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} 290 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 291 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t 1 292 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="normalization"]' -t ${normalize} 293 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} 294 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 295 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} 296 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 297 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k renormalize -v ${normalize} 250 298 251 for OCEGRID in ${ListOCEGRID} ; do 252 ocegrid=${OCEGRID~} 253 254 echo ${Green}"${ATM} toward ${OCE} ${OCEGRID} - ${order}order"${Norm} 255 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} 256 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} 257 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 258 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.nc 259 cp iodef.xml iodef_t${atm}_to_${ocegrid}${oce}_${order}order.xml 260 261 time /usr/bin/time ccc_mprun ./interpol.exe --mask_src=yes --mask_dst=yes 262 263 done 264 done 265 266 ## 267 ## ATM towards NEMO points - runoff 268 ## =========================================================================== 269 cp ${SUBMIT_DIR}/iodef_atm_to_oce.xml iodef.xml 270 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} 271 python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} 272 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}" 273 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} 274 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} 275 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]' -k type -v ${atm_domain_type} 276 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]' -k type -v ${oce_domain_type} 277 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1 278 python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]' -t 1 279 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} 280 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 281 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 282 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.nc 283 284 cp iodef.xml iodef_c${atm}_to_t${oce}_1storder.xml 285 286 time /usr/bin/time ccc_mprun ./interpol.exe --mask_src=yes --mask_dst=yes 287 299 cp iodef.xml iodef_c${atm}_to_t${oce}_1storder_${normalize}.xml 300 301 time /usr/bin/time ccc_mprun ./interpol.exe --mask_src=yes --mask_dst=yes 302 done 288 303 ## 289 304 ## Change all NetCDF files to NetCDF 3 format (needed for OASIS) … … 298 313 ## (needed if files need to be read by XIOS) 299 314 ## =========================================================================== 315 #ncatted --history -a coordinates,aire,m,c,"lat lon" ${ATM}_grid_maskFrom_${OCE}.nc 316 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 317 300 318 if [[ ${atm} = ico ]] ; then 301 319 cat <<EOF > add_time.nco 302 defdim("time_counter",1) ; 303 OceFrac [time_counter,cell] = OceFrac (:) ; 304 OceMask [time_counter,cell] = OceMask (:) ; 305 EOF 306 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 307 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 320 OceFrac [time_counter,cell] = OceFrac (:) ; 321 OceMask [time_counter,cell] = OceMask (:) ; 322 AtmCoastal [time_counter,cell] = AtmCoastal (:) ; 323 EOF 324 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 308 325 ncatted --history \ 309 -a coordinates,OceFrac,c,c,"time_counter cell" \ 310 -a coordinates,OceMask,c,c,"time_counter cell" \ 311 -a coordinates,aire,c,c,"time_counter cell" ${ATM}_grid_maskFrom_${OCE}.nc 326 -a coordinates,OceFrac,c,c,"time_counter cell" \ 327 -a coordinates,OceMask,c,c,"time_counter cell" \ 328 -a coordinates,AtmCoastal,c,c,"time_counter cell" \ 329 -a coordinates,aire,c,c,"cell" \ 330 ${ATM}_grid_maskFrom_${OCE}.nc 312 331 fi 313 332 if [[ ${atm} = lmd ]] ; then 314 333 cat <<EOF > add_time.nco 315 defdim("time_counter",1) ; 316 OceFrac [time_counter,lat,lon] = OceFrac (:,:) ; 317 OceMask [time_counter,lat,lon] = OceMask (:,:) ; 318 EOF 319 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 320 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 334 OceFrac [time_counter,lat,lon] = OceFrac (:,:) ; 335 OceMask [time_counter,lat,lon] = OceMask (:,:) ; 336 AtmCoastal [time_counter,lat,lon] = AtmCoastal (:,:) ; 337 EOF 338 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 321 339 ncatted --history \ 322 -a coordinates,OceFrac,c,c,"time_counter lat lon" \ 323 -a coordinates,OceMask,c,c,"time_counter lat lon" \ 324 -a coordinates,aire,c,c,"time_counter lat lon" ${ATM}_grid_maskFrom_${OCE}.nc 340 -a coordinates,OceFrac,c,c,"time_counter lat lon" \ 341 -a coordinates,OceMask,c,c,"time_counter lat lon" \ 342 -a coordinates,AtmCoastal,c,c,"time_counter lat lon" \ 343 -a coordinates,aire,c,c,"lat lon" \ 344 ${ATM}_grid_maskFrom_${OCE}.nc 325 345 fi 326 327 ## 328 ## Add some information in file headers 346 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 347 348 349 ## 350 ## Add some metadata in file headers 329 351 ## =========================================================================== 330 352 … … 378 400 EOF 379 401 380 for file in rmp_*${oce}_to_*${atm}_*.nc rmp_*${atm}_to_*${oce}_*.nc ; do381 mv ${ file} xios_${file}382 ncap2 --fl_fmt=${FL_FMT} --history --script-file add_dim.nco xios_${ file} ${file}402 for rmpFile in rmp_*.nc ; do 403 mv ${rmpFile} xios_${rmpFile} 404 ncap2 --fl_fmt=${FL_FMT} --history --script-file add_dim.nco xios_${rmpFile} ${rmpFile} 383 405 384 ncrename --history --dimension n_weight,num_links ${ file}385 ncrename --history --variable src_idx,src_address ${ file}386 ncrename --history --variable dst_idx,dst_address ${ file}387 ncrename --history --variable weight,remap_matrix ${ file}388 case ${ file} in389 ( * 1storder.nc ) ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" ${file} ;;390 ( * 2ndorder.nc ) ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 2nd order" ${file} ;;406 ncrename --history --dimension n_weight,num_links ${rmpFile} 407 ncrename --history --variable src_idx,src_address ${rmpFile} 408 ncrename --history --variable dst_idx,dst_address ${rmpFile} 409 ncrename --history --variable weight,remap_matrix ${rmpFile} 410 case ${rmpFile} in 411 ( *_1storder_*.nc ) ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 1st order" ${rmpFile} ;; 412 ( *_2ndorder_*.nc ) ncatted --history --attribute map_method,global,o,c,"Conservative Remapping - 2nd order" ${rmpFile} ;; 391 413 esac 392 ncatted --history --attribute conventions,global,o,c,"SCRIP" ${file} 393 ncatted --history --attribute normalization,global,o,c,"none" ${file} 414 case ${rmpFile} in 415 ( *_true.nc ) ncatted --history --attribute map_method,global,o,c,"Normalization: true" ${rmpFile} ;; 416 ( *_false.nc ) ncatted --history --attribute map_method,global,o,c,"Normalization: false" ${rmpFile} ;; 417 esac 418 ncatted --history --attribute conventions,global,o,c,"SCRIP" ${rmpFile} 419 ncatted --history --attribute normalization,global,o,c,"none" ${rmpFile} 394 420 395 case ${ file} in421 case ${rmpFile} in 396 422 ( rmp_*${oce}_to_t${atm}_* ) 397 423 ncatted --history \ … … 399 425 --attribute source_grid,global,o,c,"${oce_domain_type}" \ 400 426 --attribute dest_grid,global,o,c,"${atm_domain_type}" \ 401 ${ file}427 ${rmpFile} 402 428 ;; 403 429 ( rmp_*${atm}_to_*${oce}_* ) … … 406 432 --attribute source_grid,global,o,c,"${atm_domain_type}" \ 407 433 --attribute dest_grid,global,o,c,"${oce_domain_type}" \ 408 ${ file}434 ${rmpFile} 409 435 ;; 410 436 esac … … 414 440 ## Add missing variables in rmp files 415 441 ## =========================================================================== 416 for OGRID in ${ListOCEGRID} ; do 417 for AGRID in T C ; do 418 for order in ${Listorder} ; do 419 ogrid=${OGRID~} 420 agrid=${AGRID~} 442 for rmpFile in rmp_* ; do 443 a_to_o=false ; o_to_a=false 444 case ${rmpFile} in 445 ( rmp_?${oce}_to_?${atm}_*.nc ) o_to_a=true ;; 446 ( rmp_?${atm}_to_?${oce}_*.nc ) a_to_o=true ;; 447 esac 448 449 for Grid in t u v c ; do # Identify grids 450 case ${rmpFile} in 451 ( rmp_${Grid}${oce}_to_?${atm}_*.nc ) ogrid=${Grid} ;; 452 ( rmp_?${oce}_to_${Grid}${atm}_*.nc ) agrid=${Grid} ;; 453 ( rmp_${Grid}${atm}_to_?${oce}_*.nc ) agrid=${Grid} ;; 454 ( rmp_?${atm}_to_${Grid}${oce}_*.nc ) ogrid=${Grid} ;; 455 esac 456 done 457 OGRID=${ogrid^} 458 AGRID=${agrid^} 421 459 422 file_o_to_a=rmp_${ogrid}${oce}_to_${agrid}${atm}_${order}order.nc 423 file_a_to_o=rmp_${agrid}${atm}_to_${ogrid}${oce}_${order}order.nc 424 425 cat <<EOF >add_varoce.nco 460 cat <<EOF >add_varoce.nco 426 461 defdim ("src_grid_size" , \$x_grid_${OGRID}.size*\$y_grid_${OGRID}.size) ; 427 462 defdim ("src_grid_corners", 4) ; … … 448 483 EOF 449 484 450 [[ -f ${file_o_to_a} ]] && ncap2 --history --append --script-file add_varoce.nco oce_grid.nc ${file_o_to_a}451 452 [[ -f ${file_a_to_o} ]] && ncap2 --history --append --script-file add_varoce.nco oce_grid.nc ${file_a_to_o}453 454 455 485 [[ ${o_to_a} = true ]] && ncap2 --history --append --script-file add_varoce.nco oce_grid.nc ${rmpFile} 486 sed --in-place "s/src_/dst_/g" add_varoce.nco 487 [[ ${a_to_o} = true ]] && ncap2 --history --append --script-file add_varoce.nco oce_grid.nc ${rmpFile} 488 489 if [[ ${atm} = ico ]] ; then 490 cat <<EOF >add_varatm.nco 456 491 defdim ("dst_grid_size" , \$cell.size) ; 457 492 defdim ("dst_grid_corners", 6) ; … … 477 512 dst_grid_area (:) = aire(:) ; 478 513 EOF 479 if [[ -f ${file_o_to_a}]] ; then480 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_o_to_a}481 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 ${file_o_to_a} rmp_tmp.nc482 mv rmp_tmp.nc ${file_o_to_a}483 514 if [[ ${o_to_a} = true ]] ; then 515 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} 516 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 517 mv rmp_tmp.nc ${rmpFile} 518 fi 484 519 485 486 if [[ -f ${file_a_to_o}]] ; then487 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_a_to_o}488 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 ${file_a_to_o} rmp_tmp.nc489 mv rmp_tmp.nc ${file_a_to_o}490 491 492 493 520 sed --in-place "s/dst_/src_/g" add_varatm.nco 521 if [[ ${a_to_o} = true ]] ; then 522 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} 523 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 524 mv rmp_tmp.nc ${rmpFile} 525 fi 526 fi 527 if [[ ${atm} = lmd ]] ; then 528 cat <<EOF >add_varatm.nco 494 529 defdim ("dst_grid_size" , \$lon.size*\$lat.size) ; 495 530 defdim ("dst_grid_corners", 4) ; … … 518 553 dst_grid_frac (:) = OceFrac(0,:,:) ; 519 554 EOF 520 if [[ -f ${file_o_to_a} ]] ; then 521 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_o_to_a} 522 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 ${file_o_to_a} rmp_tmp.nc 523 mv rmp_tmp.nc ${file_o_to_a} 524 fi 525 526 sed --in-place "s/dst/src/g" add_varatm.nco 527 if [[ -f ${file_a_to_o} ]] ; then 528 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_a_to_o} 529 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 ${file_a_to_o} rmp_tmp.nc 530 mv rmp_tmp.nc ${file_a_to_o} 531 fi 532 fi 533 done 534 done 555 if [[ ${o_to_a} = true ]] ; then 556 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} 557 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 558 mv rmp_tmp.nc ${rmpFile} 559 fi 560 561 sed --in-place "s/dst/src/g" add_varatm.nco 562 if [[ ${a_to_o} = true ]] ; then 563 ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${rmpFile} 564 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 565 mv rmp_tmp.nc ${rmpFile} 566 fi 567 fi 535 568 done 536 569 … … 539 572 ## =========================================================================== 540 573 cp ${ATM}_grid_maskFrom_${OCE}.nc ${SUBMIT_DIR} 541 542 cp rmp_c${atm}_to_t${oce}_${order}order.nc ${SUBMIT_DIR}/rmp_c${ATM}_to_t${OCE}_1storder.nc 543 cp dia_c${atm}_to_t${oce}_${order}order.nc ${SUBMIT_DIR}/dia_c${ATM}_to_t${OCE}_1storder.nc 544 545 for order in ${Listorder} 574 for File in dia_*.nc rmp_*.nc 546 575 do 547 cp dia_t${oce}_to_t${atm}_${order}order.nc ${SUBMIT_DIR}/dia_t${OCE}_to_t${ATM}_${order}order.nc 548 cp rmp_t${oce}_to_t${atm}_${order}order.nc ${SUBMIT_DIR}/rmp_t${OCE}_to_t${ATM}_${order}order.nc 549 550 for grid in ${Listocegrid} ; do 551 cp rmp_t${atm}_to_${grid}${oce}_${order}order.nc ${SUBMIT_DIR}/rmp_t${ATM}_to_${grid}${OCE}_${order}order.nc 552 cp dia_t${atm}_to_${grid}${oce}_${order}order.nc ${SUBMIT_DIR}/dia_t${ATM}_to_${grid}${OCE}_${order}order.nc 553 done 576 NewFile=$(echo ${File} | sed -e "s/${atm}/${ATM}/" -e "s/${oce}/${OCE}/" ) 577 cp ${File} ${SUBMIT_DIR}/${NewFile} 554 578 done 555 579
Note: See TracChangeset
for help on using the changeset viewer.