Example of DOV search methods for observations (observaties)

Binder

Use cases explained below

  • Get observations in a bounding box

  • Get observations with specific properties

  • Get observations in a bounding box based on specific properties

  • Select observations in a municipality and return depth

  • Get observations based on fields not available in the standard output dataframee

[52]:
%matplotlib inline
import inspect, sys
import warnings; warnings.simplefilter('ignore')
[53]:
# check pydov path
import pydov

Get information about the datatype ‘Observatie’

[58]:
from pydov.search.observatie import ObservatieSearch
observatie = ObservatieSearch()

A description is provided for the ‘Observatie’ datatype:

[59]:
observatie.get_description()
[59]:
'Observaties zijn gekoppeld aan een monster en geven de waarde van een kenmerk/parameter weer die in een laboratorium of in het veld bepaald kunnen zijn. De observaties kunnen zeer divers zijn variërend van een kwantitatieve waarde uit een meting zoals watergehalte (%), kwalitatieve waarde uit een beschrijving of classificatie zoals grondsoort, gecodeerde waarde, zoals kalkreactie met HCL (ja/nee), een meetreeks zoals een korrelverdeling, een textuurmeting, een tijdmeetreeks zoals de temperatuurmeting met de gazondolk. De geografische ligging (X en Y (mL72) nemen ze over van het gekoppeld monster.  De gegevens van de observaties kunnen worden geëxporteerd in een rapport.'

The different fields that are available for objects of the ‘Observatie’ datatype can be requested with the get_fields() method:

[60]:
fields = observatie.get_fields()

# print available fields
for f in fields.values():
    print(f['name'])
id
pkey_observatie
pkey_parent
parameter
parametergroep
observatietype
detectieconditie
resultaat
eenheid
fenomeentijd
resultaattijd
methode
uitvoerder
diepte_van_m
diepte_tot_m
herkomst
opdracht
geom

You can get more information of a field by requesting it from the fields dictionary:

  • name: name of the field

  • definition: definition of this field

  • cost: currently this is either 1 or 10, depending on the datasource of the field. It is an indication of the expected time it will take to retrieve this field in the output dataframe.

  • notnull: whether the field is mandatory or not

  • type: datatype of the values of this field

  • codelist: optionally, a codelist that describes the possible values of this field

Alternatively, you can list all the fields and their details by inspecting the get_fields() output or the search instance itself in a notebook:

[61]:
observatie
[61]:
pydov.search.observatie.ObservatieSearch

