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-dea221c9-efb8-11ef-8a97-7c1e522c1ede
Connection method: Cluster object | Cluster type: distributed.LocalCluster |
Dashboard: http://127.0.0.1:8787/status |
Cluster Info
LocalCluster
b6d0410c
Dashboard: http://127.0.0.1:8787/status | Workers: 4 |
Total threads: 4 | Total memory: 15.62 GiB |
Status: running | Using processes: True |
Scheduler Info
Scheduler
Scheduler-0bf531e7-716f-4227-be6f-bf54276448b8
Comm: tcp://127.0.0.1:36079 | Workers: 4 |
Dashboard: http://127.0.0.1:8787/status | Total threads: 4 |
Started: Just now | Total memory: 15.62 GiB |
Workers
Worker: 0
Comm: tcp://127.0.0.1:42125 | Total threads: 1 |
Dashboard: http://127.0.0.1:36953/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:43755 | |
Local directory: /tmp/dask-scratch-space/worker-kpn6d1bl |
Worker: 1
Comm: tcp://127.0.0.1:42831 | Total threads: 1 |
Dashboard: http://127.0.0.1:41345/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:42789 | |
Local directory: /tmp/dask-scratch-space/worker-yiv9bpb3 |
Worker: 2
Comm: tcp://127.0.0.1:43993 | Total threads: 1 |
Dashboard: http://127.0.0.1:43149/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:45157 | |
Local directory: /tmp/dask-scratch-space/worker-h5k1jk12 |
Worker: 3
Comm: tcp://127.0.0.1:33035 | Total threads: 1 |
Dashboard: http://127.0.0.1:34631/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:37129 | |
Local directory: /tmp/dask-scratch-space/worker-789613g3 |
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)