The series_per_group function has an option to save the figure. The filename is equal to name of the last plotted Observation. For GroundwaterObs the name is splitted.
I would like to change that to a more meaning full name. The suggestion is to combine the value of by (i.e. the column name) and the value of it (i.e. the value in the selected group).
HydroPandas 0.11:
for _, group in tqdm(gr, desc="Plotting series per group", total=len(gr)):
[..]
if isinstance(row.obs, GroundwaterObs):
name = name.split("-")[0]
f.savefig(
os.path.join(outputdir, f"{name}.png"), bbox_inches="tight", dpi=150
)
New:
for this_group, group in tqdm(gr, desc="Plotting series per group", total=len(gr)):
[..]
filename = f'by_{by}_plot_{this_group}.png' # add something for groupby on multiple columns
f.savefig(
os.path.join(outputdir, f"{filename}.png"), bbox_inches="tight", dpi=150
)
Examples
by (column name)
this_group (value of current group)
filename
result
monitoring_well
GMW000000051273
by_monitoring_well_plot_GMW000000051273.png
meaning full
tube_nr
1
by_tube_nr_plot_1.png
meaning full
x, y
106930_457550
by_x_y_plot_106930_457550.png
Meaning full if you want the groupby x,y. You will get it in your filename. Not very meaning full, when you want to plot a monitoring well [I think author of current code had that in mind, becuase there is a fixed replace for GroundwaterObs]. Use then column monitoring_well instead of grouping on x, y.
The
series_per_group
function has an option to save the figure. The filename is equal toname
of the last plotted Observation. For GroundwaterObs the name is splitted.https://github.com/ArtesiaWater/hydropandas/blob/b60fb6cff8593ae875382bb5416196a7d9122281/hydropandas/extensions/plots.py#L649
I would like to change that to a more meaning full name. The suggestion is to combine the value of
by
(i.e. the column name) and the value of it (i.e. the value in the selected group).HydroPandas 0.11:
New:
Examples
What are your ideas about this update?