Adding a flag for a timezone to download reanalysis data

Hello. I would like to download hourly data from the ERA5 Reanalysis dataset. I would like to download data where the timezone is set to UTC -8. Below is the code I attempted. It does not work. Am I misspelling a keyword or something?

Many thanks!

c.retrieve(
            'reanalysis-era5-single-levels',
            {
                'product_type': 'reanalysis',
                'variable': 'surface_solar_radiation_downwards',
                'year': '2015',
                'month': ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12',],
                'day': [
                    '01', '02', '03',
                    '04', '05', '06',
                    '07', '08', '09',
                    '10', '11', '12',
                    '13', '14', '15',
                    '16', '17', '18',
                    '19', '20', '21',
                    '22', '23', '24',
                    '25', '26', '27',
                    '28', '29', '30',
                    '31',
                    ],
                'time': [
                    '00:00', '01:00', '02:00',
                    '03:00', '04:00', '05:00',
                    '06:00', '07:00', '08:00',
                    '09:00', '10:00', '11:00',
                    '12:00', '13:00', '14:00',
                    '15:00', '16:00', '17:00',
                    '18:00', '19:00', '20:00',
                    '21:00', '22:00', '23:00',
                    ],
                'time_zone': 'UTC-8',
                'area': station_point_coord,
                'format': 'netcdf',
                },
            f'download_Location_1.nc')

What error did you get?

I think I can see a few problems, but I’m also quite new to this API.

  1. You have commas after the final entries in your [arrays,], which seems like it will cause problems.
  2. I don’t think ‘time_zone’ is a valid API term, unfortunately I think you just have to adjust from UTC manually.
  3. I think it should be “data_format” instead of “format”.

The best way to generate well-formatted API requests is to use the online download request form and then copy the API text from there, then make sure to follow that format in future API requests.

Here’s what is the suggested API request code for the data you’ve attempted to request:

import cdsapi

dataset = "reanalysis-era5-single-levels"
request = {
    "product_type": ["reanalysis"],
    "variable": ["surface_solar_radiation_downwards"],
    "year": ["2015"],
    "month": [
        "01", "02", "03",
        "04", "05", "06",
        "07", "08", "09",
        "10", "11", "12"
    ],
    "day": [
        "01", "02", "03",
        "04", "05", "06",
        "07", "08", "09",
        "10", "11", "12",
        "13", "14", "15",
        "16", "17", "18",
        "19", "20", "21",
        "22", "23", "24",
        "25", "26", "27",
        "28", "29", "30",
        "31"
    ],
    "time": [
        "00:00", "01:00", "02:00",
        "03:00", "04:00", "05:00",
        "06:00", "07:00", "08:00",
        "09:00", "10:00", "11:00",
        "12:00", "13:00", "14:00",
        "15:00", "16:00", "17:00",
        "18:00", "19:00", "20:00",
        "21:00", "22:00", "23:00"
    ],
    "data_format": "netcdf",
    "download_format": "unarchived"
}

client = cdsapi.Client()
client.retrieve(dataset, request).download()

Hi Abed,

While some CDS datasets do have the option to download data for some time zone (for example, ERA5 post-processed daily statistics on single levels from 1940 to present), raw ERA5 dataset which you are trying to download doesn’t have this possibility.
As Solomon correctly pointed out, you should always check at the dataset’s web download form which parameters are allowed for the specific dataset you want to use.
We also can’t see the code you use for the area.
This CDS dataset doesn’t support downloading one point, only an area in the format:
“area”: [45, 10, 30, 22] #[N,W,S,E]

I hope this helps.

Best regards,
Milana

Hi @Milana_Vuckovic and thanks. I have actually been able to obtain data by simply replicating the coordinates, so my area box like this:

station_point_coord = COORDS[station]*2

and then

    'area': station_point_coord,

I found this on Stack Exchange I believe and it does seem to work. My only problem is that I am unable to choose the timezone to use, which would really make my life easier.

Thanks. I am going to see what I can do. The annoying thing is that I will have to download an additional day to get the entire year that I was looking for because of the time zone difference.

Thanks.

Yes, I have found this workaround to be necessary too, and quite frustrating. Some discussion on the problem in this thread too
.