Skip to content

Commit ce4b2eb

Browse files
- Pass through quiet arg correctly, remove special time range parsing - no capacity for this in intake-esm
- Add test for warning on empty search
1 parent b911086 commit ce4b2eb

3 files changed

Lines changed: 85 additions & 78 deletions

File tree

esmvalcore/io/intake_esm.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@
2929
from dataclasses import dataclass, field
3030
from typing import TYPE_CHECKING, Any
3131

32-
import isodate
33-
34-
from esmvalcore.dataset import _isglob
35-
from esmvalcore.io.local import _parse_period
3632
from esmvalcore.io.protocol import DataElement, DataSource
3733
from esmvalcore.iris_helpers import dataset_to_iris
3834

@@ -121,15 +117,15 @@ def attributes(self) -> dict[str, Any]:
121117
def attributes(self, value: dict[str, Any]) -> None:
122118
self._attributes = value
123119

124-
def to_iris(self) -> iris.cube.CubeList:
120+
def to_iris(self, quiet: bool = True) -> iris.cube.CubeList:
125121
"""Load the data as Iris cubes.
126122
127123
Returns
128124
-------
129125
:
130126
The loaded data.
131127
"""
132-
files = _to_path_dict(self.catalog, quiet=True)[self.name]
128+
files = _to_path_dict(self.catalog, quiet=quiet)[self.name]
133129

134130
# Might want to pass through args/kwargs here? Ie.
135131
dataset = self.catalog.to_dask()
@@ -202,16 +198,6 @@ def find_data(self, **facets: FacetValue) -> list[IntakeEsmDataset]:
202198
for our_facet, their_facet in self.facets.items()
203199
if our_facet in normalized_facets
204200
}
205-
if (
206-
"timerange" in facets and not _isglob(facets["timerange"]) # type: ignore[operator]
207-
):
208-
start, end = _parse_period(facets["timerange"])
209-
query["file_start"] = isodate.date_isoformat(
210-
isodate.parse_date(start.split("T")[0]),
211-
)
212-
query["file_end"] = isodate.date_isoformat(
213-
isodate.parse_date(end.split("T")[0]),
214-
)
215201

216202
res = self.catalog.search(**query)
217203

0 commit comments

Comments
 (0)