Query on PFAS in groundwater
GuillaumeVandekerckhove opened this issue · comments
- PyDOV version: 2.1.0
- Python version: 3.7
- Operating System: x64, 16GB
For my thesis I want to work with the PFAS data.
I can download the groundwater monsters and then filter on 'parametergroep == "Grondwater_chemisch_PFAS"'.
But this takes more time, because first all the groundwater monsters are downloaded.
I tried to work with a query, but I get the error;
pydov.util.errors.InvalidFieldError: Unknown query parameter: 'Grondwater_chemisch_PFAS'
I also don't see it in the list of groundwater monster fields.
This works (part of script);
gwmonster = GrondwaterMonsterSearch()
df = gwmonster.search(location=Within(Box(i, lowerlefty, i + dx, upperrighty)))
df = df[df.parametergroep == "Grondwater_chemisch_PFAS"]
df = pd.DataFrame(df)
This doesn't work;
gwmonster = GrondwaterMonsterSearch()
query = PropertyIsEqualTo(propertyname='Grondwater_chemisch_PFAS', literal= 'true')
df = gwmonster.search(location=Within(Box(i, lowerlefty, i + dx, upperrighty)), query=query)
df = pd.DataFrame(df)
Is there a possibility that I do a filtering on PFAS before downloading all the groundwater monsters?
example: https://www.dov.vlaanderen.be/data/filter/2003-005541
I think 'Grondwater_chemisch_PFAS' is not included in the feature catalogue of grondwatermonsters. At least, I don't see it here. If not included in the feature catalogue, you indeed need to download the entire Xml of each data point to check for the value of that attribute. You can always ask to include it in the feature catalogue of the WFS layer, that would speedup your search significantly. But cumbersome for the maintainers.
Maybe other options exist, than I'm curious to learn more.
Yes, this parameter group is indeed not one of the predefined ones in the WFS aggregate, therefore you cannot search on groundwater samples with measurements of this group. It should not be too hard to add this in the WFS service, I'll propose this to DOV and follow up here.
At some point we might want to align searching for and retrieving observations between the different datatypes though. We can have PFAS (or other) measurements/observations for borehole samples (Grondmonster), groundwater samples (Grondwatermonster) and soil samples (Bodemobservaties), and for each of them it is currently implemented differently..
There is analysis work going on at DOV side too regarding samples and observations, where we aim for a better aligned solution between the different datatypes. When this materialises we can subsequently align it in pydov too I think, but this will not be available in the short term.
What does exist in the WFS at this moment is the aggregate for measurements not belonging to one of the predefined parameter groups: andere_parameters
. Using this you can already gain a (small) performance improvement:
gwmonster = GrondwaterMonsterSearch()
df = gwmonster.search(
location=Within(Box(i, lowerlefty, i + dx, upperrighty)),
query=PropertyIsEqualTo('andere_parameters', 'true')
)
df = df[df.parametergroep == "Grondwater_chemisch_PFAS"]
df = pd.DataFrame(df)
The column 'chemisch_PFAS' has been added to the Grondwatermonster WFS service, which now allows querying on it like this:
gwmonster = GrondwaterMonsterSearch()
df = gwmonster.search(
query=PropertyIsEqualTo('chemisch_PFAS', 'true')
)
df = df[df.parametergroep == "Grondwater_chemisch_PFAS"]
df = pd.DataFrame(df)
Thank you for making this available!
I will close this issue then!