open-meteo / open-data

Open-Meteo on AWS Open Data
86 stars 3 forks source link

Regarding Downloading ERA5 eith specific params #5

Closed proteeti13 closed 7 months ago

proteeti13 commented 7 months ago

Hello,

As CDS api is not working now, I found this repo suggested as an alternative in the community. But I still can't figure out how how can I specify my params while opening the endpoint to download the grib file. In my python code, I was doing this:

cdsapi_key = 'X:X
c = cdsapi.Client(key=cdsapi_key)

folder_nc = '.'  

print('Process started. Please wait for the ending message...')
start = timeit.default_timer()
c = cdsapi.Client()

variables_list = ['2m_temperature']

for variable in variables_list:
    c.retrieve(
        'reanalysis-era5-land-monthly-means',
        {
            'format': 'grib',
            'product_type': 'monthly_averaged_reanalysis',
            'variable': variable,
            'year': [str(year) for year in range(2000, 2022)],
            'month': ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
            'time': '00:00',
            'area': [25, -25, 75, 45],  # Europe bounding box
        },
        os.path.join(folder_nc, f'ERA5-Land_{variable}_2000-2022_europe_2.grib')
    )

stop = timeit.default_timer()
print('Process completed in ', (stop - start) / 60, ' minutes')

I want to do something as equivalent to download the same file from here, but don't seem to figure it out. Any help with this?

Thanks in advance.

patrick-zippenfenig commented 7 months ago

Hi, you can get ERA5 and ERA5-Land data though the Historical Weather API. Per default, the API also returns high resolution ECMWF IFS data at 9 km grid spacing. Make sure to select the desired weather model in the Reanalysis Models drop down.

Data is given as hourly time-series in JSON format for individual locations and ideal if you need to analyse only a limited number of locations.

If you explicitly need monthly temperature data over 23 years for entire Europe, this approach does not suit you and you might just wait until the CDS API finished upgrading. However, if you only need to analyse major cities, it should be significantly faster and even provides access to 1-hourly data instead of only monthly data.

Although it is not ideal, you can use the Open-Meteo API and fetch data for every 0.25° coordinate and recreate the European result. The API rate limiter will soon block you requests, but you can use the open-data distribution and follow the ERA5 guide to run the API locally.