Deltares-research / kenmerkendewaarden

Derive indicators from waterlevel measurements
https://deltares-research.github.io/kenmerkendewaarden/
GNU General Public License v3.0
1 stars 0 forks source link

39 add overschrijding hydra statistics #106

Closed Mares2022 closed 3 weeks ago

Mares2022 commented 3 weeks ago

I have mainly modified KWK_process.py. I have added a function called set_hydra_nl_table() to set the Hydra-NL original tables into the dist_vali_exc dict dictionary. The set_table() function was also added to set validation data and the old exceedance frequency Hydra-NL function.

The pull request also includes the tables generated in Hydra-NL in .xls and .csv format for the stations available + Hydra-NL documentation.

The pull request has two jupyter notebooks, the first one called geometries was used KWK_geometries.ipynb was used to calculate the stations locations. However, this code is not working anymore after the changes made in the main source code for me. The same error is shown when running KWK_getcheckdata.py from this branch and from the main branch. Something to check later on to be sure there is no problem with the environments.

The second jupyter notebook KWK_process.ipynb can be ignored and not included in the main branch, as I only used it for testing purposes. I would like to keep the code anyway if possible in the main branch for future development.

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.96%. Comparing base (65adefe) to head (44eb596). Report is 3 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #106 +/- ## ========================================== - Coverage 87.97% 87.96% -0.02% ========================================== Files 9 9 Lines 1156 1155 -1 ========================================== - Hits 1017 1016 -1 Misses 139 139 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

veenstrajelmer commented 3 weeks ago

Thanks for this PR, I do have some additional requests:

Mares2022 commented 3 weeks ago

Adressing @veenstrajelmer requests.

veenstrajelmer commented 3 weeks ago

Files in .xls have symbols in a code that did not allow me to open them with pandas.

I have looked into reading this old xls format and found this solution that works:

import pandas as pd
file_xls = r"p:\11210325-005-kenmerkende-waarden\work\data_hydraNL\DENHDR.xls"
df = pd.read_table(file_xls, encoding='latin-1')
Mares2022 commented 3 weeks ago

A new commit including df = pd.read_table(file_xls, encoding='latin-1') was created. Now we are able to read the original Hydra-NL files in .xls format.

veenstrajelmer commented 3 weeks ago

Thanks for the updates! I have now looked into KWK_geometries.ipynb and it can indeed be useful for this station selection (until we move to Hydra-RING API). However, could you trim it down so it only contains the code necessary for the interactive map? Also, you could avoid saving the geojson since the gdf variable is already being generated from the DDL catalog and you do not seem to use it elsewhere.

Mares2022 commented 3 weeks ago
sonarcloud[bot] commented 3 weeks ago

Quality Gate Passed Quality Gate passed

Issues
4 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud