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-6f20efc5-d565-11ef-8aae-000d3a5cb504
Connection method: Cluster object | Cluster type: distributed.LocalCluster |
Dashboard: http://127.0.0.1:8787/status |
Cluster Info
LocalCluster
bbd6270b
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-097f0466-25bf-4c00-93fb-5b74cd3fa358
Comm: tcp://127.0.0.1:37639 | 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:35603 | Total threads: 1 |
Dashboard: http://127.0.0.1:35995/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:46353 | |
Local directory: /tmp/dask-scratch-space/worker-y49ozcym |
Worker: 1
Comm: tcp://127.0.0.1:44673 | Total threads: 1 |
Dashboard: http://127.0.0.1:41913/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:33023 | |
Local directory: /tmp/dask-scratch-space/worker-gq0l1ke0 |
Worker: 2
Comm: tcp://127.0.0.1:37701 | Total threads: 1 |
Dashboard: http://127.0.0.1:41033/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:45119 | |
Local directory: /tmp/dask-scratch-space/worker-s0m4d9_2 |
Worker: 3
Comm: tcp://127.0.0.1:44755 | Total threads: 1 |
Dashboard: http://127.0.0.1:38431/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:35771 | |
Local directory: /tmp/dask-scratch-space/worker-mblzox9h |
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)