mpcaHydro 2.2.2__py3-none-any.whl → 2.2.3__py3-none-any.whl
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/data/stations_EQUIS.gpkg +0 -0
- mpcaHydro/data/stations_wiski.gpkg +0 -0
- mpcaHydro/data_manager.py +15 -12
- mpcaHydro/reports.py +3 -3
- {mpcahydro-2.2.2.dist-info → mpcahydro-2.2.3.dist-info}/METADATA +1 -1
- {mpcahydro-2.2.2.dist-info → mpcahydro-2.2.3.dist-info}/RECORD +7 -9
- mpcaHydro/data/stations_wiski.gpkg-shm +0 -0
- mpcaHydro/data/stations_wiski.gpkg-wal +0 -0
- {mpcahydro-2.2.2.dist-info → mpcahydro-2.2.3.dist-info}/WHEEL +0 -0
|
Binary file
|
|
Binary file
|
mpcaHydro/data_manager.py
CHANGED
|
@@ -82,6 +82,9 @@ class dataManager():
|
|
|
82
82
|
self.outlets = outlets #TODO: implement outlets manager class
|
|
83
83
|
self.reports = reportManager(self.db_path)
|
|
84
84
|
|
|
85
|
+
def _set_oracle_credentials(self, oracle_username, oracle_password):
|
|
86
|
+
self.oracle_username = oracle_username
|
|
87
|
+
self.oracle_password = oracle_password
|
|
85
88
|
|
|
86
89
|
def connect_to_oracle(self):
|
|
87
90
|
assert (self.credentials_exist(), 'Oracle credentials not found. Set ORACLE_USER and ORACLE_PASSWORD environment variables or use swd as station_origin')
|
|
@@ -233,6 +236,18 @@ class dataManager():
|
|
|
233
236
|
'baseflow_value': 'observed_baseflow'}, inplace=True)
|
|
234
237
|
return df.dropna(subset=['observed'])
|
|
235
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
|
+
|
|
236
251
|
def get_raw_data(self,station_id,station_origin, to_csv = False):
|
|
237
252
|
with duckdb.connect(self.db_path,read_only=True) as con:
|
|
238
253
|
if station_origin.lower() == 'equis':
|
|
@@ -254,18 +269,6 @@ class dataManager():
|
|
|
254
269
|
df.to_csv(self.folderpath.joinpath(f'{station_id}_raw.csv'), index=False)
|
|
255
270
|
return df
|
|
256
271
|
|
|
257
|
-
def to_csv(self,station_id ,station_origin,folderpath = None):
|
|
258
|
-
if folderpath is None:
|
|
259
|
-
folderpath = self.folderpath
|
|
260
|
-
else:
|
|
261
|
-
folderpath = Path(folderpath)
|
|
262
|
-
df = self.get_station_data([station_id],constituent = 'Q',agg_period = None)
|
|
263
|
-
if len(df) > 0:
|
|
264
|
-
df.to_csv(folderpath.joinpath(station_id + '.csv'))
|
|
265
|
-
else:
|
|
266
|
-
print(f'No {station_id} calibration data available at Station {station_id}')
|
|
267
|
-
|
|
268
|
-
df.to_csv(folderpath.joinpath(station_id + '.csv'))
|
|
269
272
|
|
|
270
273
|
|
|
271
274
|
# class database():
|
mpcaHydro/reports.py
CHANGED
|
@@ -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 *,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
mpcaHydro/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
mpcaHydro/data_manager.py,sha256=
|
|
2
|
+
mpcaHydro/data_manager.py,sha256=muLZe-vNg3oJR1xB6Md_jJ_BeX9SS8IJqPbCaVgvtoI,11569
|
|
3
3
|
mpcaHydro/equis.py,sha256=G4pCjfdDggLTrL0lQeGKAqmPsyO4p-sb1DS4KycUInc,18012
|
|
4
4
|
mpcaHydro/etlCSG.py,sha256=5QT6V2dHvNKC9r5-dspt-NpOmECP2LFw1Lyq1zdkqps,2630
|
|
5
5
|
mpcaHydro/etlSWD.py,sha256=F1KmvIlMplbMjjrRk8uyKFTjLp7tiP3uwbuL1rqsPmU,6516
|
|
@@ -7,7 +7,7 @@ mpcaHydro/etlWISKI.py,sha256=S1dNUe08Y0riJNBaEJDfgmewR8CwPtIaB_3Vw8JujkM,22201
|
|
|
7
7
|
mpcaHydro/etlWPLMN.py,sha256=avLJvWRRxsG35w--OVq0qSCrFjO6G2x0aQ31d9kcYHg,4179
|
|
8
8
|
mpcaHydro/outlets.py,sha256=EvdSoUztV4Lz86SaDiFD6g5jpmrdsXMLpN85x9qChdQ,13761
|
|
9
9
|
mpcaHydro/pywisk.py,sha256=kaxJCPCZHy9oEo9VnoSmFC58qm1sX9fVbtp6nXs7934,13290
|
|
10
|
-
mpcaHydro/reports.py,sha256=
|
|
10
|
+
mpcaHydro/reports.py,sha256=mQypV_rjNhmSpbuCAQmz_2zhouURajQoe6g1m9EocKw,2035
|
|
11
11
|
mpcaHydro/warehouse.py,sha256=wp8LYE71faudzUDLnCQ1npGS7hZtFLdeQBX8ux6Ak84,26024
|
|
12
12
|
mpcaHydro/warehouseManager.py,sha256=zrQIdzVm09rS5pLNr2szaGUS1-036AAW3D-Xf7xUeSs,1432
|
|
13
13
|
mpcaHydro/wiski.py,sha256=pPW7HjABdyvaa-XvpPmBmHvhVTicv5MF7rjkSvJEDtI,13901
|
|
@@ -16,10 +16,8 @@ mpcaHydro/data/EQUIS_PARAMETER_XREF.csv,sha256=XZPrcZan9irSqFd4UasnPo_NQBcjyFodi
|
|
|
16
16
|
mpcaHydro/data/WISKI_EQUIS_XREF.csv,sha256=bPYq-f4-Qc6jsvUgl81lwXBeFamfDe5TjohqUV1XJlg,1244704
|
|
17
17
|
mpcaHydro/data/WISKI_QUALITY_CODES.csv,sha256=PvKBMAUj6pmbhaMUUkAOk0CnxM6RN5oIaXY7MJ_x4T8,9812
|
|
18
18
|
mpcaHydro/data/outlet.duckdb,sha256=yAme7aTdbaMFc_wf005Tzc1Dhu0UAkDSVFNiaa01Y68,2109440
|
|
19
|
-
mpcaHydro/data/stations_EQUIS.gpkg,sha256=
|
|
20
|
-
mpcaHydro/data/stations_wiski.gpkg,sha256=
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
mpcahydro-2.2.
|
|
24
|
-
mpcahydro-2.2.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
25
|
-
mpcahydro-2.2.2.dist-info/RECORD,,
|
|
19
|
+
mpcaHydro/data/stations_EQUIS.gpkg,sha256=STHIAJDHkNbZgSQE389oFcKmmybiASXo5jOVZ8iA5_4,2080768
|
|
20
|
+
mpcaHydro/data/stations_wiski.gpkg,sha256=mgpH9CTa-mqli9A8qR8_EZkYuwGtFRzxB7wA3iOaCi4,946176
|
|
21
|
+
mpcahydro-2.2.3.dist-info/METADATA,sha256=2B0revUUuZ9ZY_SpcxqDIsDhSXNez0j6ysibZEMHImY,591
|
|
22
|
+
mpcahydro-2.2.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
23
|
+
mpcahydro-2.2.3.dist-info/RECORD,,
|
|
Binary file
|
|
File without changes
|
|
File without changes
|