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-43e37652-9948-11ef-8a09-0022488f7f6f
Connection method: Cluster object | Cluster type: distributed.LocalCluster |
Dashboard: http://127.0.0.1:8787/status |
Cluster Info
LocalCluster
ae117d29
Dashboard: http://127.0.0.1:8787/status | Workers: 4 |
Total threads: 4 | Total memory: 15.61 GiB |
Status: running | Using processes: True |
Scheduler Info
Scheduler
Scheduler-d04ba3e8-b2ac-4d86-8054-a604e7f1387d
Comm: tcp://127.0.0.1:35193 | Workers: 4 |
Dashboard: http://127.0.0.1:8787/status | Total threads: 4 |
Started: Just now | Total memory: 15.61 GiB |
Workers
Worker: 0
Comm: tcp://127.0.0.1:43067 | Total threads: 1 |
Dashboard: http://127.0.0.1:46527/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:37251 | |
Local directory: /tmp/dask-scratch-space/worker-s5wpldge |
Worker: 1
Comm: tcp://127.0.0.1:38841 | Total threads: 1 |
Dashboard: http://127.0.0.1:43265/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:38969 | |
Local directory: /tmp/dask-scratch-space/worker-ihrjtx12 |
Worker: 2
Comm: tcp://127.0.0.1:43383 | Total threads: 1 |
Dashboard: http://127.0.0.1:41035/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:38209 | |
Local directory: /tmp/dask-scratch-space/worker-kh0ylzgx |
Worker: 3
Comm: tcp://127.0.0.1:34643 | Total threads: 1 |
Dashboard: http://127.0.0.1:36653/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:37899 | |
Local directory: /tmp/dask-scratch-space/worker-vgnyha7a |
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)