Visualize Latest Observations from the Ambient Weather Stations

Visualize Latest Observations from the Ambient Weather Stations#

Imports#

import glob
import xarray as xr
from bokeh.models.formatters import DatetimeTickFormatter
import hvplot.xarray
import holoviews as hv
from distributed import Client
import warnings

warnings.filterwarnings("ignore")
hv.extension('bokeh')

Start up a Dask Cluster#

client = Client()
client

Client

Client-f09ce1d0-b193-11ef-89ae-7c1e5239f21c

Connection method: Cluster object Cluster type: distributed.LocalCluster
Dashboard: http://127.0.0.1:8787/status

Cluster Info

Read the Sorted Data, Using the Last File#

files = sorted(glob.glob('../../data/surface-meteorology/*/*/*/*.nc'))

ds = xr.open_mfdataset(files[-60:])

Plot the Data#

formatter = DatetimeTickFormatter(hours="%d %b %Y \n %H:%M UTC")

variables = ['outdoor_temperature', 'outdoor_dewpoint', 'hourlyrainin', 'solarradiation']

panels = []
for variable in variables:
    panels.append(ds[variable].hvplot.line(x='time', by='station', xformatter=formatter))
hv.Layout(panels).cols(1)