Hi all. I'm having problems getting the format right for submitting requests for ERA Interim data - maybe someone here can help. I have here a test python script 'test_download4.py' containing: 

#!/usr/bin/env python
import cdsapi
c = cdsapi.Client()

c.retrieve('reanalysis-era-interim', { # Requests follow MARS syntax
    'date'    : '19810101',            # The hyphens can be omitted
    'levtype' : 'sfc',
    'param'   : '164',                   # Full information at https://apps.ecmwf.int/codes/grib/param-db/
    'stream'  : 'oper',                  # Denotes ERA5. Ensemble members are selected by 'enda'
    'time'    : '00',                    # You can drop :00:00 and use MARS short-hand notation, instead of '00/06/12/18'
    'type'    : 'fc',
    'step'    : '12'
    }, 'testout.nc')     # Output file. Adapt as you wish.


When I run this (Request ID: 84f62d68-80eb-4056-88c2-4cf728a32291), it fails with the following message:

$ python download_test4.py
2023-06-14 16:06:03,617 INFO Welcome to the CDS
2023-06-14 16:06:03,617 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era-interim
2023-06-14 16:06:03,703 INFO Request is queued
2023-06-14 16:12:22,390 INFO Request is failed
2023-06-14 16:12:22,390 ERROR Message: the request you have submitted is not valid
2023-06-14 16:12:22,390 ERROR Reason:  Expected 1, got 0.; Request failed; Some errors reported (last error -1)
2023-06-14 16:12:22,391 ERROR   Traceback (most recent call last):
2023-06-14 16:12:22,391 ERROR     File "/opt/cdstoolbox/cdscompute/cdscompute/cdshandlers/services/handler.py", line 59, in handle_request
2023-06-14 16:12:22,391 ERROR       result = cached(context.method, proc, context, context.args, context.kwargs)
2023-06-14 16:12:22,391 ERROR     File "/opt/cdstoolbox/cdscompute/cdscompute/caching.py", line 108, in cached
2023-06-14 16:12:22,391 ERROR       result = proc(context, *context.args, **context.kwargs)
2023-06-14 16:12:22,391 ERROR     File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 124, in __call__
2023-06-14 16:12:22,391 ERROR       return p(*args, **kwargs)
2023-06-14 16:12:22,391 ERROR     File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 60, in __call__
2023-06-14 16:12:22,391 ERROR       return self.proc(context, *args, **kwargs)
2023-06-14 16:12:22,391 ERROR     File "/home/cds/cdsservices/services/mars/mars.py", line 53, in external
2023-06-14 16:12:22,391 ERROR       return mars(context, request, **kwargs)
2023-06-14 16:12:22,391 ERROR     File "/home/cds/cdsservices/services/mars/mars.py", line 20, in mars
2023-06-14 16:12:22,391 ERROR       execute_mars(context, requests, info)
2023-06-14 16:12:22,391 ERROR     File "/home/cds/cdsservices/services/mars/execute_mars.py", line 20, in execute_mars
2023-06-14 16:12:22,391 ERROR       exception=MarsException)
2023-06-14 16:12:22,391 ERROR     File "/opt/cdstoolbox/cdscompute/cdscompute/context.py", line 209, in run_command
2023-06-14 16:12:22,391 ERROR       raise exception(call, proc.returncode, output)
2023-06-14 16:12:22,391 ERROR   home.cds.cdsservices.services.mars.__init__.py.exceptions.MarsException: Expected 1, got 0.; Request failed; Some errors reported (last error -1)
Traceback (most recent call last):
  File "/mnt/sdb/jsv/big_data/INTERIM/py/download_test4.py", line 6, in <module>
    c.retrieve('reanalysis-era-interim', { # Requests follow MARS syntax
  File "/home/jsv/anaconda3/lib/python3.9/site-packages/cdsapi/api.py", line 364, in retrieve
    result = self._api("%s/resources/%s" % (self.url, name), request, "POST")
  File "/home/jsv/anaconda3/lib/python3.9/site-packages/cdsapi/api.py", line 519, in _api
    raise Exception(
Exception: the request you have submitted is not valid. Expected 1, got 0.; Request failed; Some errors reported (last error -1).


Any ideas as to why this is?

1 Comment