| 1 | #!/bin/bash |
|---|
| 2 | |
|---|
| 3 | # |
|---|
| 4 | # This script creates the file "ECDYN.nc" for a given date |
|---|
| 5 | # defined by year, month, day and hour between 0, 6, 12 or 18hGMT |
|---|
| 6 | # using ERA5 data at IDRIS, spirit2, spirit1 or on your local machine using |
|---|
| 7 | # data from spirit2, provided that you have an account on spirit2. |
|---|
| 8 | # |
|---|
| 9 | # You need to be in the UNIX group subipsl at IDRIS or in the |
|---|
| 10 | # UNIX group ecmwf on spirit2, to access the data. |
|---|
| 11 | # |
|---|
| 12 | # This main script is calling 2 scripts: get_ERA.sh and create_ECDYN_ERA.sh |
|---|
| 13 | # |
|---|
| 14 | # get_ERA.sh extracts the data (u, v, ta, r, etc; see $VARS below) |
|---|
| 15 | # from ERA reanalyses at the chosen date on your actual directory |
|---|
| 16 | # |
|---|
| 17 | # create_ECDYN_ERA.sh merges the data into ECDYN.nc, together with an ancien |
|---|
| 18 | # CDSW field (see below) and renames different fields. |
|---|
| 19 | # |
|---|
| 20 | # "ECDYN.nc" also contains ST and CDSW (which could be in "ECPHY.nc"). |
|---|
| 21 | # CDSW is not modified because we do not know what to put into it. |
|---|
| 22 | # |
|---|
| 23 | # NB: The field CDSW is coming from the file ECDYN_high_res.nc |
|---|
| 24 | # available here : |
|---|
| 25 | # https://www.lmd.jussieu.fr/~lmdz/pub/3DInputData/Init/ECDYN_high_res.nc |
|---|
| 26 | # |
|---|
| 27 | # This script was largely inspired by the script "create_ECDYN.sh" |
|---|
| 28 | # available at "https://lmdz.lmd.jussieu.fr/utilisateurs/utilisation-de-lmdz" |
|---|
| 29 | # written by Lionel GUEZ. |
|---|
| 30 | # It was completely rewritten and parameterized as follows: |
|---|
| 31 | # |
|---|
| 32 | # 1/ getting data fields (script get_ERA.sh) was separated from |
|---|
| 33 | # the merging part (script create_ECDYN_ERA.sh) |
|---|
| 34 | # 2/ it allows to get any day and hour of a given year and month. |
|---|
| 35 | # 3/ it allows to use ERA5 dataset |
|---|
| 36 | # |
|---|
| 37 | # Usage : |
|---|
| 38 | # |
|---|
| 39 | # ./ECDYN_ERA.sh $machine $year $month $day $hour |
|---|
| 40 | # |
|---|
| 41 | # For example, to create ECDYN.nc |
|---|
| 42 | # on spirit2 for 1995 year, January 1st at 0h, |
|---|
| 43 | # launch ./ECDYN_ERA.sh as below : |
|---|
| 44 | # |
|---|
| 45 | # ./ECDYN_ERA.sh spirit2 1995 01 01 0 |
|---|
| 46 | # |
|---|
| 47 | # Author: Ionela MUSAT, 1st April 2022 |
|---|
| 48 | # |
|---|
| 49 | |
|---|
| 50 | echo $host may be spirit2 or IDRIS |
|---|
| 51 | host=$1 |
|---|
| 52 | year=$2 |
|---|
| 53 | month=$3 |
|---|
| 54 | day=$4 |
|---|
| 55 | hour=$5 |
|---|
| 56 | |
|---|
| 57 | ana=ERA5 |
|---|
| 58 | mesolog=`whoami` |
|---|
| 59 | resol=GLOBAL_025 |
|---|
| 60 | |
|---|
| 61 | echo |
|---|
| 62 | echo get the input data for ECDYN.nc for ${year}${month}${day} at ${hour}GMT |
|---|
| 63 | echo |
|---|
| 64 | |
|---|
| 65 | VARS="u v ta r geopt stl1 sp" |
|---|
| 66 | |
|---|
| 67 | for var in $VARS; do |
|---|
| 68 | |
|---|
| 69 | case $var in |
|---|
| 70 | ta) freq=hourly |
|---|
| 71 | ddt=AN_PL |
|---|
| 72 | suf=ap1e5 |
|---|
| 73 | ndpd=24 ;; |
|---|
| 74 | u|v|r) freq=4xdaily |
|---|
| 75 | ddt=AN_PL |
|---|
| 76 | suf=aphe5 |
|---|
| 77 | ndpd=4 ;; |
|---|
| 78 | geopt|stl1|sp) freq=hourly |
|---|
| 79 | ddt=AN_SF |
|---|
| 80 | suf=as1e5 |
|---|
| 81 | ndpd=24 ;; |
|---|
| 82 | esac |
|---|
| 83 | |
|---|
| 84 | ./get_ERA.sh ${ana} ${host} ${mesolog} ${resol} ${freq} ${ddt} ${suf} ${ndpd} ${year} ${month} ${day} ${hour} ${var} |
|---|
| 85 | |
|---|
| 86 | done |
|---|
| 87 | |
|---|
| 88 | echo |
|---|
| 89 | echo merge input data into ECDYN.nc for ${year}${month}${day} at ${hour}GMT |
|---|
| 90 | echo |
|---|
| 91 | |
|---|
| 92 | ./create_ECDYN_ERA.sh ${host} ${year} ${month} ${day} ${hour} |
|---|
| 93 | |
|---|
| 94 | exit |
|---|