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