Site download of netcdf are "good", same download via python API are "bad"

I’m using a short python script to submit an “era5-land-daily” request and download the file to my local machine. The requests in my script seem to be correctly formatted, since if I manually download the data from the CDS “Your Requests” web page (once they are marked complete), the netcdf files (one .nc file per variable) look as expected.

However, when I pragmatically download the data file as part of my initial request, I only get a single data file that I can not open (it is not recognized as a netcdf file when I try to open it).

Here is what my python script looks like:

import cdsapi

def ReadCDSapiDailyAvg(Y,M):
    dataset = "derived-era5-land-daily-statistics"
    request = {
        'format': 'netcdf',
        'download_format': "unarchived",
        "variable": [
            "2m_temperature",
            "surface_pressure"
        ],
        "year": Y,
        "month": M,
        "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"
        ],
        "daily_statistic": "daily_mean",
        "time_zone": "utc+00:00",
        "frequency": "1_hourly"
    }
    
    target = "Test.nc"
    client = cdsapi.Client()
    client.retrieve(dataset, request, target)

I am specifying an unarchived netcdf format in the above code, so I am unclear why the resulting file seems to be in an unrecognized format (though the actual file size looks correct- so there does appear to be data there).

In my case, the new api works this way:

  • if you request one variable, you’ll get a .nc file
  • if you request more variables, you’ll get a .zip archive

Try changing the extension to .zip, or try downloading one variable at time as nc file, and let us know if it works as expected.