From 5ff7a1ea285069578f724fb1e20f305181f53caa Mon Sep 17 00:00:00 2001 From: eduardoAcunaEspinoza Date: Thu, 22 Feb 2024 15:07:29 +0100 Subject: [PATCH] changes to solve deprecation warnings --- LSTM/LSTM_CAMELS_GB.ipynb | 2 +- LSTM/LSTM_CAMELS_US.ipynb | 2 +- aux_functions/functions_datasets.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LSTM/LSTM_CAMELS_GB.ipynb b/LSTM/LSTM_CAMELS_GB.ipynb index c0287d7..8c48471 100644 --- a/LSTM/LSTM_CAMELS_GB.ipynb +++ b/LSTM/LSTM_CAMELS_GB.ipynb @@ -259,7 +259,7 @@ " \n", " # create a list that contain the indexes (basin, day) of the valid samples\n", " valid_samples = np.argwhere(flag == 1)\n", - " self.valid_entities.extend([(id, int(f)) for f in valid_samples])\n", + " self.valid_entities.extend([(id, int(f[0])) for f in valid_samples])\n", " \n", " # only store data if this basin has at least one valid sample in the given period\n", " if valid_samples.size>0:\n", diff --git a/LSTM/LSTM_CAMELS_US.ipynb b/LSTM/LSTM_CAMELS_US.ipynb index 414edae..a44dc6b 100644 --- a/LSTM/LSTM_CAMELS_US.ipynb +++ b/LSTM/LSTM_CAMELS_US.ipynb @@ -264,7 +264,7 @@ " \n", " # create a list that contain the indexes (basin, day) of the valid samples\n", " valid_samples = np.argwhere(flag == 1)\n", - " self.valid_entities.extend([(id, int(f)) for f in valid_samples])\n", + " self.valid_entities.extend([(id, int(f[0])) for f in valid_samples])\n", " \n", " # only store data if this basin has at least one valid sample in the given period\n", " if valid_samples.size>0:\n", diff --git a/aux_functions/functions_datasets.py b/aux_functions/functions_datasets.py index fab8a99..5d4ab29 100644 --- a/aux_functions/functions_datasets.py +++ b/aux_functions/functions_datasets.py @@ -234,7 +234,7 @@ def _load_discharge(path_data: str, catch_id: str, area: int)-> pd.DataFrame: file_path = file_path[0] col_names = ['basin', 'Year', 'Mnth', 'Day', 'QObs', 'flag'] - df = pd.read_csv(file_path, sep='\s+', header=None, names=col_names) + df = pd.read_csv(file_path, sep=r'\s+', header=None, names=col_names) df["date"] = pd.to_datetime(df.Year.map(str) + "/" + df.Mnth.map(str) + "/" + df.Day.map(str), format="%Y/%m/%d") df = df.set_index("date")