DOV-Vlaanderen / pydov

Python package to retrieve data from Databank Ondergrond Vlaanderen (DOV)
https://pydov.readthedocs.io/en/latest/
MIT License
30 stars 17 forks source link

Compatiblity with pastas Python package #16

Open stijnvanhoey opened 6 years ago

stijnvanhoey commented 6 years ago

Pastas is an open-source framework for the analysis of hydrological time series, http://pastas.readthedocs.io/en/latest/.

Not a priority, but interesting to log here that it could be worthwhile to provide compatibility in the future. By providing the mapping to the pastas datamodel, the modelling tools developed in pastas would be applicable. As the modelling part is out of scope of this package, both packages are complimentary to each other.

(getting this from earlier correspondence from Pieter Jan Haest)

stijnvanhoey commented 5 years ago

After a quick check, the integration with pastas for water head measurements is technically trivial as pastas works with Pandas.Series objects:

Hence, starting from data (df) retrieved using pydov

from owslib.fes import PropertyIsEqualTo
from pydov.search.grondwaterfilter import GrondwaterFilterSearch

gwfilter = GrondwaterFilterSearch()

query = PropertyIsEqualTo(
            propertyname='pkey_filter',
            literal='https://www.dov.vlaanderen.be/data/filter/1992-011802')

df = gwfilter.search(query=query)
df.head()

Converting the time series to a pastas Timeseries:

gwdata = ps.TimeSeries(df["peil_mtaw"], name="Groundwater Level",  fill_nan="drop")

the resulting gwdata object can be further adapted using the pastas defined methods or used as the input of a pastas model. Note, you can also directly feed a Pandas.Series object into a pasta model definition.

Something to integrate in the docs.

pjhaest commented 4 years ago

could be included in the docs, e.g. a Notebook with possible extensions