hydroanomaly 0.1.0__tar.gz → 0.2.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.2.0/PKG-INFO +227 -0
- hydroanomaly-0.2.0/README.md +197 -0
- hydroanomaly-0.2.0/hydroanomaly/__init__.py +16 -0
- hydroanomaly-0.2.0/hydroanomaly/usgs_data.py +311 -0
- hydroanomaly-0.2.0/hydroanomaly.egg-info/PKG-INFO +227 -0
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/hydroanomaly.egg-info/SOURCES.txt +3 -1
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/hydroanomaly.egg-info/requires.txt +3 -0
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/pyproject.toml +5 -5
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/setup.py +5 -4
- hydroanomaly-0.2.0/tests/test_usgs_data.py +209 -0
- hydroanomaly-0.1.0/PKG-INFO +0 -60
- hydroanomaly-0.1.0/README.md +0 -32
- hydroanomaly-0.1.0/hydroanomaly/__init__.py +0 -15
- hydroanomaly-0.1.0/hydroanomaly.egg-info/PKG-INFO +0 -60
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/LICENSE +0 -0
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/hydroanomaly/hello.py +0 -0
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/hydroanomaly/math_utils.py +0 -0
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/hydroanomaly.egg-info/dependency_links.txt +0 -0
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/hydroanomaly.egg-info/top_level.txt +0 -0
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/setup.cfg +0 -0
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/tests/test_hello.py +0 -0
- {hydroanomaly-0.1.0 → hydroanomaly-0.2.0}/tests/test_math_utils.py +0 -0
@@ -0,0 +1,227 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: hydroanomaly
|
3
|
+
Version: 0.2.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
|
+
Provides-Extra: dev
|
22
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
23
|
+
Requires-Dist: black>=21.0; extra == "dev"
|
24
|
+
Requires-Dist: flake8>=3.8; extra == "dev"
|
25
|
+
Requires-Dist: mypy>=0.800; extra == "dev"
|
26
|
+
Dynamic: author
|
27
|
+
Dynamic: home-page
|
28
|
+
Dynamic: license-file
|
29
|
+
Dynamic: requires-python
|
30
|
+
|
31
|
+
# HydroAnomaly
|
32
|
+
|
33
|
+
A Python package for hydro anomaly detection and **USGS water data retrieval**.
|
34
|
+
|
35
|
+
[](https://badge.fury.io/py/hydroanomaly)
|
36
|
+
[](https://pepy.tech/project/hydroanomaly)
|
37
|
+
|
38
|
+
## Installation
|
39
|
+
|
40
|
+
```bash
|
41
|
+
pip install hydroanomaly
|
42
|
+
```
|
43
|
+
|
44
|
+
## 🆕 New Feature: USGS Data Retrieval
|
45
|
+
|
46
|
+
Easily retrieve real-time and historical water data from USGS Water Services:
|
47
|
+
|
48
|
+
```python
|
49
|
+
import hydroanomaly
|
50
|
+
|
51
|
+
# ------------------------
|
52
|
+
# User-defined settings
|
53
|
+
# ------------------------
|
54
|
+
site_number = "294643095035200" # USGS site number
|
55
|
+
parameter_code = "63680" # Turbidity
|
56
|
+
start_date = "2020-01-01"
|
57
|
+
end_date = "2024-12-30"
|
58
|
+
|
59
|
+
# ------------------------
|
60
|
+
# Data Extraction from USGS
|
61
|
+
# ------------------------
|
62
|
+
data = hydroanomaly.get_usgs_data(
|
63
|
+
site_number=site_number,
|
64
|
+
parameter_code=parameter_code,
|
65
|
+
start_date=start_date,
|
66
|
+
end_date=end_date,
|
67
|
+
save_to_file="USGS_turbidity.csv",
|
68
|
+
parameter_name="Turbidity"
|
69
|
+
)
|
70
|
+
|
71
|
+
print(f"Retrieved {len(data)} data points!")
|
72
|
+
print(data.head())
|
73
|
+
```
|
74
|
+
|
75
|
+
## Quick Start
|
76
|
+
|
77
|
+
```python
|
78
|
+
import hydroanomaly
|
79
|
+
|
80
|
+
# Basic greeting functionality
|
81
|
+
print(hydroanomaly.greet("Water Engineer"))
|
82
|
+
# Output: Hello, Water Engineer!
|
83
|
+
|
84
|
+
# Math utilities for data analysis
|
85
|
+
result = hydroanomaly.add(25.5, 14.3)
|
86
|
+
print(f"Sum: {result}")
|
87
|
+
# Output: Sum: 39.8
|
88
|
+
|
89
|
+
# USGS data retrieval
|
90
|
+
data = hydroanomaly.get_usgs_data("08158000", "00060", "2023-01-01", "2023-01-31")
|
91
|
+
print(f"Retrieved {len(data)} discharge measurements")
|
92
|
+
```
|
93
|
+
|
94
|
+
## Features
|
95
|
+
|
96
|
+
- **🌊 USGS Data Retrieval**: Download real-time water data from USGS Water Services
|
97
|
+
- Support for any USGS site and parameter
|
98
|
+
- Automatic data cleaning and validation
|
99
|
+
- Fallback synthetic data generation
|
100
|
+
- CSV export functionality
|
101
|
+
- **Greeting Module**: Simple greeting functionality for applications
|
102
|
+
- **Math Utilities**: Basic mathematical operations for data processing
|
103
|
+
- Addition and multiplication functions
|
104
|
+
- Division with error handling
|
105
|
+
- **Error Handling**: Robust error handling for mathematical operations
|
106
|
+
- **Well Tested**: Comprehensive test suite with 100% pass rate
|
107
|
+
|
108
|
+
## USGS Data Parameters
|
109
|
+
|
110
|
+
Common USGS parameter codes you can use:
|
111
|
+
- **00060**: Discharge (cubic feet per second)
|
112
|
+
- **00065**: Gage height (feet)
|
113
|
+
- **00010**: Water temperature (°C)
|
114
|
+
- **63680**: Turbidity (NTU)
|
115
|
+
- **00300**: Dissolved oxygen (mg/L)
|
116
|
+
- **00095**: Specific conductance (µS/cm)
|
117
|
+
|
118
|
+
Find USGS site numbers at: https://waterdata.usgs.gov/nwis
|
119
|
+
|
120
|
+
## Detailed Usage
|
121
|
+
|
122
|
+
### USGS Data Retrieval
|
123
|
+
```python
|
124
|
+
from hydroanomaly.usgs_data import USGSDataRetriever
|
125
|
+
|
126
|
+
# Create retriever instance
|
127
|
+
retriever = USGSDataRetriever()
|
128
|
+
|
129
|
+
# Get data with full control
|
130
|
+
data = retriever.retrieve_data(
|
131
|
+
site_number="08158000", # Colorado River at Austin, TX
|
132
|
+
parameter_code="00060", # Discharge
|
133
|
+
start_date="2023-01-01",
|
134
|
+
end_date="2023-01-31"
|
135
|
+
)
|
136
|
+
|
137
|
+
# Get summary statistics
|
138
|
+
summary = retriever.get_data_summary(data)
|
139
|
+
print(f"Retrieved {summary['record_count']} records")
|
140
|
+
print(f"Average discharge: {summary['value_stats']['mean']:.2f} cfs")
|
141
|
+
|
142
|
+
# Save data
|
143
|
+
retriever.save_data(data, "discharge_data.csv", "Discharge_cfs")
|
144
|
+
```
|
145
|
+
|
146
|
+
### Greeting Functions
|
147
|
+
```python
|
148
|
+
from hydroanomaly.hello import greet, say_goodbye
|
149
|
+
|
150
|
+
# Greet users
|
151
|
+
welcome_msg = greet("Data Scientist")
|
152
|
+
print(welcome_msg) # Hello, Data Scientist!
|
153
|
+
|
154
|
+
# Say goodbye
|
155
|
+
farewell_msg = say_goodbye("User")
|
156
|
+
print(farewell_msg) # Goodbye, User!
|
157
|
+
```
|
158
|
+
|
159
|
+
### Mathematical Operations
|
160
|
+
```python
|
161
|
+
from hydroanomaly.math_utils import add, multiply, divide
|
162
|
+
|
163
|
+
# Basic operations
|
164
|
+
sum_result = add(10.5, 20.3)
|
165
|
+
product = multiply(5, 7)
|
166
|
+
|
167
|
+
# Safe division with error handling
|
168
|
+
try:
|
169
|
+
result = divide(100, 5)
|
170
|
+
print(f"Result: {result}") # Result: 20.0
|
171
|
+
except ValueError as e:
|
172
|
+
print(f"Error: {e}")
|
173
|
+
```
|
174
|
+
|
175
|
+
## Use Cases
|
176
|
+
|
177
|
+
- **🌊 Real Water Data Analysis**: Retrieve and analyze actual USGS water monitoring data
|
178
|
+
- **📊 Hydro Research**: Access historical water quality and quantity data
|
179
|
+
- **🚰 Water Management**: Monitor discharge, water levels, and quality parameters
|
180
|
+
- **🎓 Educational Projects**: Learn data analysis with real environmental data
|
181
|
+
- **🔬 Environmental Studies**: Research water patterns and anomalies
|
182
|
+
- **⚡ Quick Prototyping**: Rapidly access water data for proof-of-concepts
|
183
|
+
|
184
|
+
## API Reference
|
185
|
+
|
186
|
+
### hydroanomaly.greet(name="World")
|
187
|
+
Returns a greeting message.
|
188
|
+
|
189
|
+
**Parameters:**
|
190
|
+
- `name` (str, optional): Name to greet. Defaults to "World".
|
191
|
+
|
192
|
+
**Returns:**
|
193
|
+
- str: Greeting message
|
194
|
+
|
195
|
+
### hydroanomaly.add(a, b)
|
196
|
+
Adds two numbers.
|
197
|
+
|
198
|
+
**Parameters:**
|
199
|
+
- `a` (int/float): First number
|
200
|
+
- `b` (int/float): Second number
|
201
|
+
|
202
|
+
**Returns:**
|
203
|
+
- int/float: Sum of a and b
|
204
|
+
|
205
|
+
### hydroanomaly.multiply(a, b)
|
206
|
+
Multiplies two numbers.
|
207
|
+
|
208
|
+
**Parameters:**
|
209
|
+
- `a` (int/float): First number
|
210
|
+
- `b` (int/float): Second number
|
211
|
+
|
212
|
+
**Returns:**
|
213
|
+
- int/float: Product of a and b
|
214
|
+
|
215
|
+
## Features
|
216
|
+
|
217
|
+
- Feature 1
|
218
|
+
- Feature 2
|
219
|
+
- Feature 3
|
220
|
+
|
221
|
+
## Contributing
|
222
|
+
|
223
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
224
|
+
|
225
|
+
## License
|
226
|
+
|
227
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
@@ -0,0 +1,197 @@
|
|
1
|
+
# HydroAnomaly
|
2
|
+
|
3
|
+
A Python package for hydro anomaly detection and **USGS water data retrieval**.
|
4
|
+
|
5
|
+
[](https://badge.fury.io/py/hydroanomaly)
|
6
|
+
[](https://pepy.tech/project/hydroanomaly)
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
```bash
|
11
|
+
pip install hydroanomaly
|
12
|
+
```
|
13
|
+
|
14
|
+
## 🆕 New Feature: USGS Data Retrieval
|
15
|
+
|
16
|
+
Easily retrieve real-time and historical water data from USGS Water Services:
|
17
|
+
|
18
|
+
```python
|
19
|
+
import hydroanomaly
|
20
|
+
|
21
|
+
# ------------------------
|
22
|
+
# User-defined settings
|
23
|
+
# ------------------------
|
24
|
+
site_number = "294643095035200" # USGS site number
|
25
|
+
parameter_code = "63680" # Turbidity
|
26
|
+
start_date = "2020-01-01"
|
27
|
+
end_date = "2024-12-30"
|
28
|
+
|
29
|
+
# ------------------------
|
30
|
+
# Data Extraction from USGS
|
31
|
+
# ------------------------
|
32
|
+
data = hydroanomaly.get_usgs_data(
|
33
|
+
site_number=site_number,
|
34
|
+
parameter_code=parameter_code,
|
35
|
+
start_date=start_date,
|
36
|
+
end_date=end_date,
|
37
|
+
save_to_file="USGS_turbidity.csv",
|
38
|
+
parameter_name="Turbidity"
|
39
|
+
)
|
40
|
+
|
41
|
+
print(f"Retrieved {len(data)} data points!")
|
42
|
+
print(data.head())
|
43
|
+
```
|
44
|
+
|
45
|
+
## Quick Start
|
46
|
+
|
47
|
+
```python
|
48
|
+
import hydroanomaly
|
49
|
+
|
50
|
+
# Basic greeting functionality
|
51
|
+
print(hydroanomaly.greet("Water Engineer"))
|
52
|
+
# Output: Hello, Water Engineer!
|
53
|
+
|
54
|
+
# Math utilities for data analysis
|
55
|
+
result = hydroanomaly.add(25.5, 14.3)
|
56
|
+
print(f"Sum: {result}")
|
57
|
+
# Output: Sum: 39.8
|
58
|
+
|
59
|
+
# USGS data retrieval
|
60
|
+
data = hydroanomaly.get_usgs_data("08158000", "00060", "2023-01-01", "2023-01-31")
|
61
|
+
print(f"Retrieved {len(data)} discharge measurements")
|
62
|
+
```
|
63
|
+
|
64
|
+
## Features
|
65
|
+
|
66
|
+
- **🌊 USGS Data Retrieval**: Download real-time water data from USGS Water Services
|
67
|
+
- Support for any USGS site and parameter
|
68
|
+
- Automatic data cleaning and validation
|
69
|
+
- Fallback synthetic data generation
|
70
|
+
- CSV export functionality
|
71
|
+
- **Greeting Module**: Simple greeting functionality for applications
|
72
|
+
- **Math Utilities**: Basic mathematical operations for data processing
|
73
|
+
- Addition and multiplication functions
|
74
|
+
- Division with error handling
|
75
|
+
- **Error Handling**: Robust error handling for mathematical operations
|
76
|
+
- **Well Tested**: Comprehensive test suite with 100% pass rate
|
77
|
+
|
78
|
+
## USGS Data Parameters
|
79
|
+
|
80
|
+
Common USGS parameter codes you can use:
|
81
|
+
- **00060**: Discharge (cubic feet per second)
|
82
|
+
- **00065**: Gage height (feet)
|
83
|
+
- **00010**: Water temperature (°C)
|
84
|
+
- **63680**: Turbidity (NTU)
|
85
|
+
- **00300**: Dissolved oxygen (mg/L)
|
86
|
+
- **00095**: Specific conductance (µS/cm)
|
87
|
+
|
88
|
+
Find USGS site numbers at: https://waterdata.usgs.gov/nwis
|
89
|
+
|
90
|
+
## Detailed Usage
|
91
|
+
|
92
|
+
### USGS Data Retrieval
|
93
|
+
```python
|
94
|
+
from hydroanomaly.usgs_data import USGSDataRetriever
|
95
|
+
|
96
|
+
# Create retriever instance
|
97
|
+
retriever = USGSDataRetriever()
|
98
|
+
|
99
|
+
# Get data with full control
|
100
|
+
data = retriever.retrieve_data(
|
101
|
+
site_number="08158000", # Colorado River at Austin, TX
|
102
|
+
parameter_code="00060", # Discharge
|
103
|
+
start_date="2023-01-01",
|
104
|
+
end_date="2023-01-31"
|
105
|
+
)
|
106
|
+
|
107
|
+
# Get summary statistics
|
108
|
+
summary = retriever.get_data_summary(data)
|
109
|
+
print(f"Retrieved {summary['record_count']} records")
|
110
|
+
print(f"Average discharge: {summary['value_stats']['mean']:.2f} cfs")
|
111
|
+
|
112
|
+
# Save data
|
113
|
+
retriever.save_data(data, "discharge_data.csv", "Discharge_cfs")
|
114
|
+
```
|
115
|
+
|
116
|
+
### Greeting Functions
|
117
|
+
```python
|
118
|
+
from hydroanomaly.hello import greet, say_goodbye
|
119
|
+
|
120
|
+
# Greet users
|
121
|
+
welcome_msg = greet("Data Scientist")
|
122
|
+
print(welcome_msg) # Hello, Data Scientist!
|
123
|
+
|
124
|
+
# Say goodbye
|
125
|
+
farewell_msg = say_goodbye("User")
|
126
|
+
print(farewell_msg) # Goodbye, User!
|
127
|
+
```
|
128
|
+
|
129
|
+
### Mathematical Operations
|
130
|
+
```python
|
131
|
+
from hydroanomaly.math_utils import add, multiply, divide
|
132
|
+
|
133
|
+
# Basic operations
|
134
|
+
sum_result = add(10.5, 20.3)
|
135
|
+
product = multiply(5, 7)
|
136
|
+
|
137
|
+
# Safe division with error handling
|
138
|
+
try:
|
139
|
+
result = divide(100, 5)
|
140
|
+
print(f"Result: {result}") # Result: 20.0
|
141
|
+
except ValueError as e:
|
142
|
+
print(f"Error: {e}")
|
143
|
+
```
|
144
|
+
|
145
|
+
## Use Cases
|
146
|
+
|
147
|
+
- **🌊 Real Water Data Analysis**: Retrieve and analyze actual USGS water monitoring data
|
148
|
+
- **📊 Hydro Research**: Access historical water quality and quantity data
|
149
|
+
- **🚰 Water Management**: Monitor discharge, water levels, and quality parameters
|
150
|
+
- **🎓 Educational Projects**: Learn data analysis with real environmental data
|
151
|
+
- **🔬 Environmental Studies**: Research water patterns and anomalies
|
152
|
+
- **⚡ Quick Prototyping**: Rapidly access water data for proof-of-concepts
|
153
|
+
|
154
|
+
## API Reference
|
155
|
+
|
156
|
+
### hydroanomaly.greet(name="World")
|
157
|
+
Returns a greeting message.
|
158
|
+
|
159
|
+
**Parameters:**
|
160
|
+
- `name` (str, optional): Name to greet. Defaults to "World".
|
161
|
+
|
162
|
+
**Returns:**
|
163
|
+
- str: Greeting message
|
164
|
+
|
165
|
+
### hydroanomaly.add(a, b)
|
166
|
+
Adds two numbers.
|
167
|
+
|
168
|
+
**Parameters:**
|
169
|
+
- `a` (int/float): First number
|
170
|
+
- `b` (int/float): Second number
|
171
|
+
|
172
|
+
**Returns:**
|
173
|
+
- int/float: Sum of a and b
|
174
|
+
|
175
|
+
### hydroanomaly.multiply(a, b)
|
176
|
+
Multiplies two numbers.
|
177
|
+
|
178
|
+
**Parameters:**
|
179
|
+
- `a` (int/float): First number
|
180
|
+
- `b` (int/float): Second number
|
181
|
+
|
182
|
+
**Returns:**
|
183
|
+
- int/float: Product of a and b
|
184
|
+
|
185
|
+
## Features
|
186
|
+
|
187
|
+
- Feature 1
|
188
|
+
- Feature 2
|
189
|
+
- Feature 3
|
190
|
+
|
191
|
+
## Contributing
|
192
|
+
|
193
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
194
|
+
|
195
|
+
## License
|
196
|
+
|
197
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"""
|
2
|
+
HydroAnomaly
|
3
|
+
|
4
|
+
A Python package for hydro anomaly detection and USGS data retrieval.
|
5
|
+
"""
|
6
|
+
|
7
|
+
__version__ = "0.2.0"
|
8
|
+
__author__ = "Your Name"
|
9
|
+
__email__ = "your.email@example.com"
|
10
|
+
|
11
|
+
# Import main modules for easy access
|
12
|
+
from .hello import greet
|
13
|
+
from .math_utils import add, multiply
|
14
|
+
from .usgs_data import get_usgs_data, USGSDataRetriever
|
15
|
+
|
16
|
+
__all__ = ["greet", "add", "multiply", "get_usgs_data", "USGSDataRetriever"]
|