1 | #!/bin/ksh |
---|
2 | |
---|
3 | # |
---|
4 | # The original script "create_ECDYN.sh" written by Lionel GUEZ for ERAI |
---|
5 | # is available here: |
---|
6 | # https://lmdz.lmd.jussieu.fr/utilisateurs/utilisation-de-lmdz |
---|
7 | # |
---|
8 | # The actual script by Ionela MUSAT is merging the ERA* data |
---|
9 | # extracted by the get_ERA.sh script into the |
---|
10 | # ECDYN_${year}${month}${day}_${hour}.nc file. |
---|
11 | # |
---|
12 | # This script has to be called following the execution of get_ERA.sh |
---|
13 | # |
---|
14 | # Author: Lionel GUEZ |
---|
15 | # |
---|
16 | # Changes: Ionela MUSAT, 1st April 2022 |
---|
17 | # |
---|
18 | set -xe |
---|
19 | |
---|
20 | host=$1 |
---|
21 | yr=$2 |
---|
22 | mth=$3 |
---|
23 | day=$4 |
---|
24 | hr=$5 |
---|
25 | fout=ECDYN_${yr}${mth}${day}_${hr}.nc |
---|
26 | |
---|
27 | date=${yr}${mth}${day}${hr} |
---|
28 | echo create ECDYN.nc for ${date} at ${hr} hour |
---|
29 | |
---|
30 | for var in u v ta r geopt stl1 sp |
---|
31 | do |
---|
32 | chmod 600 ${var}.nc |
---|
33 | ncpdq -U --dimension=time,0 --overwrite ${var}.nc \ |
---|
34 | ${var}_new.nc |
---|
35 | done |
---|
36 | |
---|
37 | # |
---|
38 | # Get an old ECDYN called ECDYN_high_res.nc and extract the CDSW field from it |
---|
39 | # |
---|
40 | if [ ! -f ECDYN_high_res.nc ]; then |
---|
41 | echo Copy ECDYN_high_res.nc from https://www.lmd.jussieu.fr/~lmdz/pub/3DInputData/Init |
---|
42 | wget https://www.lmd.jussieu.fr/~lmdz/pub/3DInputData/Init/ECDYN_high_res.nc |
---|
43 | else |
---|
44 | echo ECDYN_high_res.nc is here |
---|
45 | fi |
---|
46 | ### |
---|
47 | # Get the CDSW field from ECDYN_high_res.nc file |
---|
48 | if [ ! -f CDSW_ECDYN_high_res.nc ]; then |
---|
49 | ncks -v CDSW ECDYN_high_res.nc CDSW_ECDYN_high_res.nc |
---|
50 | fi |
---|
51 | ### |
---|
52 | # Start from CDSW so that the time value is overwritten: |
---|
53 | ### |
---|
54 | remap=remapcon,stl1_new.nc |
---|
55 | cdo $remap CDSW_ECDYN_high_res.nc ${fout} |
---|
56 | |
---|
57 | VARS="u v ta r geopt stl1 sp" |
---|
58 | for var in ${VARS}; do |
---|
59 | ncks --append ${var}_new.nc ${fout} |
---|
60 | done |
---|
61 | |
---|
62 | ncrename --variable=u,U --variable=v,V --variable=ta,TEMP --variable=r,R \ |
---|
63 | --variable=geopt,Z --variable=stl1,ST --variable=sp,SP ${fout} |
---|
64 | |
---|
65 | # Clean up: |
---|
66 | for var in ${VARS}; do |
---|
67 | echo $var |
---|
68 | echo \rm ${var}.nc |
---|
69 | echo \rm ${var}_new.nc |
---|
70 | done |
---|
71 | |
---|
72 | exit |
---|