1 | #!/bin/bash |
---|
2 | |
---|
3 | ### |
---|
4 | ### This script (get_ERA.sh) extracts the data (u, v, ta, r, etc; see $VARS below) |
---|
5 | ### from ERA5 reanalyses for a given date on your actual directory |
---|
6 | ### on spirit2 or spirit1, at IDRIS or on your PC (host=spirit2/IDRIS/local) |
---|
7 | ### |
---|
8 | ### Author : Ionela MUSAT, 1st April 2022 |
---|
9 | |
---|
10 | ana=$1 |
---|
11 | host=$2 |
---|
12 | mesologin=$3 |
---|
13 | resol=$4 |
---|
14 | freq=$5 |
---|
15 | ddt=$6 |
---|
16 | suf=$7 |
---|
17 | ndpd=$8 |
---|
18 | yr=$9 |
---|
19 | mth=${10} |
---|
20 | day=${11} |
---|
21 | hr=${12} |
---|
22 | var=${13} |
---|
23 | |
---|
24 | echo $var |
---|
25 | |
---|
26 | if [ "${host}" == "ciclad" ] || [ "${host}" == "spirit2" ] || [ "${host}" == "spirit1 ]; then |
---|
27 | din=/bdd/${ana}/NETCDF/${resol}/${freq}/${ddt}/${yr} |
---|
28 | elif [ "${host}" == "IDRIS" ]; then |
---|
29 | din=/gpfsstore/rech/psl/rpsl376/${ana}/NETCDF/${resol}/${freq}/${ddt}/${yr} |
---|
30 | else |
---|
31 | din=/bdd/${ana}/NETCDF/${resol}/${freq}/${ddt}/${yr} |
---|
32 | fi |
---|
33 | |
---|
34 | fin=${var}.${yr}${mth}.${suf}.${resol}.nc |
---|
35 | fout=${var}.nc |
---|
36 | |
---|
37 | let "nt = (${day} - 1)*${ndpd} + ${hr}/6 + 1" |
---|
38 | echo $nt |
---|
39 | |
---|
40 | if [ "${host}" == "ciclad" ] || [ "${host}" == "IDRIS" ] || [ "${host}" == "spirit2" ] || [ "${host}" == "spirit1 ]; then |
---|
41 | if [ ! -f ${fout} ]; then |
---|
42 | echo ncks -O -F -d time,${nt} ${din}/${fin} ${fout} |
---|
43 | ncks -O -F -d time,${nt} ${din}/${fin} ${fout} |
---|
44 | fi |
---|
45 | else |
---|
46 | if [ "${mesologin}" != "" ]; then |
---|
47 | if [ ! -f ${fout} ]; then |
---|
48 | scp ${mesologin}@spirit2.ipsl.fr:${din}/${fin} . |
---|
49 | echo ncks -O -F -d time,${nt} ${fin} ${fout} |
---|
50 | ncks -O -F -d time,${nt} ${fin} ${fout} |
---|
51 | fi |
---|
52 | else |
---|
53 | echo |
---|
54 | echo Have to give your meso-center login as mesologin in |
---|
55 | echo the get_ERA.sh script in order to be able |
---|
56 | echo to get ERA5 data from IPSL meso-centre |
---|
57 | echo |
---|
58 | exit |
---|
59 | fi |
---|
60 | fi |
---|
61 | |
---|
62 | exit |
---|