Skip to content

Commit

Permalink
replaced open_dataset with load_dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Griesfeller committed May 6, 2024
1 parent d7ddc83 commit 458edb7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/pyaro_readers/harpreader/harpreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(
data = NpStructuredData(_var, units)
self._data[_var] = data

dummy = self._get_data_from_single_file(
self._get_data_from_single_file(
_file,
_var,
)
Expand Down Expand Up @@ -139,11 +139,10 @@ def _get_data_from_single_file(
Data instance to which the data will be appended to in-place.
"""
dt = xr.open_dataset(file)
dt = xr.load_dataset(file)

if dt.attrs.get("Conventions", None) != "HARP-1.0":
raise ValueError(f"File {file} is not a HARP file.")
return False

values = dt[varname].to_numpy()
# take station name from filename since there is no name in the data...
Expand Down Expand Up @@ -190,8 +189,6 @@ def _get_data_from_single_file(
"long_name": stat_name,
}
)
dt.close()
return True

def _unfiltered_variables(self) -> list[str]:
"""Returns a list of the variable names.
Expand Down

0 comments on commit 458edb7

Please sign in to comment.