import pandas as pd
import hvplot.pandas
Request CSV data from an ERDDAP Server
var = 'wave_height'
url = f'https://coastwatch.pfeg.noaa.gov/erddap/tabledap/gomoosBuoy.csv?longitude%2Clatitude%2Cstation_id%2Ctime%2C{var}&time%3E=now-7days'
df = pd.read_csv(url, parse_dates=True, index_col='time', skiprows=[1])
df.tail()
longitude | latitude | station_id | wave_height | |
---|---|---|---|---|
time | ||||
2021-01-21 18:00:00+00:00 | -67.875844 | 43.498483 | M01 | 0.594748 |
2021-01-21 18:30:00+00:00 | -67.875844 | 43.498483 | M01 | 0.614935 |
2021-01-21 19:00:00+00:00 | -67.875844 | 43.498483 | M01 | 0.536599 |
2021-01-21 19:30:00+00:00 | -67.875844 | 43.498483 | M01 | 0.547852 |
2021-01-21 20:00:00+00:00 | -67.875844 | 43.498483 | M01 | 0.614507 |
Plot the mean wave_height as colored dots on a map
df_mean = df.groupby('station_id').mean()
df_mean
longitude | latitude | wave_height | |
---|---|---|---|
station_id | |||
A01 | -70.565500 | 42.523200 | 1.099480 |
B01 | -70.427085 | 43.179085 | 1.168891 |
E01 | -69.354128 | 43.714953 | 1.614362 |
F01 | -68.998200 | 44.055500 | 0.761548 |
I01 | -68.108700 | 44.105800 | 1.808487 |
M01 | -67.875844 | 43.498483 | 2.262064 |
df_mean.hvplot.points('longitude', 'latitude', geo=True, tiles='ESRI',
color=var, colormap='rainbow')
Plot a selected station
sta = 'A01'
df[var][df['station_id']==sta].hvplot(grid=True)