pastas / pastastore

:spaghetti: :convenience_store: Tools for managing timeseries and Pastas models

Home Page:https://pastastore.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plot both oseries and stresses by default in data_availability plot

martinvonk opened this issue · comments

Currently the data_availability plots needs a library name (libname argument): "oseries" v "stresses"

def data_availability(
self,
libname,
names=None,
kind=None,
intervals=None,
ignore=("second", "minute", "14 days"),
ax=None,
cax=None,
normtype="log",
cmap="viridis_r",
set_yticks=False,
figsize=(10, 8),
progressbar=True,
dropna=True,
**kwargs,
):

I'd like to make the default None which plots both libraries in a plot like the one below. Here the oseries are plotted in the upper Axes, and stresses in the lower Axes and the colorbar is shared.
01_Data_Availability

Thoughts @dbrakenhoff ?

fig, ax = plt.subplot_mosaic(
    [["oseries", "cax"], ["stresses", "cax"]],
    figsize=(12, (len(pstore.oseries) + len(pstore.stresses)) / 6),
    height_ratios=[len(pstore.oseries), len(pstore.stresses)],
    width_ratios=[10, 1],
)
pstore.plots.data_availability(
    "oseries",
    intervals=intervals,
    set_yticks=True,
    ax=ax["oseries"],
    cax=ax["cax"],
)
ax["oseries"].set_title("Grondwaterstanden", fontsize=10)

pstore.plots.data_availability(
    "stresses",
    intervals=intervals,
    set_yticks=True,
    ax=ax["stresses"],
    cax=ax["cax"],
)

ax["stresses"].set_xlim(
    left=pstore.get_tmin_tmax("oseries").tmin.min(),
    right=pstore.get_tmin_tmax("oseries").tmax.max(),
)

ax["stresses"].set_title("Oppervlaktewaterstanden en Meteorologie", fontsize=10)
fig.tight_layout()
fig.suptitle("Data Beschikbaarheid", y=1.01)

I'd add a method data_availability_all() and implement this option there.

Let's just leave it at is. I can just copy the code stated here, no need for an extra plot method.