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
LocalCluster
2f0cbf59
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-d70bdd3e-ec95-4915-a9ca-bc989f881eee
Comm: tcp://127.0.0.1:33905 | 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:41573 | Total threads: 1 |
Dashboard: http://127.0.0.1:42195/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:37835 | |
Local directory: /tmp/dask-scratch-space/worker-yxh4z49t |
Worker: 1
Comm: tcp://127.0.0.1:37141 | Total threads: 1 |
Dashboard: http://127.0.0.1:37781/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:42111 | |
Local directory: /tmp/dask-scratch-space/worker-ws5oh3z6 |
Worker: 2
Comm: tcp://127.0.0.1:38849 | Total threads: 1 |
Dashboard: http://127.0.0.1:43267/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:37173 | |
Local directory: /tmp/dask-scratch-space/worker-xxc9hp3k |
Worker: 3
Comm: tcp://127.0.0.1:37493 | Total threads: 1 |
Dashboard: http://127.0.0.1:37171/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:46837 | |
Local directory: /tmp/dask-scratch-space/worker-isdjs514 |
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)