Closed malmans2 closed 4 months ago
import cdsapi
client = cdsapi.Client(
key="00000000-0000-4000-a000-000000000000",
url="https://cds-stable-bopen.copernicus-climate.eu/api",
)
collection_id = "reanalysis-era5-single-levels"
request = {
"variable": "2t",
"product_type": "reanalysis",
"date": "2012-12-01",
"time": "12:00",
"foo": "bar",
}
client.retrieve(collection_id, request, "test.grib")
---------------------------------------------------------------------------
ProcessingFailedError Traceback (most recent call last)
Cell In[5], line 15
7 collection_id = "reanalysis-era5-single-levels"
8 request = {
9 "variable": "2t",
10 "product_type": "reanalysis",
(...)
13 "foo": "bar",
14 }
---> 15 client.retrieve(collection_id, request, "test.grib")
File ~/MyGit/CADS/cads-api-client/cads_api_client/legacy_api_client.py:149, in LegacyApiClient.retrieve(self, name, request, target)
146 def retrieve(
147 self, name: str, request: dict[str, Any], target: str | None = None
148 ) -> str | processing.Results:
--> 149 result = self.logging_decorator(self.client.submit_and_wait_on_result)(
150 collection_id=name,
151 retry_options=self.retry_options,
152 **request,
153 )
154 partial_download: Callable[..., str] = functools.partial(
155 result.download,
156 timeout=self.timeout,
157 retry_options=self.retry_options,
158 )
159 result.download = self.logging_decorator(partial_download) # type: ignore[method-assign]
File ~/MyGit/CADS/cads-api-client/cads_api_client/legacy_api_client.py:134, in LegacyApiClient.logging_decorator.<locals>.wrapper(*args, **kwargs)
129 @functools.wraps(func)
130 def wrapper(*args: Any, **kwargs: Any) -> Any:
131 with LoggingContext(
132 logger=processing.logger, quiet=self.quiet, debug=self._debug
133 ):
--> 134 return func(*args, **kwargs)
File ~/MyGit/CADS/cads-api-client/cads_api_client/api_client.py:77, in ApiClient.submit_and_wait_on_result(self, collection_id, retry_options, **request)
74 def submit_and_wait_on_result(
75 self, collection_id: str, retry_options: Dict[str, Any] = {}, **request: Any
76 ) -> processing.Results:
---> 77 return self.retrieve_api.submit_and_wait_on_result(
78 collection_id, retry_options=retry_options, **request
79 )
File ~/MyGit/CADS/cads-api-client/cads_api_client/processing.py:456, in Processing.submit_and_wait_on_result(self, collection_id, retry_options, **request)
452 def submit_and_wait_on_result(
453 self, collection_id: str, retry_options: Dict[str, Any] = {}, **request: Any
454 ) -> Results:
455 remote = self.submit(collection_id, retry_options=retry_options, **request)
--> 456 remote.wait_on_result(retry_options=retry_options)
457 return remote.make_results()
File ~/MyGit/CADS/cads-api-client/cads_api_client/processing.py:246, in Remote.wait_on_result(self, retry_options)
244 time.sleep(1)
245 results = multiurl.robust(self.make_results, **retry_options)(self.url)
--> 246 raise ProcessingFailedError(error_json_to_message(results.json))
247 elif status in ("accepted", "running"):
248 sleep *= 1.5
ProcessingFailedError: job failed
MARS has returned an error, please check your selection.
Exception: 400 Client Error: Bad Request for url: http://mars-worker-2011.shared.compute.cci2.ecmwf.int:9000/
Request submitted to the MARS server:
[{'date': ['2012-12-01'], 'foo': 'bar', 'dataset': 'reanalysis', 'time': '12:00:00', 'param': '2t', 'class': ['ea'], 'expect': ['any'], 'number': ['all'], 'levtype': ['sfc']}]
Trace ID is cb49634c-2486-4f89-a6dd-a41fc554eedc