Skip to content

Commit 3c30452

Browse files
author
Max Jones
authored
Merge pull request #238 from carbonplan/pyramid-weights-optional
2 parents 2e353d7 + 4f3d6ff commit 3c30452

File tree

1 file changed

+5
-3
lines changed
  • cmip6_downscaling/methods/common

1 file changed

+5
-3
lines changed

cmip6_downscaling/methods/common/tasks.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from dataclasses import asdict
99
from pathlib import PosixPath
1010

11-
import datatree
1211
import datatree as dt
1312
import fsspec
1413
import pandas as pd
@@ -509,7 +508,7 @@ def _pyramid_postprocess(dt: dt.DataTree, levels: int, other_chunks: dict = None
509508

510509
@task(log_stdout=True)
511510
def pyramid(
512-
ds_path: UPath, weights_pyramid_path: str, levels: int = 2, other_chunks: dict = None
511+
ds_path: UPath, weights_pyramid_path: str = None, levels: int = 2, other_chunks: dict = None
513512
) -> UPath:
514513
'''Task to create a data pyramid from an xarray Dataset
515514
@@ -544,7 +543,10 @@ def pyramid(
544543

545544
ds.attrs.update({'title': ds.attrs['title']}, **get_cf_global_attrs(version=version))
546545
target_pyramid = dt.open_datatree('az://static/target-pyramid', engine='zarr')
547-
weights_pyramid = datatree.open_datatree(weights_pyramid_path, engine='zarr')
546+
if weights_pyramid_path is not None:
547+
weights_pyramid = dt.open_datatree(weights_pyramid_path, engine='zarr')
548+
else:
549+
weights_pyramid = None
548550
# create pyramid
549551
dta = pyramid_regrid(
550552
ds,

0 commit comments

Comments
 (0)