mpcaHydro 2.2.2__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.
Files changed (34) hide show
  1. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/PKG-INFO +1 -1
  2. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/pyproject.toml +1 -1
  3. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/data/stations_EQUIS.gpkg +0 -0
  4. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/data/stations_wiski.gpkg +0 -0
  5. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/data_manager.py +15 -12
  6. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/reports.py +3 -3
  7. mpcahydro-2.2.2/src/mpcaHydro/data/stations_wiski.gpkg-shm +0 -0
  8. mpcahydro-2.2.2/src/mpcaHydro/data/stations_wiski.gpkg-wal +0 -0
  9. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/.gitattributes +0 -0
  10. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/.gitignore +0 -0
  11. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/ERROR.FIL +0 -0
  12. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/README.md +0 -0
  13. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/demo.py +0 -0
  14. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/__init__.py +0 -0
  15. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/data/EQUIS_PARAMETER_XREF.csv +0 -0
  16. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/data/WISKI_EQUIS_XREF.csv +0 -0
  17. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/data/WISKI_QUALITY_CODES.csv +0 -0
  18. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/data/outlet.duckdb +0 -0
  19. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/equis.py +0 -0
  20. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/etlCSG.py +0 -0
  21. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/etlSWD.py +0 -0
  22. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/etlWISKI.py +0 -0
  23. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/etlWPLMN.py +0 -0
  24. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/outlets.py +0 -0
  25. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/pywisk.py +0 -0
  26. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/warehouse.py +0 -0
  27. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/warehouseManager.py +0 -0
  28. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/wiski.py +0 -0
  29. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/src/mpcaHydro/xref.py +0 -0
  30. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/tests/integration/observations.duckdb +0 -0
  31. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/tests/integration/test_dataManager.py +0 -0
  32. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/tests/integration/test_warehouse.duckdb +0 -0
  33. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/tests/integration/test_warehouse.py +0 -0
  34. {mpcahydro-2.2.2 → mpcahydro-2.2.3}/tests/unit/test_equis.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mpcaHydro
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: Python package for downloading MPCA hydrology data
5
5
  Project-URL: Homepage, https://github.com/mfratkin1/mpcaHydro
6
6
  Author-email: Mulu Fratkin <michael.fratkin@state.mn.us>
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  name = "mpcaHydro"
7
7
  urls = { "Homepage" = "https://github.com/mfratkin1/mpcaHydro" } # ? Add this!
8
- version = "2.2.2"
8
+ version = "2.2.3"
9
9
  dependencies = [
10
10
  "pandas",
11
11
  "requests",
@@ -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():
@@ -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 constituent_summary(self,constituent: str = None):
15
+ def station_summary(self,constituent: str = None):
16
16
  with duckdb.connect(self.db_path,read_only=True) as con:
17
- return constituent_summary(con,constituent)
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 constituent_summary(con: duckdb.DuckDBPyConnection,constituent: str = None):
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