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