Page 1 of 1

Downloading one year ERA5 data

Posted: June 27th, 2024, 6:24 am
by prerita
Hi

I intend to download all the months using the script here https://github.com/amcz/hysplit_metdata ... ra5_cds.py
But the given Python only downloads for one month and one date.
I changed the string for month and year, but it still takes the default option.

Additionally, cds client has a limit of 60,000 and I wish to download all the months without having to change script each time.

Can anyone advise please ?

Re: Downloading one year ERA5 data

Posted: June 27th, 2024, 8:12 am
by alicec
you can create a script to call get_era5_cds.py in a loop to get all the dates you want.
An example bash script is below.

Code: Select all

#!/bin/sh
# Example bash script for retrieving ERA5 for a small area.
# Author: Alice Crawford   Organization: NOAA/OAR/ARL

# Example for downloading and converting ERA5 data on pressure levels
# for a relatively small area.

# python call
MDL="python"

#Location of get_era5_cds.py
PDL=$HOME/hysplit_metdata
year=2020

#small area to retrieve
# upper left lat/ upper left lon / lower right lat / lower right lon
# NORTH/WEST/SOUTH/EAST
area="65/150/40/180"

#directory to write files to.
outdir='./'

for month in '10'
do
     #for day  in   $(seq 23  22)
     for day  in   23
     do
              echo "RETRIEVING  month $month day $day"
              # retrieves pressure level files
              $MDL ${PDL}/get_era5_cds.py  --3d -s enda  -y $year -m $month  -d $day --dir $outdir  -g  --area $area
              # retrieves surface data files with all variables
              $MDL ${PDL}/get_era5_cds.py  --2da -s enda  -y $year -m $month  -d $day --dir $outdir  -g  --area $area
     done
done

Re: Downloading one year ERA5 data

Posted: June 27th, 2024, 8:22 am
by prerita
Hi Alice,

Many thanks for this. That is helpful.
I have another question about your script /get_era5_cds.py.

I changed the 'month' : monthstr, to 'month' : [ '01' ],
in all the server.retrieve instances

hoping that it will not take the default month but the month that I provided.

However, the get_era5_message.txt still says 'retrieving 3d data for 2009-12-01' (which is the default option) and it writes the output file name as ERA5_2009.Dec01.3dpl.grib but the actual dates in grib file are 2009-01-01.

Why does it write dec in the downloaded files ?
I am not sure why. Can you advise?

Best, Prerita