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

971 unable to download era5 data using dfmtdownload era5 #972

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions dfm_tools/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ def cds_credentials():
# set default for CDSAPI_URL envvar so it does not have to be supplied. This also ignores the URL in ~/.cdsapirc
os.environ["CDSAPI_URL"] = cds_url
# gets url/key from env vars or ~/.cdsapirc file
cds_url, cds_apikey, _ = cdsapi.api.get_url_key_verify(url=cds_url, key=None, verify=None)
# cds_url, cds_apikey, _ = cdsapi.api.get_url_key_verify(url=cds_url, key=None, verify=None)
c = cdsapi.Client(url=cds_url)
cds_url = c.url
cds_apikey = c.key
except Exception as e:
if "Missing/incomplete configuration file" in str(e):
# query apikey if not present in file or envvars
Expand All @@ -127,11 +130,11 @@ def cds_credentials():
c = cdsapi.Client()
# checks whether authentication is succesful (correct combination of url and apikey)
c.retrieve(name='dummy', request={})
except RuntimeError as e:
if "dataset dummy not found" in str(e):
except Exception as e:
if "dummy not found" in str(e): # Exception
# catching incorrect name, but authentication was successful
print('found ECMWF API-key and authorization successful')
elif "Authentication failed" in str(e):
elif "Authentication failed" in str(e): # HTTPError
cds_remove_credentials_raise(reason='Authentication failed')
else:
raise e
Expand Down
2 changes: 2 additions & 0 deletions docs/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Fix
- properly assigning units attribute in `ds_apply_conversion_dict()` (it did not always stick) in [#965](https://github.com/Deltares/dfm_tools/pull/965)
- skipping initialwaterlevel in `dfmt.cmems_nc_to_ini()` [#970](https://github.com/Deltares/dfm_tools/pull/970)
- update to cdsapi 0.7.2 and properly catching error for dummy dataset in [#972](https://github.com/Deltares/dfm_tools/pull/972)


## 0.25.0 (2024-08-16)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ dependencies = [
"bottleneck>=1.3.3",
#xugrid<0.11.2 sometimes fails on merged chunks that are inconsistent
"xugrid>=0.11.2",
#cdsapi<0.7.0 supports credentials from environment variables
"cdsapi>=0.7.0",
#cdsapi<0.7.2 has different error upon dummy dataset
"cdsapi>=0.7.2",
#pydap<3.4.0 is from May 2017 and does not support newer python versions
"pydap>=3.4.0",
#erddapy<2.0.0 does not support pandas>=2.0.0
Expand Down
Loading