mpcaHydro 2.0.2__tar.gz → 2.0.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mpcaHydro
3
- Version: 2.0.2
3
+ Version: 2.0.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.0.2"
8
+ version = "2.0.3"
9
9
  dependencies = [
10
10
  "pandas",
11
11
  "requests",
@@ -85,6 +85,26 @@ def construct_database(folderpath):
85
85
  con.execute(query,[datafiles])
86
86
 
87
87
 
88
+ def constituent_summary(db_path):
89
+ with duckdb.connect(db_path) as con:
90
+ query = '''
91
+ SELECT
92
+ station_id,
93
+ source,
94
+ constituent,
95
+ COUNT(*) AS sample_count,
96
+ year(MIN(datetime)) AS start_date,
97
+ year(MAX(datetime)) AS end_date
98
+ FROM
99
+ observations
100
+ GROUP BY
101
+ constituent, station_id,source
102
+ ORDER BY
103
+ sample_count;'''
104
+
105
+ res = con.execute(query)
106
+ return res.fetch_df()
107
+
88
108
 
89
109
  class dataManager():
90
110
 
@@ -94,7 +114,10 @@ class dataManager():
94
114
  self.folderpath = Path(folderpath)
95
115
  self.db_path = self.folderpath.joinpath('observations.duckdb')
96
116
 
97
-
117
+ def _reconstruct_database(self):
118
+ construct_database(self.folderpath)
119
+
120
+
98
121
  def constituent_summary(self,constituents = None):
99
122
  with duckdb.connect(self.db_path) as con:
100
123
  if constituents is None:
File without changes
File without changes
File without changes
File without changes