Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ArfaKhalid authored Nov 15, 2023
1 parent 23d2300 commit c19c29e
Show file tree
Hide file tree
Showing 2 changed files with 275 additions and 0 deletions.
33 changes: 33 additions & 0 deletions get_noaa_waterlevels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import datetime
import matplotlib.pyplot as plt
from noaa_sdk import NOAA

# Create a NOAA object
noaa = NOAA()

# Specify the station and date
station_id = '8594900' # Washington DC station ID
start_date = datetime.datetime(2023, 8, 1)
end_date = datetime.datetime(2023, 8, 10)

# Get tides data
tides_data = noaa.get_data(station_id, start_date, end_date, product='tides')

# Get current water level data
currents_data = noaa.get_data(station_id, start_date, end_date, product='currents')

# Extract water level and time data
water_levels = [data['v'] for data in tides_data['data']]
timestamps = [data['t'] for data in tides_data['data']]

# Create a plot
plt.figure(figsize=(10, 6))
plt.plot(timestamps, water_levels, marker='o', linestyle='-', color='b')
plt.xlabel('Time')
plt.ylabel('Water Level (feet)')
plt.title('NOAA Tides and Current Water Level in Washington DC')
plt.xticks(rotation=45)
plt.tight_layout()

# Display the plot
plt.show()
242 changes: 242 additions & 0 deletions usgs_get_waterlevels.ipynb

Large diffs are not rendered by default.

0 comments on commit c19c29e

Please sign in to comment.