Hello. Is there a limit to the number of variables which I can download through the API, when I’m saving data in the NetCDF format? I would like to download two variables–“surface solar radiation downwards” and “2m temperature”. I am able to download each of these separately, but when I try to download two files at a time, it fails.
Is there something I am doing wrong? I am including my code below.
import cdsapi
import xarray as xa
from scipy.io import netcdf
import os
def download_data_fromera5(latitude, longitude):
COORDS = {
"Location_1":[latitude, longitude] # randomly chosen lat lon
}
c = cdsapi.Client()
for station in COORDS:
station_point_coord = COORDS[station]*2 # duplicate it
print(station_point_coord)
c.retrieve(
'reanalysis-era5-single-levels',
{
'product_type': 'reanalysis',
'variable': ['surface_solar_radiation_downwards', 'surface_pressure',],
'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',
],
'area': station_point_coord,
'format': 'netcdf',
},
f'download_Location_1.nc')
wd = os.getcwd()
path_to_print = wd + "/" +"download_" + str(station) + ".nc"
datathere = xa.load_dataset('/home/abed/Documents/samples_python/download_Location_1.nc', engine = 'netcdf4')
return datathere