ArtesiaWater / hydropandas

Module for loading observation data into custom DataFrames
https://hydropandas.readthedocs.io
MIT License
51 stars 10 forks source link

Suggestion for new plots to include in HydroPandas #86

Closed HMEUW closed 4 months ago

HMEUW commented 1 year ago

I have recently created some plots of my observations. I think these might be usefull for other users as well, and can be included in HydroPandas. What do others think about that?

Section and observations Left a section with characteristics of observation wells and bandwidth of observations; on right side all observations. image

Annual mean and observations Left annual mean per month; right side all observations. I highlighed 10 sept 2022 because of severe precipitation on that day. image

dbrakenhoff commented 1 year ago

These look like very useful plots! So +1 from me for including these somewhere. I think a good place for them would be the plots extension (hydropandas/extensions/plots).

The first one can be included as a method in CollectionPlots class. We do need to include some checking whether the selection of points represent piezometers and whether the metadata for those piezometers is available (or handle the case when it isn't).

The second is more generic and applicable to all kinds of data, so that one could be placed under the ObsPlots class and doesn't require much checking, I think.

Usage would then look something like this:

import hydropandas as hpd

oc = hpd.ObsCollection.from_dino("dino.zip")
axes = oc.plots.piezometers(names=["pb01", "pb02", "pb03"])  # TODO: think of a good name

pb01 = oc["obs"].iloc[0]
axes = pb01.plots.series_and_monthly_stats()  # TODO: think of a good name here too

Would you be willing to submit a PR, @HMEUW ?

HMEUW commented 1 year ago

I will try to open a Pull Request soon.

HMEUW commented 1 year ago

Just created a pull request for the 'section and observations'-plot.

I will create the code for the 'annual mean and observations'-plot when I received your feedback on my first submission.

martinvonk commented 1 year ago

I heard you were interested in this @HMEUW.

If you want to provide colors to plot based on names the enum standard library is very usefull. You can assign a number to a string, based on the name within an Enum class. Quick pseudocode example:

oc = hpd.ObsCollection(data=[["obs2"], ["obs3"], ["obs1"]], index=["name2", "name3", "name1"], columns=["obs"]) # not a real obscollection with data just as an example

color = Enum("color", ["name1", "name2", "name3"], start=0)

for obs in obscollection.obs:
    plt.plot(obs.values, color=f"C{color[obs.name].value}")
OnnoEbbens commented 4 months ago

The PR was added a while ago and already used by others. New plots are always welcome. I will close this issue.