Closed kvenkman closed 6 months ago
In general, I don't agree with avoiding Xarray & Hvplot (especially if the alternative is to do things in NumPy & Matplotlib). We should minimize packages imported as much as possible for expository purposes in a tutorial.
The arguments in favour of using Xarray is that it simplifies relationships between coordinates & variables (which otherwise need to be tracked in several NumPy arrays). A similar argument works for HvPlot vs. Matplotlib in terms of code complexity. The trade-off is in lines of code we have to explain in the tutorial (and possibly in robustness of code to modification). From a tutorial perspective, we want learners to walk away understanding what each & every line of code does (& why) to the greatest degree possible.
I will look at your code to see if I can shorten it (and minimize dependencies).
@kvenkman, I've pushed some modifications to your script. There is some preliminary boilerplate using Xarray & Hvplot.
hvplot.quadmesh
are not punitive as long as we use the option rasterize=True
. I would still prefer using this to having to explain peculiarities of Matplotlib.Can you see if you can make the hvplot.quadmesh
plots resemble your Matplotlib one?
And can we generalize this to another area-of-interest as an exercise?
I've pushed up a latest version of this notebook (as a .py
file). The code is a little cleaner (i.e., using Pandas to clean up some of the data-munging from the search results). The main plots are still in Matplotlib; there is an attempt to do the same thing with Hvplot that requires some scrutiny to make it clean. I'm still struggling with which library/libraries to use for visualization. For tutorial purposes, it is extremely important to keep the code as simple as possible; at the same time, generating plots needs to be robust (i.e., when the learner generates a new search query, the code needs to produce output reliably).
I think this PR is ready to merge (although the notebook still requires work, the outline of the intended content is clear). I will merge and we can keep working on this.
Removing xarray and hvplot dependencies from environment for now.
Script generates DSWx plots over Buenos Aires for March 2024 floods, but shows significant cloud cover in data. Can potentially filter some of this out during the querying step.