Skip to content

Commit

Permalink
Example notebook lizard (#185)
Browse files Browse the repository at this point in the history
* Fix typos in get-started docs and add template example notebook for Lizard

* Fix type in readme

* Add example notebook for Lizard and add options to choose own background layer in interactive map plot.

* black formatting

---------

Co-authored-by: OnnoEbbens <onnoebbens@gmail.com>
  • Loading branch information
tberends and OnnoEbbens authored Feb 19, 2024
1 parent 4dfd27d commit 0950abe
Show file tree
Hide file tree
Showing 10 changed files with 953 additions and 15 deletions.
5 changes: 2 additions & 3 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Importing a single CSV-file downloaded from DINOLoket::

import hydropandas as hpd
fname = './tests/data/2019-Dino-test/Grondwaterstanden_Put/B33F0080001_1.csv'
gw = hpd.GroundwaterObs.from_dino(fname=fname, verbose=True)
gw = hpd.GroundwaterObs.from_dino(path=fname)


Or for a zipfile::
Expand All @@ -22,8 +22,7 @@ Or for a zipfile::
subdir='Grondwaterstanden_Put',
suffix='1.csv',
ObsClass=hpd.GroundwaterObs,
keep_all_obs=False,
verbose=False)
keep_all_obs=False)

Example notebooks
-----------------
Expand Down
3 changes: 3 additions & 0 deletions docs/examples/06_lizard.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "../../examples/06_lizard.ipynb"
}
9 changes: 5 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ Supported data sources
Currently supported datasources that can be read:

- `BRO <https://www.broloket.nl>`_
- `FEWS PI-XML <https://publicwiki.deltares.nl/display/FEWSDOC/The+Delft-Fews+Published+Interface>`_
- `DINOLoket CSV <www.dinoloket.nl>`_
- WISKI csv files
- `Pastastore <https://github.com/pastas/pastastore>`_, for managing Pastas timeseries and models
- `FEWS PI-XML <https://publicwiki.deltares.nl/display/FEWSDOC/The+Delft-Fews+Published+Interface>`_
- IMOD groundwater models
- `KNMI data <https://www.knmi.nl/kennis-en-datacentrum/achtergrond/data-ophalen-vanuit-een-script>`_
- `Lizard <https://vitens.lizard.net>`_
- MODFLOW groundwater models
- IMOD groundwater models
- `Pastastore <https://github.com/pastas/pastastore>`_, for managing Pastas timeseries and models
- `Waterinfo <https://waterinfo.rws.nl>`_
- WISKI csv files

ObsCollection can be exported to:

Expand Down
931 changes: 931 additions & 0 deletions examples/06_lizard.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions hydropandas/extensions/accessor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Copied from ./pandas/core/accessor.py."""

import warnings


Expand Down
2 changes: 1 addition & 1 deletion hydropandas/extensions/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def interactive_map(

# create map if no map is given
if m is None:
m = folium.Map([northing, easting], zoom_start=zoom_start)
m = folium.Map([northing, easting], zoom_start=zoom_start, tiles=tiles)

# get oc name if no legend name is given
if legend_name is None:
Expand Down
1 change: 1 addition & 0 deletions hydropandas/io/knmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- read_knmi_timeseries_file: read a knmi txt file
"""

import datetime as dt
import logging
import os
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ The HydroPandas package also provides convenient read functions for Dutch hydrol
- [DINO](https://www.dinoloket.nl)
- FEWS PI-XML
- [KNMI](https://www.knmi.nl/kennis-en-datacentrum/achtergrond/data-ophalen-vanuit-een-script)
- [Lizard](https://vitens.lizard.net/)
- MODFLOW groundwater models
- IMOD groundwater models
- [Pastastore](https://github.com/pastas/pastastore)
- [waterinfo](https://waterinfo.rws.nl/)
- [Waterinfo](https://waterinfo.rws.nl/)
- WISKI csv files

## Install
Expand Down
1 change: 1 addition & 0 deletions tests/test_000_run_notebooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""run notebooks in the examples directory."""

import os

import nbformat
Expand Down
12 changes: 6 additions & 6 deletions tests/test_003_calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def test_get_nearest_point():
# every point must find itself as the nearest point
dino_gw = ttf.test_obscollection_dinozip_gw()
fl = ttf.test_obscollection_dinozip_wl()
dino_gw[
["nearest point", "distance nearest point"]
] = dino_gw.geo.get_nearest_point(fl)
dino_gw[["nearest point", "distance nearest point"]] = (
dino_gw.geo.get_nearest_point(fl)
)


def test_get_nearest_polygon():
Expand Down Expand Up @@ -82,9 +82,9 @@ def test_get_nearest_polygon():
)
gdf = gpd.GeoDataFrame({"name": [1, 2], "geometry": [polygon1, polygon2]})

dino_gw[
["nearest polygon", "distance nearest polygon"]
] = dino_gw.geo.get_nearest_polygon(gdf)
dino_gw[["nearest polygon", "distance nearest polygon"]] = (
dino_gw.geo.get_nearest_polygon(gdf)
)
assert (dino_gw["nearest polygon"] == 0.0).all()
assert (dino_gw["distance nearest polygon"] == 0.0).all()

Expand Down

0 comments on commit 0950abe

Please sign in to comment.