Update hydrograph - add xarray support, and improve plotting/metrics - #493
Conversation
|
done for the day, do i need to do something with these?
if yes, i will work on it tomorrow. |
| precipitation: pd.DataFrame | pd.Series | xr.DataArray | xr.Dataset | None = None, | ||
| dpi: int | None = None, | ||
| title: str | None = None, | ||
| discharge_units: str = "m$^3$ s$^{-1}$", |
There was a problem hiding this comment.
These should come standard with the data
| return new_df, new_period | ||
|
|
||
|
|
||
| def _to_pandas(data_in): |
There was a problem hiding this comment.
missing docstrings with a short explanation for most helper functions
| return table | ||
|
|
||
|
|
||
| def hydrograph( |
There was a problem hiding this comment.
also there are a lot of inputs for this function this way.
MarkMelotto
left a comment
There was a problem hiding this comment.
Very nice work!
Some small explanation steps are needed for the helper functions I feel.
Maybe it is also good to make an example notebook that is simple and explains all functionality.
Also for the helper functions it is not always clear how they are used and what they do specifically.
|
I think for the testing: we just need to run the test again? |
c1e8b1c
into
eWaterCycle:adding-era5LAND
* Add 'ERA5-Land' dataset to predefined datasets * ruff fixes * ruff fixes * ruff fixes, returning PLC0207 * ruff fixes, # noqa: S310 * ruff fixing, but patch will fail * Add support for reading monthly GRDC discharge data (.txt) (#494) * add support for monthly GRDC station .txt file and 1 test * placeholder docstring * minor formatting * docstring * updated docstring with data description for original/calculated/flag * Update hydrograph - add xarray support, and improve plotting/metrics (#493) * split hydrograph from __init__.py * add helper _to_pandas * update error message * update logic and error messages * update hydrograph * gitignore * update init * update test * tests * changed graph * added some TODO notes * fixed typo * some more changes, distinction one ore more * small fixes * update title and docstring * table column names from hydrostats * initial discharge_statistics * init py * init.py * completely revamped hydrograph to reduce complexity * gitignore * updated tests * gitignore * figures * prepare for PR * remove empty lines * changed docstring discharge * test metrics_list * test for y_sim shape = 1 * update test for single comparison * remove unused data from tests * lint whitespace * ruff update * update ruff * more ruff format * remove old test * added testing * ruff * fixed the comments from Bart * fixing fixtures * fixing errors --------- Co-authored-by: André van der Veen <220902110+andrevdv@users.noreply.github.com>
Directly related to Issue #477 -
xarraysupportxarray.Datasetby converting to a pandas DataFrame internally.Other changes:
Structure
__init__.pyinto its own file(hydrograph.py).hydrograph()function into multiple helper functions to reduce complexity and improve maintainability.plot:
metrics:
metrics_listargument:hydrostatspackage.["nse", "kge_2009", "sa", "me"].other changes:
selected_yearto slice both discharge and precipitation to a single year.known issues at the moment
possible improvements