Skip to content

Commit 1035d99

Browse files
committed
updates per reviewer suggestions
1 parent 19b00e6 commit 1035d99

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

dodola/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ def dodola_cli(debug):
5555
@click.argument("x", required=True)
5656
@click.argument("out", required=True)
5757
@click.option(
58-
"--drop_leapdays/--no-drop_leapdays",
58+
"--drop-leapdays/--no-drop-leapdays",
5959
default=True,
6060
help="Whether to remove leap days",
6161
)
6262
def cleancmip6(x, out, drop_leapdays):
6363
"""Clean and standardize CMIP6 GCM to 'out'. If drop-leapdays option is set, remove leap days"""
64-
services.clean_cmip6(x, out, drop_leapdays)
64+
services.clean_cmip6(x, out, drop_leapdays, storage=_authenticate_storage())
6565

6666

6767
@dodola_cli.command(help="Remove leap days and update calendar")
6868
@click.argument("x", required=True)
6969
@click.argument("out", required=True)
7070
def removeleapdays(x, out):
7171
""" Remove leap days and update calendar attribute"""
72-
services.remove_leapdays(x, out)
72+
services.remove_leapdays(x, out, storage=_authenticate_storage())
7373

7474

7575
@dodola_cli.command(help="Bias-correct GCM on observations")

dodola/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ def xesmf_regrid(x, domain, method, weights_path=None):
120120
return regridder(x)
121121

122122

123-
def standardize_gcm(ds, leapday_removal):
123+
def standardize_gcm(ds, leapday_removal=True):
124124
"""
125125
126126
Parameters
127127
----------
128128
x : xr.Dataset
129-
leapday_removal : bool
129+
leapday_removal : bool, optional
130130
131131
Returns
132132
-------

dodola/services.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,19 @@ def regrid(x, out, method, storage, domain_file, weights_path=None):
165165

166166

167167
@log_service
168-
def clean_cmip6(x, out, storage, leapday_removal=True):
168+
def clean_cmip6(x, out, leapday_removal, storage):
169169
"""Cleans and standardizes CMIP6 GCM
170170
171171
Parameters
172172
----------
173173
x : str
174-
Storage URL to input xr.Dataset that will be regridded.
174+
Storage URL to input xr.Dataset that will be cleaned.
175175
out : str
176-
Storage URL to write regridded output to.
177-
storage : dodola.repository._ZarrRepo
178-
Storage abstraction for data IO.
176+
Storage URL to write cleaned GCM output to.
179177
leapday_removal : bool
180178
Whether or not to remove leap days.
179+
storage : dodola.repository._ZarrRepo
180+
Storage abstraction for data IO.
181181
"""
182182
ds = storage.read(x)
183183
cleaned_ds = standardize_gcm(ds, leapday_removal)

dodola/tests/test_services.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ def _datafactory(x, start_time="1950-01-01"):
3939
)
4040
return out
4141

42+
4243
def _gcmfactory(x, start_time="1950-01-01"):
43-
"""Populate xr.Dataset with synthetic data for testing"""
44+
"""Populate xr.Dataset with synthetic GCM data for testing
45+
that includes extra dimensions and leap days to be removed.
46+
"""
4447
start_time = str(start_time)
4548
if x.ndim != 1:
4649
raise ValueError("'x' needs dim of one")
@@ -69,6 +72,7 @@ def _gcmfactory(x, start_time="1950-01-01"):
6972
# out['time'] = out['time'].assign_attrs({'calendar': 'standard'})
7073
return out
7174

75+
7276
@pytest.fixture
7377
def domain_file(request):
7478
""" Creates a fake domain Dataset for testing"""

0 commit comments

Comments
 (0)