Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error of CDS API request #9

Open
DavidChoi76 opened this issue Nov 6, 2024 · 0 comments
Open

Error of CDS API request #9

DavidChoi76 opened this issue Nov 6, 2024 · 0 comments

Comments

@DavidChoi76
Copy link

hello developer of this awesome github!!

I'm trying to execute "cds-tutorial.ipynb", however, I got API error below.
Is there any problem in the API url or cads_api_client python library?

When I execute the last cell in "cds-tutorial.ipynb", I got an error below.

mybinder error message

/srv/conda/envs/notebook/lib/python3.10/site-packages/cads_api_client/api_client.py:68: UserWarning: 404 Client Error: Not Found for url: https://cds.climate.copernicus.eu/api/v2/catalogue/v1/messages

warnings.warn(str(exc), UserWarning)

HTTPError Traceback (most recent call last)
Cell In[4], line 3
1 import cdsapi
2 c = cdsapi.Client()
----> 3 c.retrieve(
4 'reanalysis-era5-land',
5 {
6 'variable': [
7 '10m_u_component_of_wind', '10m_v_component_of_wind', '2m_temperature',
8 ],
9 'year': [
10 '1981', '1982', '1983',
11 '1984', '1985', '1986',
12 '1987', '1988', '1989',
13 '1990', '1991', '1992',
14 '1993', '1994', '1995',
15 '1996', '1997', '1998',
16 '1999', '2000', '2001',
17 '2002', '2003', '2004',
18 '2005', '2006', '2007',
19 '2008', '2009', '2010',
20 '2011', '2012', '2013',
21 '2014', '2015', '2016',
22 '2017', '2018', '2019',
23 '2020',
24 ],
25 'month': '12',
26 'day': '15',
27 'time': '12:00',
28 'format': 'netcdf',
29 'area': [
30 60, -10, 35,
31 30,
32 ],
33 },
34 './data/era5-land_eur_1981_2020.nc')

File /srv/conda/envs/notebook/lib/python3.10/site-packages/cads_api_client/legacy_api_client.py:164, in LegacyApiClient.retrieve(self, name, request, target)
162 submitted: Remote | Results
163 if self.wait_until_complete:
--> 164 submitted = self.logging_decorator(self.client.submit_and_wait_on_results)(
165 collection_id=name,
166 **request,
167 )
168 else:
169 submitted = self.logging_decorator(self.client.submit)(
170 collection_id=name,
171 **request,
172 )

File /srv/conda/envs/notebook/lib/python3.10/site-packages/cads_api_client/legacy_api_client.py:147, in LegacyApiClient.logging_decorator..wrapper(*args, **kwargs)
142 @functools.wraps(func)
143 def wrapper(*args: Any, **kwargs: Any) -> Any:
144 with LoggingContext(
145 logger=processing.LOGGER, quiet=self.quiet, debug=self._debug
146 ):
--> 147 return func(*args, **kwargs)

File /srv/conda/envs/notebook/lib/python3.10/site-packages/cads_api_client/api_client.py:454, in ApiClient.submit_and_wait_on_results(self, collection_id, **request)
438 def submit_and_wait_on_results(
439 self, collection_id: str, **request: Any
440 ) -> cads_api_client.Results:
441 """Submit a request and wait for the results to be ready.
442
443 Parameters
(...)
452 cads_api_client.Results
453 """
--> 454 return self._retrieve_api.submit(collection_id, **request).make_results()

File /srv/conda/envs/notebook/lib/python3.10/site-packages/cads_api_client/processing.py:728, in Processing.submit(self, collection_id, **request)
727 def submit(self, collection_id: str, **request: Any) -> Remote:
--> 728 return self.get_process(collection_id).submit(**request)

File /srv/conda/envs/notebook/lib/python3.10/site-packages/cads_api_client/processing.py:717, in Processing.get_process(self, process_id)
715 def get_process(self, process_id: str) -> Process:
716 url = f"{self.url}/processes/{process_id}"
--> 717 return Process.from_request("get", url, **self._request_kwargs)

File /srv/conda/envs/notebook/lib/python3.10/site-packages/cads_api_client/processing.py:147, in ApiResponse.from_request(cls, method, url, headers, session, retry_options, request_options, download_options, sleep_max, cleanup, log_messages, **kwargs)
142 response = robust_request(
143 method, url, headers=headers, **request_options, **kwargs
144 )
145 LOGGER.debug(f"REPLY {response.text}")
--> 147 cads_raise_for_status(response)
149 self = cls(
150 response,
151 headers=headers,
(...)
157 cleanup=cleanup,
158 )
159 if log_messages:

File /srv/conda/envs/notebook/lib/python3.10/site-packages/cads_api_client/processing.py:84, in cads_raise_for_status(response)
77 else:
78 message = "\n".join(
79 [
80 f"{response.status_code} Client Error: {response.reason} for url: {response.url}",
81 error_json_to_message(error_json),
82 ]
83 )
---> 84 raise requests.HTTPError(message, response=response)
85 response.raise_for_status()

HTTPError: 404 Client Error: Not Found for url: https://cds.climate.copernicus.eu/api/v2/retrieve/v1/processes/reanalysis-era5-land

local computer error message

2024-11-06 10:02:32,152 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-land

HTTPError Traceback (most recent call last)
File ~/anaconda3/envs/climate_change/lib/python3.10/site-packages/cdsapi/api.py:442, in Client._api(self, url, request, method)
441 try:
--> 442 result.raise_for_status()
443 reply = result.json()

File ~/anaconda3/envs/climate_change/lib/python3.10/site-packages/requests/models.py:1024, in Response.raise_for_status(self)
1023 if http_error_msg:
-> 1024 raise HTTPError(http_error_msg, response=self)

HTTPError: 404 Client Error: Not Found for url: https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-land

During handling of the above exception, another exception occurred:

Exception Traceback (most recent call last)
Cell In[3], line 3
1 import cdsapi
2 c = cdsapi.Client()
----> 3 c.retrieve(
4 'reanalysis-era5-land',
5 {
6 'variable': [
7 '10m_u_component_of_wind', '10m_v_component_of_wind', '2m_temperature',
8 ],
9 'year': [
10 '1981', '1982', '1983',
11 '1984', '1985', '1986',
12 '1987', '1988', '1989',
13 '1990', '1991', '1992',
14 '1993', '1994', '1995',
15 '1996', '1997', '1998',
16 '1999', '2000', '2001',
17 '2002', '2003', '2004',
18 '2005', '2006', '2007',
19 '2008', '2009', '2010',
20 '2011', '2012', '2013',
21 '2014', '2015', '2016',
22 '2017', '2018', '2019',
23 '2020',
24 ],
25 'month': '12',
26 'day': '15',
27 'time': '12:00',
28 'format': 'netcdf',
29 'area': [
30 60, -10, 35,
31 30,
32 ],
33 },
34 './data/era5-land_eur_1981_2020.nc')

File ~/anaconda3/envs/climate_change/lib/python3.10/site-packages/cdsapi/api.py:364, in Client.retrieve(self, name, request, target)
363 def retrieve(self, name, request, target=None):
--> 364 result = self._api("%s/resources/%s" % (self.url, name), request, "POST")
365 if target is not None:
366 result.download(target)

File ~/anaconda3/envs/climate_change/lib/python3.10/site-packages/cdsapi/api.py:464, in Client._api(self, url, request, method)
459 e.append(
460 "To access this resource, you first need to accept the terms"
461 "of '%s' at %s" % (t["title"], t["url"])
462 )
463 error = ". ".join(e)
--> 464 raise Exception(error)
465 else:
466 raise

Exception: Not Found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant