hvPlot
Exporting and rebuilding conda virtual environment
Background After installing Miniconda on a new Windows 10 PC and setting up a virtual environment for running xhycom, xarray.Dataset.hvPlot does not work. There seems to be a problem with the handling of datetime64; pandas get_loc(key) returns a KeyError in datetimes.py. get_loc(key) seems to take an index and there seems to be a confusion between the index and the integer value of datetime64(ns). Since I do not know the solution, I decide to rebuild the virtual environment that is working well. This problem has been discussed in this site. It may be associated with some incompatibility between xarray 0.16 and pandas 1.1 (works with pandas 1.05). Exporting the virtual environment […]
HYCOM data download and visualization
The HYCOM database is an oceanic reanalysis dataset often used for open boundary conditions in oceanic circulation models. The Netcdf handling tool of xhycom was developed to facilitate the OPeNDAP download and visualization of Netcdf data using xarray. Data visualization includes creation of still images and time-series movies with matplotlib while interactive visualization with hvPlot. Jupyter Notebook on xhycom may help you to understand how to use it. In terms of visualization, matplotlib is superior in terms of ease of fine tuning and speed, which is better for printed materials. On the other hand, hvPlot is useful for checking values and understanding phenomena interactively; but it is slower.
Time series plotting using hvPlot
hvPlot, a component of PyViz ia a new interactive plotting tool, which is a wrapper of Bokeh. hvPlot is easy to customize plotting options. However, currently there are some drawbacks, such as difficulty in adjusting aspect ratio of graph area, which may be resolved in Bokeh 1.1, slow processing, and cumbersome in exporting high resolution PNG file, comparing to Matplotlib. Default time series plotting Suppose df is a pandas DataFrame having a time series index and columns of 'kion' and 'sped', which are actually a dataset of air temperature and wind speed at Chiba Observatory, Japan, provided by Japan Meteorological Agency. import hvplot.pandas df[['kion','sped']].hvplot() Customized plotting Now one column of […]