Observaties zijn gekoppeld aan een monster en geven de waarde van een kenmerk/parameter weer die in een laboratorium of in het veld bepaald kunnen zijn. De observaties kunnen zeer divers zijn variërend van een kwantitatieve waarde uit een meting zoals watergehalte (%), kwalitatieve waarde uit een beschrijving of classificatie zoals grondsoort, gecodeerde waarde, zoals kalkreactie met HCL (ja/nee), een meetreeks zoals een korrelverdeling, een textuurmeting, een tijdmeetreeks zoals de temperatuurmeting met de gazondolk. De geografische ligging (X en Y (mL72) nemen ze over van het gekoppeld monster. De gegevens van de observaties kunnen worden geëxporteerd in een rapport.

id - Uniek referentienummer in de databank.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

pkey_observatie - Permanente URL die verwijst naar de gegevens van de observatie op de website.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

pkey_parent - Permanente URL die verwijst naar de gegevens van het gekoppeld object op de website.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

parameter - Het geobserveerd kenmerk.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

parametergroep - Indicatieve indeling van parameters in groepen. Bijvoorbeeld onderkenningsproeven, chemische analyses, kationen, anionen, zware metalen, farmaceutische stoffen, ...

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

observatietype - Type van de observatie: numerieke waarde, keuzelijst, meetreeks, tijdmeetreeks.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

detectieconditie - De detectieconditie is groter of kleiner dan een numerieke waarde.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

resultaat - De waarde van een observatie.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

eenheid - De eenheid waarin een resultaat of waarde van een observatie wordt uitgedrukt.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

fenomeentijd - Het moment vanaf wanneer het resultaat van de observatie van toepassing is (het moment waarop geobserveerd of bemonsterd werd).

  • type: date
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

resultaattijd - Het moment waarop het resultaat van de observatie werd bekomen (bvb datum/tijd van de laboanalyse is 1 dag later dan de monstername).

  • type: date
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

methode - De methode gebruikt om het resultaat van de observatie te bekomen.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

uitvoerder - De agent (persoon of organisatie) die de observatie heeft uitgevoerd.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

diepte_van_m - Minimum diepte van het monster ten opzichte van het aanvangspeil van het bemonsterd object, in meter, waarvoor de observatie van toepassing is.

  • type: float
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

diepte_tot_m - Maximum diepte van het monster ten opzichte van het aanvangspeil van het bemonsterd object, in meter, waarvoor de observatie van toepassing is.

  • type: float
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

herkomst - De plaats waar de observatie is uitgevoerd: observatie in het labo of op het veld.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

opdracht - Opdracht waaraan een observatie gekoppeld is.

  • type: string
  • notnull: False
  • query: True
  • cost: 1
  • multivalue: False

geom - None

  • type: geometry
  • notnull: False
  • query: False
  • cost: 1
  • multivalue: False

Example use cases

Get observations in a bounding box

Get data for all the observations that are geographically located within the bounds of the specified box.

The coordinates are in the Belgian Lambert72 (EPSG:31370) coordinate system and are given in the order of lower left x, lower left y, upper right x, upper right y.

[7]:
from pydov.util.location import Within, Box

df = observatie.search(location=Within(Box(114000, 172310, 114005, 172315, epsg=31370)), max_features = 10)
df.head()
[000/001] .
[7]:
pkey_observatie pkey_parent fenomeentijd diepte_van_m diepte_tot_m parametergroep parameter detectieconditie resultaat eenheid methode uitvoerder herkomst
0 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2018-01-09 7.5 8.00 Onderkenningsproeven-korrelverdeling Korrelverdeling d.m.v. hydrometer/areometer (K... NaN NaN NaN Hydrometer VO - Afdeling Geotechniek LABO
1 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2018-01-09 7.5 8.00 Onderkenning-grondsoort Grondsoort volgens ASTM, de beschrijving (ASTM... NaN Clayey sand NaN Onbekend VO - Afdeling Geotechniek LABO
2 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2018-01-09 7.5 8.00 Onderkenning - proeven Consistentiegrenzen - Uitrolgrens (Consistenti... NaN 23 % Onbekend VO - Afdeling Geotechniek LABO
3 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2018-01-09 4.5 4.75 Onderkenning-grondsoort Grondsoort volgens ASTM, de code (ASTM_code) NaN ML - Onbekend VO - Afdeling Geotechniek LABO
4 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2018-01-09 4.5 4.75 Volumemassa-watergehalte Watergehalte (watergehalte) NaN 51.7 % Gewichtsverlies na drogen in droogstoof VO - Afdeling Geotechniek LABO

The dataframe contains several observations made at the same location

Using the pkey_observatie field one can request the details of these obsevrations in a webbrowser:

[8]:
for pkey_observatie in set(df.pkey_observatie):
    print(pkey_observatie)
https://www.dov.vlaanderen.be/data/observatie/2022-1754871
https://www.dov.vlaanderen.be/data/observatie/2022-4675419
https://www.dov.vlaanderen.be/data/observatie/2022-6135892
https://www.dov.vlaanderen.be/data/observatie/2022-2531554
https://www.dov.vlaanderen.be/data/observatie/2022-2805721
https://www.dov.vlaanderen.be/data/observatie/2022-5086066
https://www.dov.vlaanderen.be/data/observatie/2022-2028882
https://www.dov.vlaanderen.be/data/observatie/2022-2531553
https://www.dov.vlaanderen.be/data/observatie/2022-1846538
https://www.dov.vlaanderen.be/data/observatie/2022-2760180

Get observations with specific properties

Next to querying observations based on their geographic location within a bounding box, we can also search for observations matching a specific set of properties. For this we can build a query using a combination of the ‘Observatie’ fields and operators provided by the WFS protocol.

A list of possible operators can be found below:

[9]:
[i for i,j in inspect.getmembers(sys.modules['owslib.fes2'], inspect.isclass) if 'Property' in i]
[9]:
['PropertyIsBetween',
 'PropertyIsEqualTo',
 'PropertyIsGreaterThan',
 'PropertyIsGreaterThanOrEqualTo',
 'PropertyIsLessThan',
 'PropertyIsLessThanOrEqualTo',
 'PropertyIsLike',
 'PropertyIsNotEqualTo',
 'PropertyIsNull',
 'SortProperty']

In this example we build a query using the PropertyIsEqualTo operator to find all observations concerning the parameter “Watergehalte (watergehalte)”:

[10]:
from owslib.fes2 import PropertyIsEqualTo

query = PropertyIsEqualTo(propertyname='parameter',
                          literal='Watergehalte (watergehalte)')
df = observatie.search(query=query, max_features = 10)

df.head()
[000/001] .
[10]:
pkey_observatie pkey_parent fenomeentijd diepte_van_m diepte_tot_m parametergroep parameter detectieconditie resultaat eenheid methode uitvoerder herkomst
0 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 1967-03-14 0.6 0.78 Volumemassa-watergehalte Watergehalte (watergehalte) NaN 15.5 % Gewichtsverlies na drogen in droogstoof Rijksinstituut voor Grondmechanica LABO
1 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2025-02-27 20.8 20.85 Volumemassa-watergehalte Watergehalte (watergehalte) NaN 29.2 % Gewichtsverlies na drogen in droogstoof VO - Afdeling Geotechniek LABO
2 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2025-02-27 4.8 4.85 Volumemassa-watergehalte Watergehalte (watergehalte) NaN 22.0 % Gewichtsverlies na drogen in droogstoof VO - Afdeling Geotechniek LABO
3 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-01-29 22.0 22.50 Volumemassa-watergehalte Watergehalte (watergehalte) NaN 25.8 % Onbekend VO - Afdeling Geotechniek LABO
4 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-01-29 31.0 31.45 Volumemassa-watergehalte Watergehalte (watergehalte) NaN 23.8 % Onbekend VO - Afdeling Geotechniek LABO

Once again we can use the pkey_observatie as a permanent link to the information of these observations:

[11]:
for pkey_observatie in set(df.pkey_observatie):
    print(pkey_observatie)
https://www.dov.vlaanderen.be/data/observatie/2022-3228509
https://www.dov.vlaanderen.be/data/observatie/2026-53354083
https://www.dov.vlaanderen.be/data/observatie/2024-35758874
https://www.dov.vlaanderen.be/data/observatie/2026-53353988
https://www.dov.vlaanderen.be/data/observatie/2025-53353978
https://www.dov.vlaanderen.be/data/observatie/2024-35758957
https://www.dov.vlaanderen.be/data/observatie/2026-53354032
https://www.dov.vlaanderen.be/data/observatie/2025-53353951
https://www.dov.vlaanderen.be/data/observatie/2026-53354052
https://www.dov.vlaanderen.be/data/observatie/2026-53354173

Get observations in a bounding box based on specific properties

We can combine a query on attributes with a query on geographic location to get the observations within a bounding box that have specific properties.

The following example requests the observations where the parameter ‘Watergehalte (watergehalte)’ is greater than 30 and within the given bounding box.

(Note that the datatype of the literal parameter should be a string, regardless of the datatype of this field in the output dataframe.)

[12]:
from owslib.fes2 import PropertyIsGreaterThanOrEqualTo, And

query = And([PropertyIsGreaterThanOrEqualTo(propertyname='resultaat',literal='30'),
            PropertyIsEqualTo(propertyname='parameter', literal='Watergehalte (watergehalte)')])

df = observatie.search(
    location=Within(Box(114000, 172310, 114005, 172315, epsg=31370)),
    query=query,
    max_features = 10
    )

df.head()
[000/001] .
[12]:
pkey_observatie pkey_parent fenomeentijd diepte_van_m diepte_tot_m parametergroep parameter detectieconditie resultaat eenheid methode uitvoerder herkomst
0 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2018-01-09 4.5 4.75 Volumemassa-watergehalte Watergehalte (watergehalte) NaN 51.7 % Gewichtsverlies na drogen in droogstoof VO - Afdeling Geotechniek LABO
1 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2018-01-09 7.5 8.00 Volumemassa-watergehalte Watergehalte (watergehalte) NaN 36.3 % Gewichtsverlies na drogen in droogstoof VO - Afdeling Geotechniek LABO

We can look at one of theobservations in a webbrowser using its pkey_observatie:

[13]:
for pkey_observatie in set(df.pkey_observatie):
    print(pkey_observatie)
https://www.dov.vlaanderen.be/data/observatie/2022-2531554
https://www.dov.vlaanderen.be/data/observatie/2022-2760180

Select observations with specific conditions and return the results

We can limit the columns in the output dataframe by specifying the return_fields parameter in our search.

In this example we query all the observations that have a value (resultaat) greater than 10 for parameter ‘Watergehalte (watergehalte)’ and return its value (resultaat):

[14]:
query = And([PropertyIsGreaterThanOrEqualTo(propertyname='resultaat',literal='10'),
            PropertyIsEqualTo(propertyname='parameter', literal='Watergehalte (watergehalte)')])

df = observatie.search(query=query,
                       return_fields=('resultaat',),
                       max_features=10)
df.head()
[000/001] .
[14]:
resultaat
0 15.5
1 29.2
2 22.0
3 25.8
4 23.8
[15]:
df.describe()
[15]:
resultaat
count 10
unique 10
top 15.5
freq 1

By discarding the observations with a resultaat less than 20, we get a different result:

[18]:
df[df.resultaat.astype(float) < 25.0].describe()
[18]:
resultaat
count 6
unique 6
top 15.5
freq 1
[20]:
ax = df.astype(float).boxplot()
ax.set_ylabel("Water content(%)");
ax.set_title("Distribution of water content");
../_images/notebooks_search_observaties_37_0.png

Get observations based on fields not available in the standard output dataframe

To keep the output dataframe size acceptable, not all available WFS fields are included in the standard output. However, one can use this information to select observations as illustrated below.

For example, make a selection of the observations that have an ‘opdracht’:

[21]:
from owslib.fes2 import Not
from owslib.fes2 import PropertyIsNull

query = Not([PropertyIsNull(propertyname='opdracht')])

df = observatie.search(query=query, max_features = 10,
                   return_fields=('pkey_observatie', 'opdracht'))
df.head()
[000/001] .
[21]:
pkey_observatie opdracht
0 https://www.dov.vlaanderen.be/data/observatie/... Curieuzeneuzen in de tuin,Curieuzeneuzen in de...
1 https://www.dov.vlaanderen.be/data/observatie/... Curieuzeneuzen in de tuin,Curieuzeneuzen in de...
2 https://www.dov.vlaanderen.be/data/observatie/... Curieuzeneuzen in de tuin,Curieuzeneuzen in de...
3 https://www.dov.vlaanderen.be/data/observatie/... Curieuzeneuzen in de tuin,Curieuzeneuzen in de...
4 https://www.dov.vlaanderen.be/data/observatie/... Curieuzeneuzen in de tuin 2020,Curieuzeneuzen ...

Select observations with extra details

We can ask extra info from an observation from the XML. In this example we want the details of an observation

[22]:
from pydov.search.observatie import ObservatieSearch
from pydov.types.observatie import Observatie, ObservatieDetails

observatie = ObservatieSearch(
    objecttype=Observatie.with_extra_fields(ObservatieDetails)
)

df = observatie.search(max_features=10)
df.head()
[000/001] .
[000/010] ..........
[22]:
pkey_observatie pkey_parent fenomeentijd diepte_van_m diepte_tot_m parametergroep parameter detectieconditie resultaat eenheid methode uitvoerder herkomst betrouwbaarheid geobserveerd_object_type geobserveerd_object_naam geobserveerd_object_permkey
0 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/bodemlocati... 2024-12-18 NaN NaN Bodem_terrein Vegetatie (vegetatie) NaN Gras - NaN Steegmans, Joris (Aron bv) VELD B bodemlocatie ARCH_2024L222_LB1 2024-035950
1 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/bodemlocati... 2024-12-18 NaN NaN Bodem_fysisch_vocht Diepte (grond)watertafel t.o.v. maaiveld (wate... NaN 100 cm Bodemhydrologie, veldhandleiding voor archeolo... Steegmans, Joris (Aron bv) VELD B bodemlocatie ARCH_2024L222_LB1 2024-035950
2 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/bodemlocati... 2024-12-18 NaN NaN Bodem_terrein Vegetatie (vegetatie) NaN Gras - NaN Steegmans, Joris (Aron bv) VELD B bodemlocatie ARCH_2024L222_LB10 2024-035951
3 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/bodemlocati... 2024-12-18 NaN NaN Bodem_boring Diameter van de boor (boor_diameter) NaN 7.0 cm Code van Goede Praktijk voor Archeologie en Me... Steegmans, Joris (Aron bv) VELD B bodemlocatie ARCH_2024L222_LB12 2024-035953
4 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/bodemlocati... 2024-12-18 NaN NaN Bodem_boring Type van de boring (boor_type) NaN Edelman NaN NaN Steegmans, Joris (Aron bv) VELD B bodemlocatie ARCH_2024L222_LB13 2024-035954

Get observations with data from the subtype ‘SecundaireParameter’

Another available subtype within observations search: ‘SecundaireParameter’

[26]:
from pydov.search.observatie import ObservatieSearch
from pydov.types.observatie import Observatie, SecundaireParameter
from owslib.fes2 import PropertyIsLike

observatie = ObservatieSearch(
    objecttype=Observatie.with_subtype(SecundaireParameter))
query = PropertyIsLike(propertyname='pkey_observatie',
                       literal='%/2019-000555')
df = observatie.search(query=query, max_features = 10)
df.head()
[000/001] .
[000/001] c
[26]:
pkey_observatie pkey_parent fenomeentijd diepte_van_m diepte_tot_m parametergroep parameter detectieconditie resultaat eenheid methode uitvoerder herkomst secundaireparameter_parameter secundaireparameter_resultaat secundaireparameter_eenheid
0 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/bodemdiepte... 2015-12-10 NaN NaN Bodem_fysisch_vocht Ksat (ksat) NaN 0.00E00 m/s Ksat Open-end-methode Bodemkundige Dienst van België VELD temp_bodem 5.0 °C
1 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/bodemdiepte... 2015-12-10 NaN NaN Bodem_fysisch_vocht Ksat (ksat) NaN 0.00E00 m/s Ksat Open-end-methode Bodemkundige Dienst van België VELD temp_water 5.0 °C
2 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/bodemdiepte... 2015-12-10 NaN NaN Bodem_fysisch_vocht Ksat (ksat) NaN 0.00E00 m/s Ksat Open-end-methode Bodemkundige Dienst van België VELD proefvlak_diepte 60.0 cm

Visualize results

Using Geopandas GeoDataFrame, we can easily display the results of our search on a map.

[27]:
import geopandas as gpd
from pydov.search.fields import GeometryReturnField

from pydov.search.fields import GeometryReturnField

query = And([PropertyIsGreaterThanOrEqualTo(propertyname='resultaat',literal='10'),
             PropertyIsEqualTo(propertyname='parameter', literal='Watergehalte (watergehalte)')])

df = observatie.search(query=query, location=Within(Box(100000, 100000, 500000, 500000, epsg=31370)),
                       return_fields=('pkey_observatie','resultaat',GeometryReturnField('geom', epsg=31370)), max_features = 100)
[000/001] .
[28]:
df
[28]:
pkey_observatie resultaat geom
0 https://www.dov.vlaanderen.be/data/observatie/... 15.5 POINT (154823 177008)
1 https://www.dov.vlaanderen.be/data/observatie/... 29.2 POINT (101458.94 190074.92)
2 https://www.dov.vlaanderen.be/data/observatie/... 22.0 POINT (101458.94 190074.92)
3 https://www.dov.vlaanderen.be/data/observatie/... 25.8 POINT (147404.2 222441.4)
4 https://www.dov.vlaanderen.be/data/observatie/... 23.8 POINT (147404.2 222441.4)
... ... ... ...
95 https://www.dov.vlaanderen.be/data/observatie/... 29.3 POINT (150362.19 201546.7)
96 https://www.dov.vlaanderen.be/data/observatie/... 46.6 POINT (153011.06 196404.89)
97 https://www.dov.vlaanderen.be/data/observatie/... 42.1 POINT (152832.03 196327.5)
98 https://www.dov.vlaanderen.be/data/observatie/... 46.0 POINT (153132.55 196323.71)
99 https://www.dov.vlaanderen.be/data/observatie/... 37.6 POINT (152980.98 196326.26)

100 rows × 3 columns

[29]:
gdf = gpd.GeoDataFrame(df, geometry='geom', crs='EPSG:31370')
gdf.explore()
[29]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Find observations with fraction measurements

Observations of type ‘Textuurmeting’ contain multiple values per observation: they are the result of fraction measurements and include the different intervals and their respective mass percentage.

While these observations are included when using the standard ObservatieSearch class, by default the measurements themselves are not included there. You can include them by adding the Fractiemeting subtype:

[30]:
from pydov.search.observatie import ObservatieSearch
from pydov.types.observatie import Observatie, Fractiemeting

from owslib.fes2 import PropertyIsEqualTo

search = ObservatieSearch(
    objecttype=Observatie.with_subtype(Fractiemeting)
)

df = search.search(
    query=PropertyIsEqualTo('observatietype', 'Textuurmeting'),
    max_features=1)
df
[000/001] .
[000/001] .
[30]:
pkey_observatie pkey_parent fenomeentijd diepte_van_m diepte_tot_m parametergroep parameter detectieconditie resultaat eenheid methode uitvoerder herkomst fractiemeting_ondergrens fractiemeting_bovengrens fractiemeting_waarde
0 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.00 0.01 0.000
1 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.01 0.05 0.000
2 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.05 0.10 0.000
3 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.10 0.20 0.000
4 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.20 0.30 0.000
5 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.30 0.40 0.000
6 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.40 0.50 0.014
7 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.50 0.75 0.348
8 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.75 1.00 0.322
9 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 1.00 1.50 0.529
10 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 1.50 2.00 0.528
11 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 2.00 4.00 2.220
12 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 4.00 8.00 3.641
13 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 8.00 16.00 5.457
14 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 16.00 31.00 7.419
15 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 31.00 63.00 10.702
16 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 63.00 125.00 21.422
17 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 125.00 250.00 31.117
18 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 250.00 500.00 15.191
19 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 500.00 1000.00 1.091
20 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... NaN NaN % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 1000.00 2000.00 0.000

To make it easier to find the observations with fraction measurements, and immediately retrieve the data, you can use the ObservatieFractiemetingSearch class instead. This will return only observations of the type ‘Textuurmeting’ (hence: containing fraction measurements) and will include the Fractiemeting subtype by default:

[31]:
from pydov.search.observatie import ObservatieFractiemetingSearch

s = ObservatieFractiemetingSearch()
df = s.search(max_features=1)
df
[000/001] .
[000/001] c
[31]:
pkey_observatie pkey_parent fenomeentijd diepte_van_m diepte_tot_m parametergroep parameter eenheid methode uitvoerder herkomst fractiemeting_ondergrens fractiemeting_bovengrens fractiemeting_waarde
0 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.00 0.01 0.000
1 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.01 0.05 0.000
2 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.05 0.10 0.000
3 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.10 0.20 0.000
4 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.20 0.30 0.000
5 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.30 0.40 0.000
6 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.40 0.50 0.014
7 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.50 0.75 0.348
8 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 0.75 1.00 0.322
9 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 1.00 1.50 0.529
10 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 1.50 2.00 0.528
11 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 2.00 4.00 2.220
12 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 4.00 8.00 3.641
13 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 8.00 16.00 5.457
14 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 16.00 31.00 7.419
15 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 31.00 63.00 10.702
16 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 63.00 125.00 21.422
17 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 125.00 250.00 31.117
18 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 250.00 500.00 15.191
19 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 500.00 1000.00 1.091
20 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-06-01 NaN NaN Bodem_fysisch_textuur Textuurfracties laser volumeprocent (textuurme... % Textuurfracties volumeprocent afgeleid op basi... Université Catholique de Louvain, Earth and Cl... LABO 1000.00 2000.00 0.000

Find observations with measurement series

Observations of type ‘Meetreeks’ contain multiple values per observation: they are the result of a series of measurements and include a list of points (meetpunten) and their corresponding values (meetwaarden). Both the points and the values have a parameter and a unit.

While these observations are included when using the standard ObservatieSearch class, by default the measurements themselves are not included there. You can include them by adding the Meetreeks subtype:

[32]:
from pydov.search.observatie import ObservatieSearch
from pydov.types.observatie import Observatie, Meetreeks

from owslib.fes2 import PropertyIsEqualTo

search = ObservatieSearch(
    objecttype=Observatie.with_subtype(Meetreeks)
)

df = search.search(
    query=PropertyIsEqualTo('observatietype', 'Meetreeks'),
    max_features=1)
df
[000/001] .
[000/001] .
[32]:
pkey_observatie pkey_parent fenomeentijd diepte_van_m diepte_tot_m parametergroep parameter detectieconditie resultaat eenheid methode uitvoerder herkomst meetreeks_meetpunt_parameter meetreeks_meetpunt meetreeks_meetpunt_eenheid meetreeks_meetwaarde_parameter meetreeks_meetwaarde meetreeks_meetwaarde_eenheid
0 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-02-06 22.0 22.5 Onderkenningsproeven-korrelverdeling Korrelverdeling d.m.v. hydrometer/areometer (K... NaN NaN NaN Onbekend VO - Afdeling Geotechniek LABO Diameter 0.001718 mm Fractie met grotere diameter 98.3 %
1 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-02-06 22.0 22.5 Onderkenningsproeven-korrelverdeling Korrelverdeling d.m.v. hydrometer/areometer (K... NaN NaN NaN Onbekend VO - Afdeling Geotechniek LABO Diameter 0.007332 mm Fractie met grotere diameter 95.0 %
2 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-02-06 22.0 22.5 Onderkenningsproeven-korrelverdeling Korrelverdeling d.m.v. hydrometer/areometer (K... NaN NaN NaN Onbekend VO - Afdeling Geotechniek LABO Diameter 0.010916 mm Fractie met grotere diameter 94.4 %
3 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-02-06 22.0 22.5 Onderkenningsproeven-korrelverdeling Korrelverdeling d.m.v. hydrometer/areometer (K... NaN NaN NaN Onbekend VO - Afdeling Geotechniek LABO Diameter 0.015932 mm Fractie met grotere diameter 94.0 %
4 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-02-06 22.0 22.5 Onderkenningsproeven-korrelverdeling Korrelverdeling d.m.v. hydrometer/areometer (K... NaN NaN NaN Onbekend VO - Afdeling Geotechniek LABO Diameter 0.026385 mm Fractie met grotere diameter 92.4 %

To make it easier to find the observations with measurement series, and immediately retrieve the data, you can use the ObservatieMeetreeksSearch class instead. This will return only observations of the type ‘Meetreeks’ (hence: containing measurement series) and will include the Meetreeks subtype by default:

[33]:
from pydov.search.observatie import ObservatieMeetreeksSearch

s = ObservatieMeetreeksSearch()
df = s.search(max_features=1)
df
[000/001] .
[000/001] c
[33]:
pkey_observatie pkey_parent fenomeentijd diepte_van_m diepte_tot_m parametergroep parameter methode uitvoerder herkomst meetreeks_meetpunt_parameter meetreeks_meetpunt meetreeks_meetpunt_eenheid meetreeks_meetwaarde_parameter meetreeks_meetwaarde meetreeks_meetwaarde_eenheid
0 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-02-06 22.0 22.5 Onderkenningsproeven-korrelverdeling Korrelverdeling d.m.v. hydrometer/areometer (K... Onbekend VO - Afdeling Geotechniek LABO Diameter 0.001718 mm Fractie met grotere diameter 98.3 %
1 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-02-06 22.0 22.5 Onderkenningsproeven-korrelverdeling Korrelverdeling d.m.v. hydrometer/areometer (K... Onbekend VO - Afdeling Geotechniek LABO Diameter 0.007332 mm Fractie met grotere diameter 95.0 %
2 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-02-06 22.0 22.5 Onderkenningsproeven-korrelverdeling Korrelverdeling d.m.v. hydrometer/areometer (K... Onbekend VO - Afdeling Geotechniek LABO Diameter 0.010916 mm Fractie met grotere diameter 94.4 %
3 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-02-06 22.0 22.5 Onderkenningsproeven-korrelverdeling Korrelverdeling d.m.v. hydrometer/areometer (K... Onbekend VO - Afdeling Geotechniek LABO Diameter 0.015932 mm Fractie met grotere diameter 94.0 %
4 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2020-02-06 22.0 22.5 Onderkenningsproeven-korrelverdeling Korrelverdeling d.m.v. hydrometer/areometer (K... Onbekend VO - Afdeling Geotechniek LABO Diameter 0.026385 mm Fractie met grotere diameter 92.4 %

Working with water samples and observations

For further analysis and visualisation of the time series data, we can use the data analysis library pandas and visualisation library matplotlib.

[34]:
import pandas as pd
import matplotlib.pyplot as plt

Query the data of a specific filter using its permanent key:

[35]:
from pydov.search.monster import MonsterSearch
from pydov.search.observatie import ObservatieSearch

from owslib.fes2 import PropertyIsLike

monster = MonsterSearch()
observatie = ObservatieSearch()

query = PropertyIsLike(
            propertyname='pkey_parents',
            literal='%/data/filter/1991-001040|%')

df_monsters = monster.search(query=query)
df_monsters.head()
[000/001] .
[35]:
pkey_monster naam pkey_parents materiaalklasse datum_monstername diepte_van_m diepte_tot_m monstertype monstersamenstelling bemonsteringsprocedure bemonsteringsinstrument bemonstering_door
0 https://www.dov.vlaanderen.be/data/monster/201... 4-0076-F1/M1/C2013 (https://www.dov.vlaanderen.be/data/filter/199... grondwater 2014-02-25 NaN 13.0 vloeistof Enkelvoudig monster NaN (pomp,) DE WATERGROEP (VROEGER: VMW - VLAAMSE MAATSCHA...
1 https://www.dov.vlaanderen.be/data/monster/201... 4-0076-F1/M2014 (https://www.dov.vlaanderen.be/data/filter/199... grondwater 2014-09-30 NaN 13.0 vloeistof Enkelvoudig monster NaN (pomp,) EUROFINS
2 https://www.dov.vlaanderen.be/data/monster/201... 4-0076-F1/M2015 (https://www.dov.vlaanderen.be/data/filter/199... grondwater 2015-09-30 NaN 13.0 vloeistof Enkelvoudig monster NaN (pomp,) Eurofins Analytico B.V.
3 https://www.dov.vlaanderen.be/data/monster/201... 4-0076-F1/M2016 (https://www.dov.vlaanderen.be/data/filter/199... grondwater 2016-07-12 NaN 13.0 vloeistof Enkelvoudig monster NaN (pomp,) Eurofins Analytico B.V.
4 https://www.dov.vlaanderen.be/data/monster/201... 4-0076-F1/M2017 (https://www.dov.vlaanderen.be/data/filter/199... grondwater 2017-03-27 NaN 13.0 vloeistof Enkelvoudig monster NaN (pomp,) Eurofins Analytico B.V.

Find the related observations:

[36]:
from pydov.util.query import Join

df_observaties = observatie.search(
    query=Join(df_monsters, on='pkey_parent', using='pkey_monster')
)

df_observaties.head()
[000/001] .
[36]:
pkey_observatie pkey_parent fenomeentijd diepte_van_m diepte_tot_m parametergroep parameter detectieconditie resultaat eenheid methode uitvoerder herkomst
0 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2012-11-26 NaN NaN Anionen Fluoride (F) < 0.100 mg/l Onbekend CHEMIPHAR LABO
1 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2012-11-26 NaN NaN Fysico-chemische parameters Elektrische geleidbaarheid (EC) NaN 2050 µS/cm Onbekend CHEMIPHAR LABO
2 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2012-11-26 NaN NaN Anionen Bicarbonaat (HCO3) NaN 976.0 mg/l Onbekend CHEMIPHAR LABO
3 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2012-11-26 NaN NaN Anionen Nitriet (NO2) < 0.010 mg/l Onbekend CHEMIPHAR LABO
4 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2012-11-26 NaN NaN Kationen Ammonium (NH4) NaN 0.310 mg/l Onbekend CHEMIPHAR LABO

The date is still stored as a string type. Transforming to a data type using the available pandas function to_datetime and using these dates as row index:

[37]:
df_observaties['fenomeentijd'] = pd.to_datetime(df_observaties['fenomeentijd'])
df_observaties['resultaat'] = pd.to_numeric(df_observaties['resultaat'])

For many usecases, it is useful to create a pivoted table, showing the value per parameter:

[38]:
pivot = df_observaties.pivot_table(columns=df_observaties.parameter, values='resultaat', index='fenomeentijd')
pivot
[38]:
parameter AfwijkingBalans% (%AfwijkBalans) Aluminium (Al) Ammonium (NH4) Arseen (As) Bicarbonaat (HCO3) Boor (B) Bromide (Br) Cadmium (Cd) Calcium (Ca) Carbonaat (CO3) ... Opgeloste zuurstof (O2) Redoxpotentiaal (Eh°) Som anionen (SomAN) Som kationen (SomKAT) Sulfaat (SO4) Temperatuur (T) Totaal organische koolstof (TOC) Zink (Zn) Zuurtegraad (pH) Zuurtegraad in het labo (pH(Lab.))
fenomeentijd
2006-05-24 NaN 0.050 0.360 5.000 863.4 NaN NaN 0.500 399.0 NaN ... 0.5 120.0 NaN NaN 488.0 13.9 58.0 16.0 6.70 NaN
2009-03-13 NaN NaN 0.370 5.000 945.6 NaN NaN 0.500 394.7 1.0 ... 0.3 130.0 NaN NaN 431.0 12.7 8.6 10.0 6.76 6.80
2009-12-23 NaN NaN 0.290 12.467 939.4 NaN NaN 0.500 447.2 1.0 ... 1.0 34.0 NaN NaN 433.6 10.8 8.9 24.9 7.04 6.90
2011-03-28 NaN NaN 0.330 12.998 1030.3 NaN NaN 0.519 331.1 1.0 ... 0.3 189.0 NaN NaN 290.1 12.0 10.0 13.0 6.70 6.90
2011-11-04 NaN NaN 0.310 8.400 958.3 112.0 NaN 0.500 345.0 1.0 ... 0.1 307.0 NaN NaN 385.5 12.1 8.3 10.9 6.73 7.40
2012-11-26 NaN NaN 0.310 NaN 976.0 NaN NaN NaN 360.0 1.0 ... 0.4 179.0 NaN NaN 313.0 12.7 7.8 NaN 6.61 7.18
2014-02-25 NaN NaN 0.670 2.000 969.2 100.0 NaN 0.030 330.0 1.0 ... 0.2 176.0 NaN NaN 190.0 12.4 7.5 5.0 6.82 7.10
2014-09-30 NaN 0.020 0.306 2.300 976.0 100.0 NaN 0.030 280.0 1.0 ... 0.2 176.0 NaN NaN 143.2 12.4 5.8 5.0 6.82 6.90
2015-09-30 -6.049 0.049 0.325 5.000 963.8 115.5 NaN 0.500 299.4 1.0 ... 0.2 149.5 22.346 19.797 171.2 12.0 9.2 47.3 6.68 6.80
2016-07-12 NaN 0.020 0.065 5.000 931.5 138.7 NaN 0.400 335.5 1.0 ... 3.0 173.7 22.526 22.431 224.0 12.2 8.8 16.5 7.41 6.79
2017-03-27 -7.305 0.097 0.481 5.000 994.9 97.3 NaN 0.400 289.2 1.0 ... 0.2 137.2 23.021 19.886 218.4 12.3 8.0 10.0 6.76 6.77
2018-09-03 0.835 0.020 0.316 5.000 979.1 134.9 NaN 0.400 354.3 1.0 ... 0.2 199.3 23.197 23.588 222.8 12.3 9.1 10.0 6.87 6.88
2019-06-13 2.065 0.028 0.276 5.000 1012.0 133.2 0.62 0.400 334.0 1.0 ... 0.9 213.6 21.974 22.900 187.7 14.2 9.5 10.0 6.93 6.75
2020-06-09 0.233 0.020 0.213 5.000 965.0 179.7 0.58 0.400 291.6 1.0 ... 0.2 113.4 20.457 20.552 134.3 13.6 11.3 10.0 6.63 6.79
2021-09-02 NaN 0.020 0.345 5.000 936.4 120.3 0.61 0.400 266.2 1.0 ... 0.4 128.5 18.484 18.562 70.1 12.7 10.7 10.0 6.60 6.78
2024-11-06 -4.959 0.020 0.504 5.000 952.2 121.3 0.58 0.400 239.4 1.0 ... 2.7 266.0 18.829 17.050 69.6 12.9 10.0 10.0 7.20 6.89

16 rows × 40 columns

For plotting, the default plotting functionality of Pandas can be used:

[39]:
parameters = ['Nitraat (NO3)', 'Nitriet (NO2)', 'Ammonium (NH4)']
ax = pivot[parameters].plot.line(style='.-', figsize=(12, 5))
ax.set_xlabel('');
ax.set_ylabel('concentration (mg/l)');
ax.set_title('Concentration nitrite, nitrate and ammonium for filter id 1991-001040');
../_images/notebooks_search_observaties_71_0.png

Combine search in filters and samples

For this example, we will first search filters, and later search all samples and observations for this selection. We will select filters in the primary network located in Kalmthout.

[40]:
from pydov.search.grondwaterfilter import GrondwaterFilterSearch
from pydov.search.monster import MonsterSearch
from pydov.util.query import FuzzyJoin

from owslib.fes2 import And

filter = GrondwaterFilterSearch()
monster = MonsterSearch()

gemeente = 'Kalmthout'
filter_query = And([PropertyIsLike(propertyname='meetnet',
                       literal='meetnet 1 %'),
                    PropertyIsEqualTo(propertyname='gemeente',
                       literal=gemeente)])

df_filters = filter.search(query=filter_query, return_fields=['pkey_filter', 'gw_id', 'filternummer'])
df_filters
[000/001] .
[40]:
pkey_filter gw_id filternummer
0 https://www.dov.vlaanderen.be/data/filter/1975... 1-0515 1
1 https://www.dov.vlaanderen.be/data/filter/1981... 1-0410 1
2 https://www.dov.vlaanderen.be/data/filter/1975... 1-0171 1
3 https://www.dov.vlaanderen.be/data/filter/1981... 1-0410 3
4 https://www.dov.vlaanderen.be/data/filter/1981... 1-0409 1
5 https://www.dov.vlaanderen.be/data/filter/1981... 1-0415 2
6 https://www.dov.vlaanderen.be/data/filter/1981... 1-0710 1
7 https://www.dov.vlaanderen.be/data/filter/1981... 1-0415 3
8 https://www.dov.vlaanderen.be/data/filter/1981... 1-0410 2
9 https://www.dov.vlaanderen.be/data/filter/1981... 1-0710 3
10 https://www.dov.vlaanderen.be/data/filter/1981... 1-0415 4
11 https://www.dov.vlaanderen.be/data/filter/1981... 1-0710 2
12 https://www.dov.vlaanderen.be/data/filter/1981... 1-0409 2
13 https://www.dov.vlaanderen.be/data/filter/1981... 1-0415 1

Find all samples linked to the filters:

[41]:
df_monsters = monster.search(
    query=FuzzyJoin(df_filters, on='pkey_parents', using='pkey_filter'))

df_monsters['pkey_filter'] = df_monsters.pkey_parents.apply(lambda x: x[0])
df_monsters = df_monsters.merge(df_filters, on='pkey_filter')

df_monsters.head()
[000/001] .
[41]:
pkey_monster naam pkey_parents materiaalklasse datum_monstername diepte_van_m diepte_tot_m monstertype monstersamenstelling bemonsteringsprocedure bemonsteringsinstrument bemonstering_door pkey_filter gw_id filternummer
0 https://www.dov.vlaanderen.be/data/monster/201... 1-0171-F1/M2014 (https://www.dov.vlaanderen.be/data/filter/197... grondwater 2014-07-17 NaN 27.5 vloeistof Enkelvoudig monster NaN (pomp,) Bodemkundige Dienst van België https://www.dov.vlaanderen.be/data/filter/1975... 1-0171 1
1 https://www.dov.vlaanderen.be/data/monster/201... 1-0171-F1/M2015 (https://www.dov.vlaanderen.be/data/filter/197... grondwater 2015-08-26 NaN 27.5 vloeistof Enkelvoudig monster NaN (pomp,) Eurofins Analytico B.V. https://www.dov.vlaanderen.be/data/filter/1975... 1-0171 1
2 https://www.dov.vlaanderen.be/data/monster/201... 1-0171-F1/M2016 (https://www.dov.vlaanderen.be/data/filter/197... grondwater 2016-07-05 NaN 27.5 vloeistof Enkelvoudig monster NaN (pomp,) Eurofins Analytico B.V. https://www.dov.vlaanderen.be/data/filter/1975... 1-0171 1
3 https://www.dov.vlaanderen.be/data/monster/201... 1-0171-F1/M2017 (https://www.dov.vlaanderen.be/data/filter/197... grondwater 2017-03-10 NaN 27.5 vloeistof Enkelvoudig monster NaN (pomp,) Eurofins Analytico B.V. https://www.dov.vlaanderen.be/data/filter/1975... 1-0171 1
4 https://www.dov.vlaanderen.be/data/monster/201... 1-0171-F1/M2018 (https://www.dov.vlaanderen.be/data/filter/197... grondwater 2018-08-07 NaN 27.5 vloeistof Enkelvoudig monster NaN (pomp,) Eurofins Analytico B.V. https://www.dov.vlaanderen.be/data/filter/1975... 1-0171 1

Find all NH4 observations linked to the samples:

[42]:
df_observaties = observatie.search(query=And([
    Join(df_monsters, on='pkey_parent', using='pkey_monster'),
    PropertyIsEqualTo('parameter', 'Ammonium (NH4)'),
    PropertyIsEqualTo('herkomst', 'LABO')
]))
df_observaties = df_observaties.merge(df_monsters, left_on='pkey_parent', right_on='pkey_monster')

df_observaties.head()
[000/001] .
[42]:
pkey_observatie pkey_parent fenomeentijd diepte_van_m_x diepte_tot_m_x parametergroep parameter detectieconditie resultaat eenheid ... diepte_van_m_y diepte_tot_m_y monstertype monstersamenstelling bemonsteringsprocedure bemonsteringsinstrument bemonstering_door pkey_filter gw_id filternummer
0 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2016-07-05 NaN NaN Kationen Ammonium (NH4) NaN 0.098 mg/l ... NaN 14.5 vloeistof Enkelvoudig monster NaN (pomp,) Eurofins Analytico B.V. https://www.dov.vlaanderen.be/data/filter/1981... 1-0409 1
1 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2010-12-06 NaN NaN Kationen Ammonium (NH4) NaN 0.210 mg/l ... NaN 54.0 vloeistof Enkelvoudig monster NaN (pomp,) EUROFINS https://www.dov.vlaanderen.be/data/filter/1981... 1-0415 3
2 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/201... 2016-07-05 NaN NaN Kationen Ammonium (NH4) NaN 0.184 mg/l ... NaN 17.6 vloeistof Enkelvoudig monster NaN (pomp,) Eurofins Analytico B.V. https://www.dov.vlaanderen.be/data/filter/1981... 1-0410 1
3 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2025-03-13 NaN NaN Kationen Ammonium (NH4) NaN 0.598 mg/l ... NaN 45.0 vloeistof Enkelvoudig monster NaN (pomp,) Eurofins Analytico B.V. https://www.dov.vlaanderen.be/data/filter/1981... 1-0410 2
4 https://www.dov.vlaanderen.be/data/observatie/... https://www.dov.vlaanderen.be/data/monster/202... 2025-03-13 NaN NaN Kationen Ammonium (NH4) NaN 0.757 mg/l ... NaN 82.0 vloeistof Enkelvoudig monster NaN (pomp,) Eurofins Analytico B.V. https://www.dov.vlaanderen.be/data/filter/1981... 1-0410 3

5 rows × 28 columns

And plot the results:

[43]:
df_observaties['fenomeentijd'] = pd.to_datetime(df_observaties['fenomeentijd'])
df_observaties['resultaat'] = pd.to_numeric(df_observaties['resultaat'])

trends_sel = df_observaties.set_index('fenomeentijd')
trends_sel['label'] = trends_sel['gw_id'] + ' F' + trends_sel['filternummer']

# By pivoting, we get each location in a different column
trends_sel_pivot = trends_sel.pivot_table(columns='label', values='resultaat', index='fenomeentijd')
# trends_sel_pivot.index = pd.to_datetime(trends_sel_pivot.index)

# resample to yearly values and plot data
ax = trends_sel_pivot.resample('A').median().plot.line(style='.-', figsize=(12, 5))
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))

ax.set_title(f'Long term evolution of NH4 in {gemeente}');
ax.set_xlabel('year');
ax.set_ylabel('concentration (mg/l)');
../_images/notebooks_search_observaties_80_0.png