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-acf88606-09a3-11ef-8a2d-6045bd0a06a4
Connection method: Cluster object | Cluster type: distributed.LocalCluster |
Dashboard: http://127.0.0.1:8787/status |
Cluster Info
LocalCluster
813a7452
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-41060d93-c141-4530-a934-e2a20261c6e7
Comm: tcp://127.0.0.1:36811 | 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:38081 | Total threads: 1 |
Dashboard: http://127.0.0.1:33371/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:43911 | |
Local directory: /tmp/dask-scratch-space/worker-_y1cbrkj |
Worker: 1
Comm: tcp://127.0.0.1:41611 | Total threads: 1 |
Dashboard: http://127.0.0.1:44899/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:38307 | |
Local directory: /tmp/dask-scratch-space/worker-tqunx_hx |
Worker: 2
Comm: tcp://127.0.0.1:37593 | Total threads: 1 |
Dashboard: http://127.0.0.1:42147/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:45107 | |
Local directory: /tmp/dask-scratch-space/worker-0xz5rb6b |
Worker: 3
Comm: tcp://127.0.0.1:46093 | Total threads: 1 |
Dashboard: http://127.0.0.1:42247/status | Memory: 3.90 GiB |
Nanny: tcp://127.0.0.1:35983 | |
Local directory: /tmp/dask-scratch-space/worker-ea3xn3om |
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)