hydroanomaly 0.2.0__tar.gz → 0.3.0__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.
@@ -0,0 +1,400 @@
1
+ Metadata-Version: 2.4
2
+ Name: hydroanomaly
3
+ Version: 0.3.0
4
+ Summary: A Python package for hydro anomaly detection
5
+ Home-page: https://github.com/yourusername/hydroanomaly
6
+ Author: Your Name
7
+ Author-email: Your Name <your.email@example.com>
8
+ License-Expression: MIT
9
+ Project-URL: Homepage, https://github.com/yourusername/hydroanomaly
10
+ Project-URL: Bug Reports, https://github.com/yourusername/hydroanomaly/issues
11
+ Project-URL: Source, https://github.com/yourusername/hydroanomaly
12
+ Keywords: python,package,hydro,anomaly,detection
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.6
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: pandas>=1.3.0
19
+ Requires-Dist: numpy>=1.20.0
20
+ Requires-Dist: requests>=2.25.1
21
+ Requires-Dist: matplotlib>=3.3.0
22
+ Requires-Dist: seaborn>=0.11.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=6.0; extra == "dev"
25
+ Requires-Dist: black>=21.0; extra == "dev"
26
+ Requires-Dist: flake8>=3.8; extra == "dev"
27
+ Requires-Dist: mypy>=0.800; extra == "dev"
28
+ Dynamic: author
29
+ Dynamic: home-page
30
+ Dynamic: license-file
31
+ Dynamic: requires-python
32
+
33
+ # HydroAnomaly
34
+
35
+ A Python package for hydro anomaly detection, **USGS water data retrieval**, and **time series visualization**.
36
+
37
+ [![PyPI version](https://badge.fury.io/py/hydroanomaly.svg)](https://badge.fury.io/py/hydroanomaly)
38
+ [![Downloads](https://pepy.tech/badge/hydroanomaly)](https://pepy.tech/project/hydroanomaly)
39
+
40
+ ## Features
41
+
42
+ - 🌊 **USGS Data Retrieval**: Get real-time and historical water data from USGS Water Services
43
+ - 📊 **Time Series Plotting**: Beautiful, professional visualizations for your water data
44
+ - 📈 **Multi-Parameter Analysis**: Compare multiple parameters or gages in one plot
45
+ - 📋 **Statistical Analysis**: Built-in statistics and distribution plots
46
+ - 🎯 **Easy to Use**: Simple functions for quick data exploration
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ pip install hydroanomaly
52
+ ```
53
+
54
+ ## � USGS Data Retrieval
55
+
56
+ Easily retrieve real-time and historical water data from USGS Water Services:
57
+
58
+ ```python
59
+ import hydroanomaly
60
+
61
+ # ------------------------
62
+ # User-defined settings
63
+ # ------------------------
64
+ site_number = "294643095035200" # USGS site number
65
+ parameter_code = "63680" # Turbidity
66
+ start_date = "2020-01-01"
67
+ end_date = "2024-12-30"
68
+
69
+ # ------------------------
70
+ # Data Extraction from USGS
71
+ # ------------------------
72
+ data = hydroanomaly.get_usgs_data(
73
+ site_number=site_number,
74
+ parameter_code=parameter_code,
75
+ start_date=start_date,
76
+ end_date=end_date,
77
+ save_to_file="USGS_turbidity.csv",
78
+ parameter_name="Turbidity"
79
+ )
80
+
81
+ print(f"Retrieved {len(data)} data points!")
82
+ print(data.head())
83
+ ```
84
+
85
+ ## 📊 Time Series Plotting
86
+
87
+ Create beautiful visualizations of your water data:
88
+
89
+ ```python
90
+ import hydroanomaly
91
+
92
+ # Get some data
93
+ data = hydroanomaly.get_discharge("08158000", "2023-01-01", "2023-01-31")
94
+
95
+ # Quick plot (simplest method)
96
+ hydroanomaly.quick_plot(data, "Colorado River Discharge")
97
+
98
+ # Professional plot with statistics
99
+ fig = hydroanomaly.plot_usgs_data(
100
+ data=data,
101
+ parameter_name="Discharge (cfs)",
102
+ title="Colorado River at Austin - January 2023",
103
+ save_path="discharge_plot.png"
104
+ )
105
+
106
+ # Compare multiple gages
107
+ austin_data = hydroanomaly.get_discharge("08158000", "2023-01-01", "2023-01-07")
108
+ nola_data = hydroanomaly.get_discharge("07374000", "2023-01-01", "2023-01-07")
109
+
110
+ gage_data = {
111
+ "Colorado River (Austin)": austin_data,
112
+ "Mississippi River (New Orleans)": nola_data
113
+ }
114
+
115
+ fig = hydroanomaly.plot_multiple_gages(
116
+ data_dict=gage_data,
117
+ parameter_name="Discharge (cfs)",
118
+ title="River Discharge Comparison"
119
+ )
120
+ ```
121
+
122
+ ## Quick Start
123
+
124
+ ```python
125
+ import hydroanomaly
126
+
127
+ # Get USGS data
128
+ data = hydroanomaly.get_discharge("08158000", "2023-01-01", "2023-01-31")
129
+ print(f"Retrieved {len(data)} discharge measurements")
130
+
131
+ # Plot the data
132
+ hydroanomaly.quick_plot(data, "Colorado River Discharge")
133
+
134
+ # Basic greeting functionality
135
+ print(hydroanomaly.greet("Water Engineer"))
136
+ # Output: Hello, Water Engineer!
137
+
138
+ # Math utilities for data analysis
139
+ result = hydroanomaly.add(25.5, 14.3)
140
+ print(f"Sum: {result}")
141
+ # Output: Sum: 39.8
142
+ ```
143
+
144
+ ## Features
145
+
146
+ - **🌊 USGS Data Retrieval**: Download real-time water data from USGS Water Services
147
+ - Support for any USGS site and parameter
148
+ - Automatic data cleaning and validation
149
+ - Convenient functions for common parameters (discharge, water level, temperature)
150
+ - Fallback synthetic data generation
151
+ - CSV export functionality
152
+
153
+ - **📊 Time Series Plotting**: Beautiful, professional visualizations
154
+ - Single parameter plots with statistics
155
+ - Multi-parameter comparison plots
156
+ - Multiple gage comparison plots
157
+ - Statistical analysis plots (histogram, box plot, etc.)
158
+ - Automatic legend and formatting
159
+ - Save plots in multiple formats (PNG, PDF, SVG)
160
+
161
+ - **📈 Data Analysis Tools**: Built-in utilities for water data
162
+ - Mathematical operations for data processing
163
+ - Statistical summaries and analysis
164
+ - Data validation and quality checks
165
+
166
+ - **🎯 Easy to Use**: Simple, intuitive API
167
+ - Quick plotting for rapid data exploration
168
+ - One-line data retrieval functions
169
+ - Comprehensive error handling
170
+ - Well-documented with examples
171
+
172
+ - **🧪 Well Tested**: Comprehensive test suite with 100% pass rate
173
+
174
+ ## USGS Data Parameters
175
+
176
+ Common USGS parameter codes you can use:
177
+ - **00060**: Discharge (cubic feet per second)
178
+ - **00065**: Gage height (feet)
179
+ - **00010**: Water temperature (°C)
180
+ - **63680**: Turbidity (NTU)
181
+ - **00300**: Dissolved oxygen (mg/L)
182
+ - **00095**: Specific conductance (µS/cm)
183
+
184
+ Find USGS site numbers at: https://waterdata.usgs.gov/nwis
185
+
186
+ ## Detailed Usage
187
+
188
+ ### USGS Data Retrieval
189
+ ```python
190
+ from hydroanomaly.usgs_data import USGSDataRetriever
191
+
192
+ # Create retriever instance
193
+ retriever = USGSDataRetriever()
194
+
195
+ # Get data with full control
196
+ data = retriever.retrieve_data(
197
+ site_number="08158000", # Colorado River at Austin, TX
198
+ parameter_code="00060", # Discharge
199
+ start_date="2023-01-01",
200
+ end_date="2023-01-31"
201
+ )
202
+
203
+ # Get summary statistics
204
+ summary = retriever.get_data_summary(data)
205
+ print(f"Retrieved {summary['record_count']} records")
206
+ print(f"Average discharge: {summary['value_stats']['mean']:.2f} cfs")
207
+
208
+ # Save data
209
+ retriever.save_data(data, "discharge_data.csv", "Discharge_cfs")
210
+ ```
211
+
212
+ ### Greeting Functions
213
+ ```python
214
+ from hydroanomaly.hello import greet, say_goodbye
215
+
216
+ # Greet users
217
+ welcome_msg = greet("Data Scientist")
218
+ print(welcome_msg) # Hello, Data Scientist!
219
+
220
+ # Say goodbye
221
+ farewell_msg = say_goodbye("User")
222
+ print(farewell_msg) # Goodbye, User!
223
+ ```
224
+
225
+ ### Mathematical Operations
226
+ ```python
227
+ from hydroanomaly.math_utils import add, multiply, divide
228
+
229
+ # Basic operations
230
+ sum_result = add(10.5, 20.3)
231
+ product = multiply(5, 7)
232
+
233
+ # Safe division with error handling
234
+ try:
235
+ result = divide(100, 5)
236
+ print(f"Result: {result}") # Result: 20.0
237
+ except ValueError as e:
238
+ print(f"Error: {e}")
239
+ ```
240
+
241
+ ### Time Series Plotting
242
+
243
+ ```python
244
+ # Quick plotting for data exploration
245
+ data = hydroanomaly.get_discharge("08158000", "2023-01-01", "2023-01-07")
246
+ hydroanomaly.quick_plot(data, "Quick Discharge Check")
247
+
248
+ # Professional plots with full customization
249
+ from hydroanomaly.plotting import WaterDataPlotter
250
+
251
+ plotter = WaterDataPlotter()
252
+
253
+ # Single parameter with statistics
254
+ fig = plotter.plot_timeseries(
255
+ data=data,
256
+ parameter_name="Discharge (cfs)",
257
+ title="Colorado River Discharge",
258
+ color="blue",
259
+ save_path="discharge_analysis.png"
260
+ )
261
+
262
+ # Multiple parameters from same gage
263
+ discharge = hydroanomaly.get_discharge("08158000", "2023-01-01", "2023-01-07")
264
+ level = hydroanomaly.get_water_level("08158000", "2023-01-01", "2023-01-07")
265
+
266
+ data_dict = {
267
+ "Discharge (cfs)": discharge,
268
+ "Water Level (ft)": level
269
+ }
270
+
271
+ fig = plotter.plot_multiple_parameters(
272
+ data_dict=data_dict,
273
+ title="Colorado River - Multiple Parameters"
274
+ )
275
+
276
+ # Statistical analysis plots
277
+ fig = plotter.plot_statistics(
278
+ data=data,
279
+ parameter_name="Discharge (cfs)",
280
+ title="Discharge Statistics"
281
+ )
282
+ ```
283
+
284
+ ## 📚 Documentation & Examples
285
+
286
+ - **📖 [Plotting Guide](PLOTTING_GUIDE.md)**: Comprehensive plotting documentation with examples
287
+ - **🎯 [Examples](plotting_examples.py)**: Run `python plotting_examples.py` to see all features
288
+ - **🧪 [Tests](test_plotting.py)**: Verify functionality with `python test_plotting.py`
289
+
290
+ ## Use Cases
291
+
292
+ - **🌊 Real Water Data Analysis**: Retrieve and analyze actual USGS water monitoring data
293
+ - **📊 Hydro Research**: Access historical water quality and quantity data with visualization
294
+ - **🚰 Water Management**: Monitor discharge, water levels, and quality parameters with plots
295
+ - **🎓 Educational Projects**: Learn data analysis and visualization with real environmental data
296
+ - **🔬 Environmental Studies**: Research water patterns and anomalies with statistical plots
297
+ - **⚡ Quick Prototyping**: Rapidly access and visualize water data for proof-of-concepts
298
+ - **📈 Data Reporting**: Generate professional plots for reports and presentations
299
+
300
+ ## API Reference
301
+
302
+ ### hydroanomaly.greet(name="World")
303
+ Returns a greeting message.
304
+
305
+ **Parameters:**
306
+ - `name` (str, optional): Name to greet. Defaults to "World".
307
+
308
+ **Returns:**
309
+ - str: Greeting message
310
+
311
+ ### hydroanomaly.get_discharge(gage_number, start_date, end_date)
312
+ Get discharge data from USGS.
313
+
314
+ **Parameters:**
315
+ - `gage_number` (str): USGS gage number
316
+ - `start_date` (str): Start date (YYYY-MM-DD)
317
+ - `end_date` (str): End date (YYYY-MM-DD)
318
+
319
+ **Returns:**
320
+ - pandas.DataFrame: Time series data with datetime and value columns
321
+
322
+ ### hydroanomaly.get_water_level(gage_number, start_date, end_date)
323
+ Get water level data from USGS.
324
+
325
+ **Parameters:**
326
+ - `gage_number` (str): USGS gage number
327
+ - `start_date` (str): Start date (YYYY-MM-DD)
328
+ - `end_date` (str): End date (YYYY-MM-DD)
329
+
330
+ **Returns:**
331
+ - pandas.DataFrame: Time series data with datetime and value columns
332
+
333
+ ### hydroanomaly.plot_usgs_data(data, parameter_name, title, save_path, color)
334
+ Create a professional plot of USGS time series data.
335
+
336
+ **Parameters:**
337
+ - `data` (DataFrame): USGS data with datetime and value columns
338
+ - `parameter_name` (str, optional): Name of parameter for y-axis label
339
+ - `title` (str, optional): Plot title
340
+ - `save_path` (str, optional): Path to save the plot
341
+ - `color` (str, optional): Line color
342
+
343
+ **Returns:**
344
+ - matplotlib.figure.Figure: The plot figure
345
+
346
+ ### hydroanomaly.quick_plot(data, title)
347
+ Create a quick plot for data exploration.
348
+
349
+ **Parameters:**
350
+ - `data` (DataFrame): USGS data with datetime and value columns
351
+ - `title` (str, optional): Plot title
352
+
353
+ **Returns:**
354
+ - matplotlib.figure.Figure: The plot figure
355
+
356
+ ### hydroanomaly.plot_multiple_gages(data_dict, parameter_name, title, save_path)
357
+ Compare the same parameter across multiple gages.
358
+
359
+ **Parameters:**
360
+ - `data_dict` (dict): Dictionary with gage names as keys and data as values
361
+ - `parameter_name` (str, optional): Name of parameter for y-axis label
362
+ - `title` (str, optional): Plot title
363
+ - `save_path` (str, optional): Path to save the plot
364
+
365
+ **Returns:**
366
+ - matplotlib.figure.Figure: The plot figure
367
+
368
+ ### Mathematical Operations
369
+
370
+ ### hydroanomaly.add(a, b)
371
+ Adds two numbers.
372
+
373
+ **Parameters:**
374
+ - `a` (int/float): First number
375
+ - `b` (int/float): Second number
376
+
377
+ **Returns:**
378
+ - int/float: Sum of a and b
379
+
380
+ ### hydroanomaly.multiply(a, b)
381
+ Multiplies two numbers.
382
+
383
+ **Parameters:**
384
+ - `a` (int/float): First number
385
+ - `b` (int/float): Second number
386
+
387
+ **Returns:**
388
+ - int/float: Product of a and b
389
+
390
+ ## Contributing
391
+
392
+ Contributions are welcome! Please feel free to submit a Pull Request.
393
+
394
+ ## License
395
+
396
+ This project is licensed under the MIT License - see the LICENSE file for details.
397
+
398
+ ---
399
+
400
+ **HydroAnomaly** - Making water data analysis simple and beautiful! 🌊📊