source: BOL/Scripts_cel/ECDYN_ERA/create_ECDYN_ERA.sh @ 4904

Last change on this file since 4904 was 4904, checked in by musat, 5 weeks ago

Scripts to create ECDYN.nc file for a given date on spirit2, at IDRIS
or on your local machine
I.Musat

  • Property svn:executable set to *
File size: 1.7 KB
Line 
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#
18set -xe
19
20host=$1
21yr=$2
22mth=$3
23day=$4
24hr=$5
25fout=ECDYN_${yr}${mth}${day}_${hr}.nc
26
27date=${yr}${mth}${day}${hr}
28echo create ECDYN.nc for ${date} at ${hr} hour
29
30for var in u v ta r geopt stl1 sp
31do
32    chmod 600 ${var}.nc
33    ncpdq -U --dimension=time,0 --overwrite ${var}.nc \
34        ${var}_new.nc
35done
36
37#
38# Get an old ECDYN called ECDYN_high_res.nc and extract the CDSW field from it
39#
40if [ ! -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
43else
44    echo ECDYN_high_res.nc is here
45fi
46###
47# Get the CDSW field from ECDYN_high_res.nc file
48if [ ! -f CDSW_ECDYN_high_res.nc ]; then
49    ncks -v CDSW ECDYN_high_res.nc CDSW_ECDYN_high_res.nc
50fi
51###
52# Start from CDSW so that the time value is overwritten:
53###
54remap=remapcon,stl1_new.nc
55cdo $remap CDSW_ECDYN_high_res.nc ${fout}
56
57VARS="u v ta r geopt stl1 sp"
58for var in ${VARS}; do
59    ncks --append ${var}_new.nc ${fout}
60done
61
62ncrename --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:
66for var in ${VARS}; do
67    echo $var
68    echo \rm ${var}.nc
69    echo \rm ${var}_new.nc
70done
71
72exit
Note: See TracBrowser for help on using the repository browser.