Skip to content

Commit cfd5076

Browse files
Fix new cds bugs (#171)
* Fix era5-land download issue (would download zipped grib) * Correctly use a single thread as default * Fix dryrun arg * Fix tests * Update changelog, bump version * Fix linter
1 parent f370191 commit cfd5076

File tree

13 files changed

+41
-23
lines changed

13 files changed

+41
-23
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
[bumpversion]
2-
current_version = 2.0.0
2+
current_version = 2.0.1
33

44
[comment]
55
comment = The contents of this file cannot be merged with that of pyproject.toml until https://github.com/c4urself/bump2version/issues/42 is resolved
66

77
[bumpversion:file:era5cli/__version__.py]
88
search = __version__ = "{current_version}"
99
replace = __version__ = "{new_version}"
10-
11-
[bumpversion:file:CITATION.cff]
12-
search = version: "{current_version}"
13-
replace = version: "{new_version}"

CITATION.cff

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,3 @@ license: Apache-2.0
9797
message: "If you use this software, please cite it using these metadata."
9898
repository-code: "https://github.com/ewatercycle/era5cli"
9999
title: era5cli
100-
version: "2.0.0"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
>
1919
> To continue using era5cli, you will need to re-register at ECMWF and get a new API key,
2020
> and transition to era5cli version 2. This can be installed with:
21-
> `pip install era5cli==2.0.0`
21+
> `pip install era5cli==2.0.1`
2222
2323
> [!WARNING]
2424
> netCDF files from the new Climate Data Store Beta are not formatted the same as the

docs/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
# 2.0.1 - 2025-04-04
11+
12+
Changes since v2.0.0:
13+
14+
**Changed:**
15+
- Threads are set to 1 by default, as the new CDS is not faster if you use multiple threads.
16+
17+
**Fixed:**
18+
- The cdsapi changed how wants the request formatted for getting netCDF files, netCDF files weren't properly downloaded anymore.
19+
1020
# 2.0.0 - 2025-02-12
1121

1222
Changes since v1.4.2:

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A command line interface to download ERA5 data from the [Copernicus Climate Data
1010

1111
To continue using era5cli, you will need to re-register at ECMWF and get a new API key,
1212
and transition to the era5cli v2 beta. This can be installed with:
13-
`pip install era5cli>=2.0.0`
13+
`pip install era5cli>=2.0.1`
1414

1515
???+ warning
1616
netCDF files from the new Climate Data Store Beta are not formatted the same as the

era5cli/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
"Bart Schilperoort",
2727
)
2828
__email__ = "ewatercycle@esciencecenter.nl"
29-
__version__ = "2.0.0"
29+
__version__ = "2.0.1"

era5cli/args/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def add_common_args(argument_parser: ArgumentParser) -> None:
145145
type=int,
146146
choices=range(1, 7),
147147
required=False,
148-
default=None,
148+
default=1,
149149
help=textwrap.dedent(
150150
"""
151151
Number of parallel threads to use when

era5cli/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def _execute(input_args: argparse.Namespace) -> True:
7070
land=input_args.land,
7171
overwrite=input_args.overwrite,
7272
dashed_vars=input_args.dashed_varname,
73+
dryrun=input_args.dryrun,
7374
)
7475
era5.fetch(dryrun=input_args.dryrun)
7576
return True

era5cli/fetch.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ def __init__(
116116
land=False,
117117
overwrite=False,
118118
dashed_vars=False,
119+
dryrun=False,
119120
):
120121
"""Initialization of Fetch class."""
121-
self._get_login() # Get login info from config file.
122+
self._get_login(dryrun=dryrun) # Get login info from config file.
122123

123124
self.months = era5cli.utils._zpad_months(months)
124125
"""list(str): List of zero-padded strings of months
@@ -194,7 +195,10 @@ def __init__(
194195
"\n For more info see 'era5cli hourly --help'."
195196
)
196197

197-
def _get_login(self):
198+
def _get_login(self, dryrun=False):
199+
if dryrun: # Don't check keys on dry run
200+
return None
201+
198202
# First check if the config exists, and guide the user if it does not.
199203
key_management.check_era5cli_config()
200204
# Only then load the keys (as they should be there now).
@@ -463,7 +467,10 @@ def _build_request(self, variable, years, months=None):
463467
"year": years,
464468
"month": self.months if months is None else months,
465469
"time": self.hours,
466-
"format": self.outputformat,
470+
"data_format": self.outputformat,
471+
"download_format": (
472+
"unarchived" if self.outputformat.lower() == "netcdf" else "zip"
473+
),
467474
}
468475

469476
if "pressure-levels" in name:
@@ -487,7 +494,6 @@ def _exit(self):
487494
def _getdata(self, variables: list, years: list, outputfile: str, months=None):
488495
"""Fetch variables using cds api call."""
489496
name, request = self._build_request(variables, years, months)
490-
491497
if self.dryrun:
492498
print(name, request, outputfile)
493499
else:

era5cli/key_management.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def attempt_cds_login(url: str, key: str) -> True:
4848
"product_type": "reanalysis",
4949
"date": "2012-12-01",
5050
"time": "14:00",
51-
"format": "netcdf",
51+
"data_format": "netcdf",
5252
},
5353
)
5454
return True

0 commit comments

Comments
 (0)