Deltares / ddlpy

API to Dutch Rijkswaterstaat archive (DDL, waterinfo.rws.nl) of monitoring water data
https://deltares.github.io/ddlpy/
GNU General Public License v3.0
20 stars 6 forks source link

bug: measurements_amount returns only first df #114

Closed veenstrajelmer closed 3 weeks ago

veenstrajelmer commented 3 weeks ago

Description

The dataframe returned by ddlpy.measurements_amount is not complete, since it only returns the first dataframe from the returned list.

What I Did

import ddlpy
locations = ddlpy.locations()
bool_hoedanigheid = locations['Hoedanigheid.Code'].isin(['NAP'])
bool_stations = locations.index.isin(['HOEKVHLD'])
bool_grootheid = locations['Grootheid.Code'].isin(['WATHTE'])
selected = locations.loc[bool_grootheid & bool_hoedanigheid & bool_stations]

date_min = "1980-01-01"
date_max = "2010-01-05"
# if we pass one row to the measurements function you can get all the measurements
df_amount = ddlpy.measurements_amount(selected.iloc[0], date_min, date_max)
print("df_amount:", df_amount)

This prints:

df_amount:                     AantalMetingen
Groeperingsperiode                
1980                          2009
1981                          1968
1982                          2005
1983                          2066
1984                          2045
1985                          1888
1986                          1909

But if we unindent return df_amount and the code above in ddlpy.measurements_amount() it returns:

df_amount:                     AantalMetingen
Groeperingsperiode                
1980                          2009
1981                          1968
1982                          2005
1983                          2066
1984                          2045
1985                          1888
1986                          1909
1987                          1868
1988                          1875
1989                          1886
1990                          1861
1991                          1913
1992                          1916
1993                          1944
1994                          1939
1995                          1999
1996                          1942
1997                          1951
1998                          1976
1999                          2019
2000                          1912
2001                          1887
2002                          1866
2003                          1823
2004                          1850
2005                          1797
2006                          1853
2007                          1814
2008                          1806
2009                          1869
2010                            29

After fixing this: