# Trying to download a (short) list of data variables using the API in Python, saving as NET CDF. 

**URL:** <https://forum.ecmwf.int/t/trying-to-download-a-short-list-of-data-variables-using-the-api-in-python-saving-as-net-cdf/13751>\
**Category:** API\
**Tags:** api\
**Created:** [9 July 2025 08:29 UTC](https://forum.ecmwf.int/t/trying-to-download-a-short-list-of-data-variables-using-the-api-in-python-saving-as-net-cdf/13751 "2025-07-09T08:29:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abed\_Ayyad](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@Abed\_Ayyad](https://forum.ecmwf.int/u/Abed_Ayyad)\
**Post date:** [9 July 2025 08:29 UTC](https://forum.ecmwf.int/t/trying-to-download-a-short-list-of-data-variables-using-the-api-in-python-saving-as-net-cdf/13751/1 "2025-07-09T08:29:56Z")

</div>

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.

```auto
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

```

---

<div class="post-metadata">

**Author:** ![Teofilo\_Ligawa](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/t/22d042/32.png) [@Teofilo\_Ligawa](https://forum.ecmwf.int/u/Teofilo_Ligawa)\
**Post date:** [9 July 2025 14:14 UTC](https://forum.ecmwf.int/t/trying-to-download-a-short-list-of-data-variables-using-the-api-in-python-saving-as-net-cdf/13751/2 "2025-07-09T14:14:29Z")

</div>

There has been an issue with this during the past few months. Check [here](https://forum.ecmwf.int/t/limitation-change-on-netcdf-era5-requests/12477)

---

<div class="post-metadata">

**Author:** ![Abed\_Ayyad](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@Abed\_Ayyad](https://forum.ecmwf.int/u/Abed_Ayyad)\
**Post date:** [9 July 2025 15:18 UTC](https://forum.ecmwf.int/t/trying-to-download-a-short-list-of-data-variables-using-the-api-in-python-saving-as-net-cdf/13751/3 "2025-07-09T15:18:01Z")

</div>

Thanks for this. I was worried about that and now it seems true. I am going to post another question later because I am now hitting a problem where downloading individual datasets for specific variables one at a time seems to be causing an API problem.

---

<div class="post-metadata">

**Author:** ![Kevin\_Marsh](https://forum.ecmwf.int/user_avatar/forum.ecmwf.int/kevin_marsh/32/368_2.png) [@Kevin\_Marsh](https://forum.ecmwf.int/u/Kevin_Marsh)\
**Post date:** [18 July 2025 08:49 UTC](https://forum.ecmwf.int/t/trying-to-download-a-short-list-of-data-variables-using-the-api-in-python-saving-as-net-cdf/13751/4 "2025-07-18T08:49:16Z")

</div>

Hi, if you request several variables from this dataset in netCDF you may get a zip archive as the downloaded file, so you need to unzip it before trying to read the netCDF files.
