import intake
import hvplot.pandas
import hvplot.xarray
import cook_inlet_catalogs as cic
import holoviews as hv
CTD Profiles (NOAA): across Cook Inlet¶
CTD Profiles from NOAA.
cat = intake.open_catalog(cic.utils.cat_path("ctd_profiles_2005_noaa"))
Plot all datasets in catalog¶
dd, ddlabels = cic.utils.combine_datasets_for_map(cat)
dd.hvplot(**cat.metadata["map"]) * ddlabels.hvplot(**cat.metadata["maplabels"])
List available datasets in the catalog¶
dataset_ids = list(cat)
dataset_ids
['501',
'502',
'503',
'504',
'505',
'506',
'507',
'508',
'509',
'510',
'511',
'512',
'513',
'514',
'515',
'516',
'517',
'518',
'519',
'520',
'521',
'522',
'523',
'524']
Select one dataset to investigate¶
try:
dataset_id = dataset_ids[2]
except:
dataset_id = dataset_ids[0]
print(dataset_id)
dd = cat[dataset_id].read()
dd
503
| Cruise | Station | Type | Lon (°E) | Lat (°N) | Temperature [C] | tran [v] | fluor [v] | Depth [m] | Salinity [psu] | datetime | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | 503 | c | -151.43297 | 60.71727 | 10.7403 | 0.0561 | 0.0499 | 0.990 | 23.0207 | 2005-06-16 14:34:00 |
| 1 | 1 | 503 | c | -151.43297 | 60.71727 | 10.7409 | 0.0564 | 0.1539 | 1.981 | 23.0229 | 2005-06-16 14:34:00 |
| 2 | 1 | 503 | c | -151.43297 | 60.71727 | 10.7301 | 0.0566 | 0.1580 | 2.972 | 23.0219 | 2005-06-16 14:34:00 |
| 3 | 1 | 503 | c | -151.43297 | 60.71727 | 10.7237 | 0.0565 | 0.1541 | 3.962 | 23.0219 | 2005-06-16 14:34:00 |
| 4 | 1 | 503 | c | -151.43297 | 60.71727 | 10.7202 | 0.0565 | 0.1523 | 4.953 | 23.0232 | 2005-06-16 14:34:00 |
| 5 | 1 | 503 | c | -151.43297 | 60.71727 | 10.7099 | 0.0565 | 0.1497 | 5.943 | 23.0299 | 2005-06-16 14:34:00 |
| 6 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6959 | 0.0565 | 0.1504 | 6.934 | 23.0384 | 2005-06-16 14:34:00 |
| 7 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6870 | 0.0565 | 0.1489 | 7.925 | 23.0437 | 2005-06-16 14:34:00 |
| 8 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6679 | 0.0566 | 0.1489 | 8.915 | 23.0514 | 2005-06-16 14:34:00 |
| 9 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6798 | 0.0565 | 0.1491 | 9.906 | 23.0469 | 2005-06-16 14:34:00 |
| 10 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6692 | 0.0565 | 0.1494 | 10.896 | 23.0513 | 2005-06-16 14:34:00 |
| 11 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6553 | 0.0564 | 0.1494 | 11.887 | 23.0565 | 2005-06-16 14:34:00 |
| 12 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6581 | 0.0565 | 0.1454 | 12.877 | 23.0561 | 2005-06-16 14:34:00 |
| 13 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6411 | 0.0566 | 0.1456 | 13.868 | 23.0620 | 2005-06-16 14:34:00 |
| 14 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6444 | 0.0565 | 0.1477 | 14.859 | 23.0620 | 2005-06-16 14:34:00 |
| 15 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6526 | 0.0566 | 0.1442 | 15.849 | 23.0589 | 2005-06-16 14:34:00 |
| 16 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6536 | 0.0564 | 0.1493 | 16.840 | 23.0585 | 2005-06-16 14:34:00 |
| 17 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6488 | 0.0565 | 0.1471 | 17.830 | 23.0604 | 2005-06-16 14:34:00 |
| 18 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6443 | 0.0566 | 0.1457 | 18.821 | 23.0621 | 2005-06-16 14:34:00 |
| 19 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6395 | 0.0565 | 0.1470 | 19.811 | 23.0641 | 2005-06-16 14:34:00 |
| 20 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6390 | 0.0565 | 0.1461 | 20.802 | 23.0645 | 2005-06-16 14:34:00 |
| 21 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6382 | 0.0565 | 0.1470 | 21.792 | 23.0646 | 2005-06-16 14:34:00 |
| 22 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6349 | 0.0565 | 0.1445 | 22.783 | 23.0660 | 2005-06-16 14:34:00 |
| 23 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6397 | 0.0565 | 0.1478 | 23.773 | 23.0641 | 2005-06-16 14:34:00 |
| 24 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6473 | 0.0566 | 0.1428 | 24.764 | 23.0614 | 2005-06-16 14:34:00 |
| 25 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6420 | 0.0565 | 0.1455 | 25.754 | 23.0629 | 2005-06-16 14:34:00 |
| 26 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6343 | 0.0565 | 0.1456 | 26.745 | 23.0656 | 2005-06-16 14:34:00 |
| 27 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6320 | 0.0565 | 0.1445 | 27.735 | 23.0662 | 2005-06-16 14:34:00 |
| 28 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6304 | 0.0566 | 0.1443 | 28.726 | 23.0671 | 2005-06-16 14:34:00 |
| 29 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6249 | 0.0566 | 0.1459 | 29.716 | 23.0687 | 2005-06-16 14:34:00 |
| 30 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6244 | 0.0565 | 0.1447 | 30.707 | 23.0688 | 2005-06-16 14:34:00 |
| 31 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6269 | 0.0566 | 0.1441 | 31.697 | 23.0678 | 2005-06-16 14:34:00 |
| 32 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6269 | 0.0566 | 0.1456 | 32.688 | 23.0682 | 2005-06-16 14:34:00 |
| 33 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6241 | 0.0565 | 0.1450 | 33.678 | 23.0693 | 2005-06-16 14:34:00 |
| 34 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6239 | 0.0566 | 0.1449 | 34.668 | 23.0691 | 2005-06-16 14:34:00 |
| 35 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6246 | 0.0565 | 0.1444 | 35.659 | 23.0684 | 2005-06-16 14:34:00 |
| 36 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6249 | 0.0565 | 0.1426 | 36.649 | 23.0686 | 2005-06-16 14:34:00 |
| 37 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6250 | 0.0566 | 0.1447 | 37.640 | 23.0683 | 2005-06-16 14:34:00 |
| 38 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6253 | 0.0567 | 0.1437 | 38.630 | 23.0682 | 2005-06-16 14:34:00 |
| 39 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6252 | 0.0565 | 0.1444 | 39.621 | 23.0688 | 2005-06-16 14:34:00 |
| 40 | 1 | 503 | c | -151.43297 | 60.71727 | 10.6267 | 0.0566 | 0.1431 | 40.611 | 23.0685 | 2005-06-16 14:34:00 |
Plot one dataset¶
keys = list(cat[dataset_id].metadata["plots"].keys())
print(keys)
plots = []
for key in keys:
plot_kwargs = cat[dataset_id].metadata["plots"][key]
if "clim" in plot_kwargs and isinstance(plot_kwargs["clim"], list):
plot_kwargs["clim"] = tuple(plot_kwargs["clim"])
if "dynamic" in plot_kwargs:
plot_kwargs["dynamic"] = False
plots.append(cat[dataset_id].ToHvPlot(**plot_kwargs).read())
hv.Layout(plots).cols(1)
['data']
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[6], line 11
9 if "dynamic" in plot_kwargs:
10 plot_kwargs["dynamic"] = False
---> 11 plots.append(cat[dataset_id].ToHvPlot(**plot_kwargs).read())
12 hv.Layout(plots).cols(1)
File ~/checkouts/readthedocs.org/user_builds/cook-inlet-catalogs/conda/latest/lib/python3.11/site-packages/intake/readers/readers.py:121, in BaseReader.read(self, *args, **kwargs)
119 kw.update(kwargs)
120 args = kw.pop("args", ()) or args
--> 121 return self._read(*args, **kw)
File ~/checkouts/readthedocs.org/user_builds/cook-inlet-catalogs/conda/latest/lib/python3.11/site-packages/intake/readers/convert.py:629, in Pipeline._read(self, discover, **kwargs)
627 kw = kwargs if i == len(self.steps) else {}
628 if i:
--> 629 data = self._read_stage_n(i, data=data, **kw)
630 else:
631 data = self._read_stage_n(i, discover=discover, **kw)
File ~/checkouts/readthedocs.org/user_builds/cook-inlet-catalogs/conda/latest/lib/python3.11/site-packages/intake/readers/convert.py:615, in Pipeline._read_stage_n(self, stage, discover, **kwargs)
613 return func(metadata=self.metadata).discover(*arg, **kw2)
614 else:
--> 615 return func(metadata=self.metadata).read(*arg, **kw2)
616 elif isinstance(func, BaseReader):
617 if discover:
File ~/checkouts/readthedocs.org/user_builds/cook-inlet-catalogs/conda/latest/lib/python3.11/site-packages/intake/readers/readers.py:121, in BaseReader.read(self, *args, **kwargs)
119 kw.update(kwargs)
120 args = kw.pop("args", ()) or args
--> 121 return self._read(*args, **kw)
File ~/checkouts/readthedocs.org/user_builds/cook-inlet-catalogs/conda/latest/lib/python3.11/site-packages/intake/readers/convert.py:62, in BaseConverter._read(self, data, *args, **kwargs)
60 if isinstance(data, BaseReader):
61 data = data.read()
---> 62 return self.run(data, *args, **kwargs)
File ~/checkouts/readthedocs.org/user_builds/cook-inlet-catalogs/conda/latest/lib/python3.11/site-packages/intake/readers/convert.py:192, in ToHvPlot.run(self, data, explorer, **kw)
189 if explorer:
190 # this is actually a hvplot.ui:hvPlotExplorer and only allows tabular data
191 return hvplot.explorer(data, **kw)
--> 192 return hvplot.hvPlot(data, **kw)()
File ~/checkouts/readthedocs.org/user_builds/cook-inlet-catalogs/conda/latest/lib/python3.11/site-packages/hvplot/plotting/core.py:95, in hvPlotBase.__call__(self, x, y, kind, **kwds)
92 plot = self._get_converter(x, y, kind, **kwds)(kind, x, y)
93 return pn.panel(plot, **panel_dict)
---> 95 return self._get_converter(x, y, kind, **kwds)(kind, x, y)
File ~/checkouts/readthedocs.org/user_builds/cook-inlet-catalogs/conda/latest/lib/python3.11/site-packages/hvplot/converter.py:2066, in HoloViewsConverter.__call__(self, kind, x, y)
2063 dataset = Dataset(data)
2064 dataset = redim_(dataset, **self._redim)
-> 2066 obj = method(x, y)
2067 obj._dataset = dataset
2069 if self.crs and self.project:
2070 # Apply projection before rasterizing
File ~/checkouts/readthedocs.org/user_builds/cook-inlet-catalogs/conda/latest/lib/python3.11/site-packages/hvplot/converter.py:2601, in HoloViewsConverter.line(self, x, y, data)
2599 def line(self, x=None, y=None, data=None):
2600 self._error_if_unavailable('line')
-> 2601 return self.chart(Curve, x, y, data)
File ~/checkouts/readthedocs.org/user_builds/cook-inlet-catalogs/conda/latest/lib/python3.11/site-packages/hvplot/converter.py:2588, in HoloViewsConverter.chart(self, element, x, y, data)
2586 charts = []
2587 for c in y:
-> 2588 ydim = hv.Dimension(c, label=self.value_label)
2589 kdims, vdims = self._get_dimensions([x], [ydim])
2590 chart = element(data, kdims, vdims)
File ~/checkouts/readthedocs.org/user_builds/cook-inlet-catalogs/conda/latest/lib/python3.11/site-packages/holoviews/core/dimension.py:285, in Dimension.__init__(self, spec, **params)
283 raise ValueError('Dimension name cannot be empty')
284 if not all_params['label']:
--> 285 raise ValueError('Dimension label cannot be empty')
287 values = params.get('values', [])
288 if isinstance(values, str) and values == 'initial':
ValueError: Dimension label cannot be empty