Skip to content

Commit 03c54a7

Browse files
committed
add support for pydap
1 parent 6883cb8 commit 03c54a7

File tree

5 files changed

+315
-2
lines changed

5 files changed

+315
-2
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ dependencies = [
2121
"dask",
2222
"esgpull>=0.9.3",
2323
"h5netcdf",
24+
"jinja2", # See: https://github.com/pydap/pydap/issues/596
25+
"pydap",
2426
"requests",
2527
"tqdm",
2628
"xarray",

tests/test_20_open_dataset.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,31 @@ def test_open_dataset(tmp_path: Path, index_node: str, download: bool) -> None:
8383
"CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3-CC.ssp585.r1i1p1f1.Amon.tas.gr.v20210113",
8484
"CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3-CC.ssp585.r1i1p1f1.fx.areacella.gr.v20210113",
8585
]
86+
87+
88+
def test_open_dataset_identical(tmp_path: Path, index_node: str) -> None:
89+
esgpull_path = tmp_path / "esgpull"
90+
selection = {
91+
"query": [
92+
'"tas_Amon_EC-Earth3-CC_ssp245_r1i1p1f1_gr_201901-201912.nc"',
93+
]
94+
}
95+
ds_pydap = xr.open_dataset(
96+
selection, # type: ignore[arg-type]
97+
esgpull_path=esgpull_path,
98+
engine="esgf",
99+
index_node=index_node,
100+
download=False,
101+
chunks={},
102+
use_pydap=True,
103+
)
104+
ds_h5netcdf = xr.open_dataset(
105+
selection, # type: ignore[arg-type]
106+
esgpull_path=esgpull_path,
107+
engine="esgf",
108+
index_node=index_node,
109+
download=False,
110+
chunks={},
111+
use_pydap=False,
112+
)
113+
xr.testing.assert_identical(ds_pydap, ds_h5netcdf)

0 commit comments

Comments
 (0)