From 0a6c4ee487dab842a8f7d4a8f72b65461e6f97b8 Mon Sep 17 00:00:00 2001 From: ouyangwenyu Date: Sun, 17 Dec 2023 16:44:59 +0800 Subject: [PATCH] unify read_area interface --- hydrodataset/caravan.py | 3 --- hydrodataset/lamah.py | 2 +- hydrodataset/mopex.py | 2 +- hydrodataset/multi_datasets.py | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/hydrodataset/caravan.py b/hydrodataset/caravan.py index 75e0614..ad1ff21 100644 --- a/hydrodataset/caravan.py +++ b/hydrodataset/caravan.py @@ -444,9 +444,6 @@ def _read_constant_cols_global(self, var_lst, gage_id_lst, is_return_dict): data = pd.concat(attr) return data.to_dict("index") if is_return_dict else data.values - def read_basin_area(self, object_ids) -> np.array: - return self.read_constant_cols(object_ids, ["area_calc"], is_return_dict=False) - def read_mean_prep(self, object_ids) -> np.array: return self.read_constant_cols(object_ids, ["p_mean"], is_return_dict=False) diff --git a/hydrodataset/lamah.py b/hydrodataset/lamah.py index a0c053d..5209183 100644 --- a/hydrodataset/lamah.py +++ b/hydrodataset/lamah.py @@ -443,7 +443,7 @@ def read_constant_cols( out = temp[:, ind_var] return (out, var_dict, f_dict) if is_return_dict else out - def read_basin_area(self, object_ids) -> np.array: + def read_area(self, object_ids) -> np.array: return self.read_constant_cols(object_ids, ["area_calc"], is_return_dict=False) def read_mean_prep(self, object_ids) -> np.array: diff --git a/hydrodataset/mopex.py b/hydrodataset/mopex.py index e1b0c30..7c67b8c 100644 --- a/hydrodataset/mopex.py +++ b/hydrodataset/mopex.py @@ -368,7 +368,7 @@ def read_constant_cols( out = temp[:, ind_var] return (out, var_dict, f_dict) if is_return_dict else out - def read_basin_area(self, object_ids) -> np.array: + def read_area(self, object_ids) -> np.array: return self.read_constant_cols( object_ids, ["Drainage_Area_km2"], is_return_dict=False ) diff --git a/hydrodataset/multi_datasets.py b/hydrodataset/multi_datasets.py index 95e1bfe..e80a9b3 100644 --- a/hydrodataset/multi_datasets.py +++ b/hydrodataset/multi_datasets.py @@ -1008,7 +1008,7 @@ def get_other_cols(self) -> dict: def read_other_cols(self, object_ids=None, other_cols=None, **kwargs): pass - def read_basin_area(self, object_ids) -> np.array: + def read_area(self, object_ids) -> np.array: return self.read_constant_cols(object_ids, ["area"], is_return_dict=False) def read_mean_prep(self, object_ids) -> np.array: