source: TOOLS/MOSAIX/CreateWeightsMask.bash @ 3630

Last change on this file since 3630 was 3630, checked in by omamce, 3 years ago

O.M. : add HeadURL property

  • Property svn:executable set to *
  • Property svn:keywords set to HeadURL
File size: 20.9 KB
Line 
1#!/bin/bash
2#MSUB -r WeightsMask        # nom de la requete
3#MSUB -o Out_WeightsMask    # nom du fichier de sortie
4#MSUB -e Out_WeightsMask    # nom du fichier de sortie
5#MSUB -eo
6#MSUB -n 4              # Reservation des processeurs pour le job
7#MSUB -T 1800           # Limite temps (en secondes)
8#MSUB -q standard
9#MSUB -Q test
10#MSUB -p devcmip6
11
12### ===========================================================================
13###
14### Creates interpolation weights between ORCA and atmospher grids.
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
19###
20### Documentation : https://forge.ipsl.jussieu.fr/igcmg/wiki/IPSLCM6/MOSAIX
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##
32## SVN information
33#  $Author: omamce $
34#  $Date: 2018-03-12 11:17:59 +0100 (Mon, 12 Mar 2018) $
35#  $Revision: 3625 $
36#  $Id: CreateWeightsMask.bash 3625 2018-03-12 10:17:59Z omamce $
37#  $Log: $
38
39##
40## Configuration
41## ===========================================================================
42
43#
44# Defines models
45# ==============
46OCE=ORCA2.3
47#OCE=eORCA1.2
48#OCE=ORCA025
49
50ATM=ICO30
51#ATM=ICO40
52#ATM=ICO450
53#ATM=LMD9695
54#ATM=LMD144X142
55
56#
57# Defines OCE grids to handle
58# ===========================
59ListOCEGRID="T U V"
60Listorder="1st" # " 2nd
61
62## ===========================================================================
63##
64## You should not change anything below this line ....
65##
66## ===========================================================================
67SUBMIT_DIR=$(pwd)
68
69#
70# Defines computer
71# ================
72if [[ $(hostname) = curie* ]] ; then arch=curie ; center=tgcc ; fi
73if [[ $(hostname) = irene* ]] ; then arch=irene ; center=tgcc ; fi
74PROGRAM=$(basename ${0})
75
76case ${arch} in
77    ( curie | irene )
78    set +vx
79    module unload cdo nco ferret
80    module unload netcdf hdf5
81    module load python # /2.7.12
82    module load netcdf/4.3.3.1_hdf5_parallel # Version for XIOS
83    module load nco
84    R_IN=$(ccc_home -u igcmg --cccwork)/IGCM
85    TMPDIR=${SCRATCHDIR}/TMP
86    SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}}
87    PROGRAM=${BRIDGE_MSUB_REQNAME}
88    ;;
89    ( * )
90    exit -1
91    ;;
92esac
93
94set -x ; set -e
95
96mkdir -p ${TMPDIR}/${OCE}x${ATM} || exit 1
97cd       ${TMPDIR}/${OCE}x${ATM} || exit 1
98rm -f *
99
100#
101# Suffixes
102# ---------------------------------------------------------------------------
103Listocegrid=${ListOCEGRID~}
104
105case ${OCE} in
106    ( *ORC* )         oce=orc ; oce_domain_type=curvilinear   ;;
107esac
108case ${ATM} in
109    ( *dynamico*    ) atm=ico ; atm_domain_type=unstructured  ;;
110    ( *ICO*         ) atm=ico ; atm_domain_type=unstructured  ;;
111    ( *lmd* | *LMD* ) atm=lmd ; atm_domain_type=rectilinear   ;;
112esac
113
114#
115# Format for OASIS files : should be NetCDF3 classic or NetCDF3 64 bits
116# ---------------------------------------------------------------------------
117FL_FMT=64bit
118
119
120cp ${SUBMIT_DIR}/bin/interpol.exe                 .
121cp ${SUBMIT_DIR}/update_xml.py                    .
122
123##
124## NEMO T point towards ATM - 1st order
125## ===========================================================================
126cp ${R_IN}/OCE/NEMO/${OCE}/${OCE}_coordinates_mask.nc  .
127cp ${R_IN}/ATM/${ATM}/${ATM}_grid.nc .
128
129ln -s ${OCE}_coordinates_mask.nc  oce_grid.nc
130ln -s ${ATM}_grid.nc              atm_grid.nc
131
132echo ${Green}"${OCE} T toward ${ATM} - 1storder"${Norm}
133cp ${SUBMIT_DIR}/iodef_oce_to_atm.xml   iodef.xml
134
135python 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
136python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]'                   -k type  -v ${oce_domain_type}
137python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]'                   -k type  -v ${atm_domain_type}
138python 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
139python 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
140python 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}"
141python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${oce_domain_type}
142python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]'   -t ${atm_domain_type}
143python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]'       -t 1
144python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]'                    -k type  -v ${oce_domain_type}
145python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]'                    -k type  -v ${atm_domain_type}
146python 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.nc
147python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v 1
148
149cp iodef.xml iodef_t${oce}_to_t${atm}_1storder.xml
150
151time /usr/bin/time ccc_mprun ./interpol.exe --mask_src=yes --mask_dst=no
152
153##
154## Correct spurious values (extremes)
155## ===========================================================================
156cat <<EOF > correction_masque.nco
157where (OceFrac <   0.00001 )  OceFrac=OceFrac.get_miss() ;
158where (OceFrac >   0.99999 )  OceFrac=1.0 ;
159OceFrac.delete_miss() ;
160// Fill masked values to land values
161where (OceFrac >  1.0 )  OceFrac=0.0 ;
162where (OceFrac <  0.0 )  OceFrac=0.0 ;
163EOF
164ncap2 -h --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.nc
165ncatted -h -a missing_value,OceFrac,d,,"" -a _FillValue,OceFrac,d,,"" dia_t${oce}_to_t${atm}_1storder.nc
166
167##
168##  Creates mask on ATM grid
169## ===========================================================================
170cp dia_t${oce}_to_t${atm}_1storder.nc  dia_t${oce}_to_t${atm}_1storder_mask.nc
171ncks -h --overwrite -v OceFrac dia_t${oce}_to_t${atm}_1storder_mask.nc  ${ATM}_grid_maskFrom_${OCE}.nc
172ncks -h --append    -v aire    atm_grid.nc                              ${ATM}_grid_maskFrom_${OCE}.nc
173[[ ${atm} = *ico* ]] && ncks -h --append -v bounds_lon,bounds_lat atm_grid.nc                              ${ATM}_grid_maskFrom_${OCE}.nc
174
175cat <<EOF > creation_masque.nco
176where (OceFrac >  0.0 )  OceFrac=1 ;
177where (OceFrac <= 0.0 )  OceFrac=0 ;
178EOF
179ncap2 -h --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
180ncrename -h -v OceFrac,OceMask dia_t${oce}_to_t${atm}_1storder_mask.nc
181
182ncks -h --append  -v OceMask dia_t${oce}_to_t${atm}_1storder_mask.nc   ${ATM}_grid_maskFrom_${OCE}.nc
183
184
185##
186## NEMO, other case, towards ATM
187## ===========================================================================
188for order in ${Listorder} ; do
189    case ${order} in
190        ( 1st ) num_order=1 ;;
191        ( 2nd ) num_order=2 ;;
192    esac
193   
194    for OCEGRID in ${ListOCEGRID} ; do
195        ocegrid=${OCEGRID~}
196
197        if [[ !( ${order} = 1st && ${OCEGRID} = T ) ]] ; then
198
199            echo ${Green}"${OCE} ${OCEGRID} toward ${ATM} - ${order}order"${Norm}
200
201            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}
202            python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]'                   -k type  -v ${oce_domain_type}
203            python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]'                   -k type  -v ${atm_domain_type}
204            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}
205            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
206            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}"
207            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}
208            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}
209            python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]'       -t ${num_order}
210            python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]'                    -k type  -v ${oce_domain_type}
211            python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/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"]/domain_definition/domain[@id="domain_dst"]/interpolate_domain' -k order -v ${num_order}
213            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
214            cp iodef.xml iodef_${ocegrid}${oce}_t${atm}_${order}order.xml
215           
216            time /usr/bin/time ccc_mprun ./interpol.exe --mask_src=yes --mask_dst=yes
217        fi
218       
219    done
220done
221
222##
223## ATM towards NEMO points
224## ===========================================================================
225cp ${SUBMIT_DIR}/iodef_atm_to_oce.xml           iodef.xml
226
227python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_src"]'                   -k type  -v ${atm_domain_type}
228python update_xml.py -i iodef.xml -n 'context[@id="interpol_read"]/domain_definition/domain[@id="domain_dst"]'                   -k type  -v ${oce_domain_type}
229python 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}"
230python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="source_grid"]' -t ${atm_domain_type}
231python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="dest_grid"]'   -t ${oce_domain_type}
232python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_src"]'                    -k type  -v ${atm_domain_type}
233python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/domain_definition/domain[@id="domain_dst"]'                    -k type  -v ${oce_domain_type}
234           
235for order in ${Listorder} ; do
236    case ${order} in
237        ( 1st ) num_order=1 ;;
238        ( 2nd ) num_order=2 ;;
239    esac
240    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}
241    python update_xml.py -i iodef.xml -n 'context[@id="interpol_run"]/file_definition/file[@id="dia"]/variable[@name="order"]'       -t ${num_order}   
242   
243    for OCEGRID in ${ListOCEGRID} ; do
244        ocegrid=${OCEGRID~}
245
246        echo ${Green}"${ATM} toward ${OCE} ${OCEGRID} - ${order}order"${Norm}
247        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}
248        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}
249        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
250        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
251        cp iodef.xml iodef_t${atm}_to_${ocegrid}${oce}_${order}order.xml
252       
253        time /usr/bin/time ccc_mprun ./interpol.exe --mask_src=yes --mask_dst=yes
254       
255    done
256done
257
258##
259## Change all NetCDF files to NetCDF 3 format (needed for OASIS)
260## ===========================================================================
261for InFile in *.nc ; do
262    if [[ $(ncdump -k ${InFile}) = *netCDF-4* ]] ; then
263        mv ${InFile} tmp_${InFile}
264        ncks --fl_fmt=${FL_FMT} -h  tmp_${InFile}  ${InFile}
265    fi
266done
267
268##
269## Add time axis and coordinates information
270## (needed if files need to be read by XIOS)
271## ===========================================================================
272if [[ ${atm} = ico ]] ; then
273    cat <<EOF > add_time.nco
274defdim("time_counter",1) ;
275OceFrac [time_counter,cell] = OceFrac (:) ;
276OceMask [time_counter,cell] = OceMask (:) ;
277EOF
278    ncap2 -O -h -S 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
279    ncks -O --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
280    ncatted -h \
281            -a coordinates,OceFrac,c,c,"time_counter cell" \
282            -a coordinates,OceMask,c,c,"time_counter cell" \
283            -a coordinates,aire,c,c,"time_counter cell"    ${ATM}_grid_maskFrom_${OCE}.nc
284fi
285if [[ ${atm} = lmd ]] ; then
286    cat <<EOF > add_time.nco
287defdim("time_counter",1) ;
288OceFrac [time_counter,lat,lon] = OceFrac (:,:) ;
289OceMask [time_counter,lat,lon] = OceMask (:,:) ;
290EOF
291    ncap2 -O -h -S 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
292    ncks -O --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
293    ncatted -h \
294            -a coordinates,OceFrac,c,c,"time_counter lat lon" \
295            -a coordinates,OceMask,c,c,"time_counter lat lon" \
296            -a coordinates,aire,c,c,"time_counter lat lon"    ${ATM}_grid_maskFrom_${OCE}.nc
297fi
298
299##
300## Add some information in file headers
301## ===========================================================================
302
303UUID=$(uuid)
304NCO="$(ncks --version |& tail -1|sed 's/ncks //')"
305PYTHON_VER=$( python -i -c "import sys ; print (sys.version.split(' ')[0])" )
306for InFile in *${oce}_to_*${atm}_*.nc *${atm}_to_*${oce}_*.nc ${ATM}_grid_maskFrom_${OCE}.nc ; do
307    ncatted -h \
308            --attribute uuid,global,d,,                                           \
309            --attribute LongName,global,d,,                                       \
310            --attribute nco_openmp_thread_number,global,d,,                       \
311            --attribute Conventions,global,o,c,"CF-1.6"                           \
312            --attribute source,global,o,c,"IPSL Earth system model"               \
313            --attribute group,global,o,c,"ICMC IPSL Climate Modelling Center"     \
314            --attribute Institution,global,o,c,"IPSL https://www.ipsl.fr"         \
315            --attribute Ocean,global,o,c,"${OCE} https://www.nemo-ocean.eu"       \
316            --attribute Atmosphere,global,o,c,"${ATM} http://lmdz.lmd.jussieu.fr" \
317            --attribute production,global,o,c,"$(finger ${LOGNAME} | head -1 | awk '{print $4, $5}') " \
318            --attribute originalFiles,global,o,c,"${OCE}_coordinates_mask.nc ${ATM}_grid_mask.nc"      \
319            --attribute associatedFiles,global,o,c,"grids_${OCE}x${ATM}.nc areas_${OCE}x${ATM}.nc masks_${OCE}x${ATM}.nc" \
320            --attribute directory,global,o,c,"$(pwd)"                             \
321            --attribute description,global,o,c,"Fields needed by OASIS-MCT"       \
322            --attribute title,global,o,c,"${InFile}.nc"                           \
323            --attribute Program,global,o,c,"Generated by ${PROGRAM}"              \
324            --attribute timeStamp,global,o,c,"$(date)"                            \
325            --attribute uuid,global,o,c,"${UUID}"                                 \
326            --attribute HOSTNAME,global,o,c,"$(hostname)"                         \
327            --attribute LOGNAME,global,o,c,"$(whoami)"                            \
328            --attribute NCO,global,o,c,"NCO netCDF Operator ${NCO} http://nco.sourceforge.net" \
329            --attribute Python,global,o,c,"Python version ${PYTHON_VER}"          \
330            --attribute OS,global,o,c,"$(uname -o)"                               \
331            --attribute release,global,o,c,"$(uname -r)"                          \
332            --attribute hardware,global,o,c,"$(uname -i)"                         \
333            --attribute directory,global,o,c,"$(pwd)"                             \
334            --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" \
335            --attribute Comment,global,o,c,"Preliminary attempt - Do not trust !" \
336            --attribute SVN_Author,global,o,c,"$Author: omamce $"                 \
337            --attribute SVN_Date,global,o,c,"$Date: 2018-03-12 11:17:59 +0100 (Mon, 12 Mar 2018) $"                            \
338            --attribute SVN_Revision,global,o,c,"$Revision: 3625 $"               \
339            --attribute SVN_Id,global,o,c,"$Id: CreateWeightsMask.bash 3625 2018-03-12 10:17:59Z omamce $"                                \
340            --attribute SVN_Log,global,o,c,"$Log: $"                              \
341            ${InFile}
342done
343
344
345##
346## Update and complete weights file to fit OASIS requested format
347## ===========================================================================
348cat <<EOF > add_dim.nco
349defdim("num_wgts",1) ;
350weight[n_weight, num_wgts] = weight ;
351EOF
352
353for file in rmp_*${oce}_to_*${atm}_*.nc rmp_*${atm}_to_*${oce}_*.nc ; do
354    mv ${file} xios_${file}
355    ncap2 --fl_fmt=${FL_FMT} -h --script-file add_dim.nco xios_${file} ${file}
356   
357    ncrename -h --dimension n_weight,num_links   ${file}
358    ncrename -h --variable  src_idx,src_address  ${file}
359    ncrename -h --variable  dst_idx,dst_address  ${file}
360    ncrename -h --variable  weight,remap_matrix  ${file}
361    case ${file} in
362        ( *1storder.nc ) ncatted -h --attribute map_method,global,o,c,"Conservative Remapping - 1st order"  ${file} ;;
363        ( *2ndorder.nc ) ncatted -h --attribute map_method,global,o,c,"Conservative Remapping - 2nd order"  ${file} ;;
364    esac
365    ncatted -h --attribute conventions,global,o,c,"SCRIP"   ${file}
366    ncatted -h --attribute normalization,global,o,c,"none"  ${file}
367   
368    case ${file} in
369        ( rmp_*${oce}_to_t${atm}_* )
370        ncatted -h \
371                --attribute title,global,o,c,"Weights ${OCE} to ${ATM}" \
372                --attribute source_grid,global,o,c,"${oce_domain_type}" \
373                --attribute dest_grid,global,o,c,"${atm_domain_type}"   \
374                ${file} 
375        ;;
376        ( rmp_*${atm}_to_*${oce}_* )
377        ncatted -h \
378                --attribute title,global,o,c,"Weights ${ATM} to ${OCE}" \
379                --attribute source_grid,global,o,c,"${atm_domain_type}" \
380                --attribute dest_grid,global,o,c,"${oce_domain_type}"   \
381                ${file}
382        ;;
383    esac
384done
385
386##
387## Save results
388## ===========================================================================
389cp ${ATM}_grid_maskFrom_${OCE}.nc ${SUBMIT_DIR}
390for order in ${Listorder}
391do
392    cp dia_t${oce}_to_t${atm}_${order}order.nc ${SUBMIT_DIR}/dia_t${OCE}_to_t${ATM}_${order}order.nc
393    cp rmp_t${oce}_to_t${atm}_${order}order.nc ${SUBMIT_DIR}/rmp_t${OCE}_to_t${ATM}_${order}order.nc
394    for grid in ${Listocegrid} ; do
395        cp rmp_t${atm}_to_${grid}${oce}_${order}order.nc ${SUBMIT_DIR}/rmp_t${ATM}_to_${grid}${OCE}_${order}order.nc
396        cp dia_t${atm}_to_${grid}${oce}_${order}order.nc ${SUBMIT_DIR}/dia_t${ATM}_to_${grid}${OCE}_${order}order.nc
397    done
398done
399
400##
401## Creates and save auxiliary files for OASIS
402## ===========================================================================
403bash ${SUBMIT_DIR}/CreateOasisGrids.bash --oce ${OCE} --atm ${ATM}
404
405cp areas_${OCE}x${ATM}.nc ${SUBMIT_DIR}
406cp grids_${OCE}x${ATM}.nc ${SUBMIT_DIR}
407cp masks_${OCE}x${ATM}.nc ${SUBMIT_DIR}
408
409
410## ===========================================================================
411##
412##                               That's all folk's !!!
413##
414## ===========================================================================
415
Note: See TracBrowser for help on using the repository browser.