mpcaHydro 2.2.1__tar.gz → 2.2.3__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.
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/PKG-INFO +1 -1
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/pyproject.toml +1 -1
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/data/stations_EQUIS.gpkg +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/data/stations_wiski.gpkg +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/data_manager.py +15 -14
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/reports.py +3 -3
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/.gitattributes +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/.gitignore +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/ERROR.FIL +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/README.md +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/demo.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/__init__.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/data/EQUIS_PARAMETER_XREF.csv +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/data/WISKI_EQUIS_XREF.csv +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/data/WISKI_QUALITY_CODES.csv +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/data/outlet.duckdb +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/equis.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/etlCSG.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/etlSWD.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/etlWISKI.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/etlWPLMN.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/outlets.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/pywisk.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/warehouse.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/warehouseManager.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/wiski.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/src/mpcaHydro/xref.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/tests/integration/observations.duckdb +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/tests/integration/test_dataManager.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/tests/integration/test_warehouse.duckdb +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/tests/integration/test_warehouse.py +0 -0
- {mpcahydro-2.2.1 → mpcahydro-2.2.3}/tests/unit/test_equis.py +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -5,8 +5,6 @@ Created on Fri Jun 3 10:01:14 2022
|
|
|
5
5
|
@author: mfratki
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
from copy import replace
|
|
9
|
-
import pandas as pd
|
|
10
8
|
#from abc import abstractmethod
|
|
11
9
|
from pathlib import Path
|
|
12
10
|
from mpcaHydro import etlSWD
|
|
@@ -84,6 +82,9 @@ class dataManager():
|
|
|
84
82
|
self.outlets = outlets #TODO: implement outlets manager class
|
|
85
83
|
self.reports = reportManager(self.db_path)
|
|
86
84
|
|
|
85
|
+
def _set_oracle_credentials(self, oracle_username, oracle_password):
|
|
86
|
+
self.oracle_username = oracle_username
|
|
87
|
+
self.oracle_password = oracle_password
|
|
87
88
|
|
|
88
89
|
def connect_to_oracle(self):
|
|
89
90
|
assert (self.credentials_exist(), 'Oracle credentials not found. Set ORACLE_USER and ORACLE_PASSWORD environment variables or use swd as station_origin')
|
|
@@ -235,6 +236,18 @@ class dataManager():
|
|
|
235
236
|
'baseflow_value': 'observed_baseflow'}, inplace=True)
|
|
236
237
|
return df.dropna(subset=['observed'])
|
|
237
238
|
|
|
239
|
+
def get_station_data(self,station_id,station_origin, to_csv = False):
|
|
240
|
+
with duckdb.connect(self.db_path,read_only=True) as con:
|
|
241
|
+
query = '''
|
|
242
|
+
SELECT *
|
|
243
|
+
FROM analytics.observations
|
|
244
|
+
WHERE station_id = ? AND station_origin = ?'''
|
|
245
|
+
df = con.execute(query,[station_id,station_origin]).fetch_df()
|
|
246
|
+
|
|
247
|
+
if to_csv:
|
|
248
|
+
df.to_csv(self.folderpath.joinpath(f'{station_id}.csv'), index=False)
|
|
249
|
+
return df
|
|
250
|
+
|
|
238
251
|
def get_raw_data(self,station_id,station_origin, to_csv = False):
|
|
239
252
|
with duckdb.connect(self.db_path,read_only=True) as con:
|
|
240
253
|
if station_origin.lower() == 'equis':
|
|
@@ -256,18 +269,6 @@ class dataManager():
|
|
|
256
269
|
df.to_csv(self.folderpath.joinpath(f'{station_id}_raw.csv'), index=False)
|
|
257
270
|
return df
|
|
258
271
|
|
|
259
|
-
def to_csv(self,station_id ,station_origin,folderpath = None):
|
|
260
|
-
if folderpath is None:
|
|
261
|
-
folderpath = self.folderpath
|
|
262
|
-
else:
|
|
263
|
-
folderpath = Path(folderpath)
|
|
264
|
-
df = self.get_station_data([station_id],constituent = 'Q',agg_period = None)
|
|
265
|
-
if len(df) > 0:
|
|
266
|
-
df.to_csv(folderpath.joinpath(station_id + '.csv'))
|
|
267
|
-
else:
|
|
268
|
-
print(f'No {station_id} calibration data available at Station {station_id}')
|
|
269
|
-
|
|
270
|
-
df.to_csv(folderpath.joinpath(station_id + '.csv'))
|
|
271
272
|
|
|
272
273
|
|
|
273
274
|
# class database():
|
|
@@ -12,9 +12,9 @@ class reportManager():
|
|
|
12
12
|
with duckdb.connect(self.db_path,read_only=True) as con:
|
|
13
13
|
return wiski_qc_counts(con)
|
|
14
14
|
|
|
15
|
-
def
|
|
15
|
+
def station_summary(self,constituent: str = None):
|
|
16
16
|
with duckdb.connect(self.db_path,read_only=True) as con:
|
|
17
|
-
return
|
|
17
|
+
return station_summary(con,constituent)
|
|
18
18
|
|
|
19
19
|
def station_reach_pairs(self):
|
|
20
20
|
with duckdb.connect(self.db_path,read_only=True) as con:
|
|
@@ -51,7 +51,7 @@ def wiski_qc_counts(con: duckdb.DuckDBPyConnection):
|
|
|
51
51
|
df = con.execute(query).fetch_df()
|
|
52
52
|
return df
|
|
53
53
|
|
|
54
|
-
def
|
|
54
|
+
def station_summary(con: duckdb.DuckDBPyConnection,constituent: str = None):
|
|
55
55
|
|
|
56
56
|
query = '''
|
|
57
57
|
SELECT *,
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|