hydroanomaly 0.4.0__py3-none-any.whl → 0.5.0__py3-none-any.whl

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/__init__.py CHANGED
@@ -5,21 +5,21 @@ A Python package for hydro anomaly detection, USGS data retrieval,
5
5
  time series visualization, and Sentinel satellite data analysis.
6
6
  """
7
7
 
8
- __version__ = "0.4.0"
8
+ __version__ = "0.5.0"
9
9
  __author__ = "Your Name"
10
10
  __email__ = "your.email@example.com"
11
11
 
12
12
  # Import main modules for easy access
13
13
  from .hello import greet
14
14
  from .math_utils import add, multiply
15
- from .usgs_data import get_usgs_data, USGSDataRetriever
15
+ from .usgs_data import get_usgs_data, get_usgs_simple, USGSDataRetriever
16
16
  from .plotting import plot_usgs_data, plot_multiple_gages, quick_plot, WaterDataPlotter
17
17
 
18
18
  # Base exports
19
19
  __all__ = [
20
20
  'greet',
21
21
  'add', 'multiply',
22
- 'get_usgs_data', 'USGSDataRetriever',
22
+ 'get_usgs_data', 'get_usgs_simple', 'USGSDataRetriever',
23
23
  'plot_usgs_data', 'plot_multiple_gages', 'quick_plot', 'WaterDataPlotter',
24
24
  'get_discharge', 'get_temperature', 'get_water_level'
25
25
  ]
hydroanomaly/usgs_data.py CHANGED
@@ -309,3 +309,81 @@ def get_usgs_data(
309
309
  retriever.save_data(data, save_to_file, parameter_name)
310
310
 
311
311
  return data
312
+
313
+
314
+ def get_usgs_simple(site_number: str, parameter_code: str, start_date: str, end_date: str, plot: bool = True) -> pd.DataFrame:
315
+ """
316
+ 🚀 SIMPLE USGS DATA RETRIEVAL WITH AUTOMATIC PLOTTING
317
+
318
+ This is the main function users should use for easy USGS data retrieval.
319
+ Just provide site, parameter, dates and get data + plot automatically!
320
+
321
+ Args:
322
+ site_number (str): USGS site number (e.g., "294643095035200")
323
+ parameter_code (str): Parameter code (e.g., "63680" for turbidity)
324
+ start_date (str): Start date as "YYYY-MM-DD"
325
+ end_date (str): End date as "YYYY-MM-DD"
326
+ plot (bool): Whether to automatically create a plot (default: True)
327
+
328
+ Returns:
329
+ pd.DataFrame: Time series data with datetime index and values
330
+
331
+ Example:
332
+ >>> data = get_usgs_simple("294643095035200", "63680", "2020-01-01", "2024-12-30")
333
+ >>> # Automatically retrieves turbidity data and shows a plot!
334
+ """
335
+ import matplotlib.pyplot as plt
336
+ import matplotlib.dates as mdates
337
+ from datetime import datetime
338
+
339
+ print("🌊 USGS Data Retrieval - Simple Mode")
340
+ print("=" * 50)
341
+ print(f"📍 Site: {site_number}")
342
+ print(f"📊 Parameter: {parameter_code}")
343
+ print(f"📅 Date Range: {start_date} to {end_date}")
344
+ print()
345
+
346
+ try:
347
+ # Get the data using existing function
348
+ retriever = USGSDataRetriever()
349
+ data = retriever.retrieve_data(site_number, parameter_code, start_date, end_date)
350
+
351
+ if data is None or len(data) == 0:
352
+ print("❌ No data retrieved")
353
+ return pd.DataFrame()
354
+
355
+ # Data summary
356
+ print(f"✅ Success! Retrieved {len(data)} data points")
357
+ print(f"📈 Data range: {data.index.min()} to {data.index.max()}")
358
+ print(f"📊 Values: {data.iloc[:, 0].min():.2f} to {data.iloc[:, 0].max():.2f}")
359
+ print()
360
+
361
+ # Create automatic plot if requested
362
+ if plot:
363
+ plt.figure(figsize=(12, 6))
364
+ plt.plot(data.index, data.iloc[:, 0], linewidth=1, alpha=0.8)
365
+
366
+ # Format the plot
367
+ plt.title(f'USGS Time Series Data\nSite: {site_number} | Parameter: {parameter_code}',
368
+ fontsize=14, fontweight='bold')
369
+ plt.xlabel('Date', fontsize=12)
370
+ plt.ylabel(f'Parameter {parameter_code}', fontsize=12)
371
+ plt.grid(True, alpha=0.3)
372
+
373
+ # Format x-axis dates
374
+ plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m'))
375
+ plt.gca().xaxis.set_major_locator(mdates.MonthLocator(interval=6))
376
+ plt.xticks(rotation=45)
377
+
378
+ # Improve layout
379
+ plt.tight_layout()
380
+ plt.show()
381
+
382
+ print("📊 Plot created successfully!")
383
+
384
+ return data
385
+
386
+ except Exception as e:
387
+ print(f"❌ Error: {str(e)}")
388
+ print("💡 Please check your inputs and try again")
389
+ return pd.DataFrame()
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hydroanomaly
3
- Version: 0.4.0
4
- Summary: A Python package for hydro anomaly detection
3
+ Version: 0.5.0
4
+ Summary: A Python package for hydro anomaly detection with simple USGS data retrieval
5
5
  Home-page: https://github.com/yourusername/hydroanomaly
6
6
  Author: Your Name
7
7
  Author-email: Your Name <your.email@example.com>
@@ -0,0 +1,11 @@
1
+ hydroanomaly/__init__.py,sha256=082rQhjdrRTN4uSSsdQB6emJa9OFS8U2O8omxFgGa9Q,4920
2
+ hydroanomaly/hello.py,sha256=AhK7UKF_3TyZcWL4IDlZq_BXdKQzUP-is-jv59fgqk4,566
3
+ hydroanomaly/math_utils.py,sha256=CDOGWAiRlb2PK5SNFysumnzp7_LbZ9aleHLR_3lsGrs,856
4
+ hydroanomaly/plotting.py,sha256=YZW6-Sb_IrhbHKFeoh1d86Ef4Ev5Gpq55lEv8XX0v20,13504
5
+ hydroanomaly/sentinel_data.py,sha256=C5T1ycyTcAGvR6KEukDHJe2kEDbFXgh0yVXi8QrjFXs,17870
6
+ hydroanomaly/usgs_data.py,sha256=ig7Diht106-gEiGFNfKzbj-mUn1RiC4GYoOKacz1Uaw,14674
7
+ hydroanomaly-0.5.0.dist-info/licenses/LICENSE,sha256=OphKV48tcMv6ep-7j-8T6nycykPT0g8ZlMJ9zbGvdPs,1066
8
+ hydroanomaly-0.5.0.dist-info/METADATA,sha256=1CD8vliaRj34Jr8bT1gRXd_iyIhKCSWh7_Ji6dQkoQg,11873
9
+ hydroanomaly-0.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ hydroanomaly-0.5.0.dist-info/top_level.txt,sha256=t-5Lc-eTLlkxIhR_N1Cpp6_YZafKS3xLLk9D2CtbE7o,13
11
+ hydroanomaly-0.5.0.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- hydroanomaly/__init__.py,sha256=5X78u2gwZFugrWfMtXv9bV4QNIj8yA36sJTSkk_qb4w,4884
2
- hydroanomaly/hello.py,sha256=AhK7UKF_3TyZcWL4IDlZq_BXdKQzUP-is-jv59fgqk4,566
3
- hydroanomaly/math_utils.py,sha256=CDOGWAiRlb2PK5SNFysumnzp7_LbZ9aleHLR_3lsGrs,856
4
- hydroanomaly/plotting.py,sha256=YZW6-Sb_IrhbHKFeoh1d86Ef4Ev5Gpq55lEv8XX0v20,13504
5
- hydroanomaly/sentinel_data.py,sha256=C5T1ycyTcAGvR6KEukDHJe2kEDbFXgh0yVXi8QrjFXs,17870
6
- hydroanomaly/usgs_data.py,sha256=zUvfu3go-7cQuFtD8Hbm7pABpw_RPWuJxE66NhxYmIU,11631
7
- hydroanomaly-0.4.0.dist-info/licenses/LICENSE,sha256=OphKV48tcMv6ep-7j-8T6nycykPT0g8ZlMJ9zbGvdPs,1066
8
- hydroanomaly-0.4.0.dist-info/METADATA,sha256=6JGNAS0GWcMflIOidfmZEz71IqZmc_IJxybtdDmGz3o,11841
9
- hydroanomaly-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
- hydroanomaly-0.4.0.dist-info/top_level.txt,sha256=t-5Lc-eTLlkxIhR_N1Cpp6_YZafKS3xLLk9D2CtbE7o,13
11
- hydroanomaly-0.4.0.dist-info/RECORD,,