loone-data-prep 0.1.5__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/PKG-INFO +1 -1
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/LOONE_DATA_PREP.py +1 -1
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/flow_data/forecast_bias_correction.py +19 -1
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/flow_data/get_forecast_flows.py +4 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/utils.py +4 -2
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep.egg-info/PKG-INFO +1 -1
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/pyproject.toml +1 -1
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/LICENSE +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/README.md +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/GEOGLOWS_LOONE_DATA_PREP.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/__init__.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/data_analyses_fns.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/flow_data/S65E_total.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/flow_data/__init__.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/flow_data/get_inflows.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/flow_data/get_outflows.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/flow_data/hydro.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/water_level_data/__init__.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/water_level_data/get_all.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/water_level_data/hydro.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/water_quality_data/__init__.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/water_quality_data/get_inflows.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/water_quality_data/get_lake_wq.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/water_quality_data/wq.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/weather_data/__init__.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/weather_data/get_all.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/weather_data/weather.py +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep.egg-info/SOURCES.txt +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep.egg-info/dependency_links.txt +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep.egg-info/requires.txt +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep.egg-info/top_level.txt +0 -0
- {loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: loone_data_prep
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: Prepare data to run the LOONE model.
|
|
5
5
|
Author-email: Osama Tarabih <osamatarabih@usf.edu>
|
|
6
6
|
Maintainer-email: Michael Souffront <msouffront@aquaveo.com>, James Dolinar <jdolinar@aquaveo.com>
|
|
@@ -418,7 +418,7 @@ def main(input_dir: str, output_dir: str) -> None:
|
|
|
418
418
|
Stg_3A28 = pd.read_csv(f'{input_dir}/Stg_3A28.csv')
|
|
419
419
|
Stg_3A28 = DF_Date_Range(Stg_3A28, St_Yr, St_M, St_D, En_Yr, En_M, En_D)
|
|
420
420
|
WCA_Stg = pd.DataFrame(Stg_3A28['date'], columns=['date'])
|
|
421
|
-
WCA_Stg['3A-NW'] = Stg_3ANW[
|
|
421
|
+
WCA_Stg['3A-NW'] = Stg_3ANW.iloc[:, -1].values
|
|
422
422
|
WCA_Stg['2A-17'] = Stg_2A17.iloc[:, -1].values
|
|
423
423
|
WCA_Stg['3A-3'] = Stg_3A3.iloc[:, -1].values
|
|
424
424
|
WCA_Stg['3A-4'] = Stg_3A4.iloc[:, -1].values
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import sys
|
|
2
|
+
import os
|
|
2
3
|
import pandas as pd
|
|
3
4
|
import geoglows
|
|
4
5
|
|
|
@@ -12,6 +13,7 @@ def get_bias_corrected_data(
|
|
|
12
13
|
observed_data_path: str,
|
|
13
14
|
station_ensembles: pd.DataFrame,
|
|
14
15
|
station_stats: pd.DataFrame,
|
|
16
|
+
cache_path: str = None,
|
|
15
17
|
) -> dict:
|
|
16
18
|
# Load the observed data from a CSV file
|
|
17
19
|
observed_data = pd.read_csv(
|
|
@@ -34,7 +36,23 @@ def get_bias_corrected_data(
|
|
|
34
36
|
prepared_od = prep_observed_data(observed_data)
|
|
35
37
|
|
|
36
38
|
# Get the historical simulation data for the given reach ID
|
|
37
|
-
historical_data =
|
|
39
|
+
historical_data = None
|
|
40
|
+
|
|
41
|
+
if cache_path is None:
|
|
42
|
+
historical_data = geoglows.streamflow.historic_simulation(reach_id)
|
|
43
|
+
else:
|
|
44
|
+
# Create the geoglows cache directory if it doesn't exist
|
|
45
|
+
geoglows_cache_path = os.path.join(cache_path, 'geoglows_cache')
|
|
46
|
+
if not os.path.exists(geoglows_cache_path):
|
|
47
|
+
os.makedirs(geoglows_cache_path)
|
|
48
|
+
|
|
49
|
+
# Check if the historical simulation data is already cached
|
|
50
|
+
if os.path.exists(os.path.join(geoglows_cache_path, f'{reach_id}_historic_simulation.csv')):
|
|
51
|
+
historical_data = pd.read_csv(os.path.join(geoglows_cache_path, f'{reach_id}_historic_simulation.csv'), index_col=0)
|
|
52
|
+
historical_data.index = pd.to_datetime(historical_data.index)
|
|
53
|
+
else:
|
|
54
|
+
historical_data = geoglows.streamflow.historic_simulation(reach_id)
|
|
55
|
+
historical_data.to_csv(os.path.join(geoglows_cache_path, f'{reach_id}_historic_simulation.csv'))
|
|
38
56
|
|
|
39
57
|
# Correct the forecast bias in the station ensembles
|
|
40
58
|
station_ensembles = geoglows.bias.correct_forecast(
|
{loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/flow_data/get_forecast_flows.py
RENAMED
|
@@ -366,6 +366,7 @@ def main(
|
|
|
366
366
|
forecast_date: str = FORECAST_DATE,
|
|
367
367
|
bias_corrected: bool = False,
|
|
368
368
|
observed_data_dir: str | None = None,
|
|
369
|
+
cache_path: str | None = None,
|
|
369
370
|
):
|
|
370
371
|
"""Downloads the flow forecasts for the given station ids and writes them
|
|
371
372
|
out as .csv files.
|
|
@@ -379,6 +380,8 @@ def main(
|
|
|
379
380
|
Default is False.
|
|
380
381
|
observed_data_dir (str): The path to the observed flow data directory
|
|
381
382
|
(only needed if bias_corrected is True).
|
|
383
|
+
cache_path (str): The path to the cache directory for geoglows data.
|
|
384
|
+
Should hold a directory named geoglows_cache that holds the cached files. Use None to not use a cache.
|
|
382
385
|
"""
|
|
383
386
|
# Local Variables
|
|
384
387
|
reach_ids = {}
|
|
@@ -428,6 +431,7 @@ def main(
|
|
|
428
431
|
observed_data_path,
|
|
429
432
|
station_ensembles,
|
|
430
433
|
station_stats,
|
|
434
|
+
cache_path,
|
|
431
435
|
)
|
|
432
436
|
|
|
433
437
|
ensembles_to_csv(
|
|
@@ -4,6 +4,7 @@ import datetime
|
|
|
4
4
|
import math
|
|
5
5
|
from glob import glob
|
|
6
6
|
from calendar import monthrange
|
|
7
|
+
import traceback
|
|
7
8
|
import numpy as np
|
|
8
9
|
import pandas as pd
|
|
9
10
|
from retry import retry
|
|
@@ -635,8 +636,9 @@ def nutrient_prediction(
|
|
|
635
636
|
predicted_column.columns = [column_name]
|
|
636
637
|
|
|
637
638
|
prediction_columns.append(predicted_column)
|
|
638
|
-
except RuntimeWarning:
|
|
639
|
-
|
|
639
|
+
except RuntimeWarning as e:
|
|
640
|
+
print(f"Unexpected RuntimeWarning: {str(e)}")
|
|
641
|
+
traceback.print_exc()
|
|
640
642
|
|
|
641
643
|
# Concat individual ensemble columns together into one pandas DataFrame
|
|
642
644
|
out_dataframe = pd.concat(objs=prediction_columns, axis="columns")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: loone_data_prep
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: Prepare data to run the LOONE model.
|
|
5
5
|
Author-email: Osama Tarabih <osamatarabih@usf.edu>
|
|
6
6
|
Maintainer-email: Michael Souffront <msouffront@aquaveo.com>, James Dolinar <jdolinar@aquaveo.com>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/water_level_data/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/water_quality_data/__init__.py
RENAMED
|
File without changes
|
{loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/water_quality_data/get_inflows.py
RENAMED
|
File without changes
|
{loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep/water_quality_data/get_lake_wq.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{loone_data_prep-0.1.5 → loone_data_prep-0.1.6}/loone_data_prep.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|