py-ewr
Prototype tool for evaluating long-term watering plan environmental watering requirements.
Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.9%) to scientific vocabulary
Repository
Prototype tool for evaluating long-term watering plan environmental watering requirements.
Basic Info
- Host: GitHub
- Owner: MDBAuth
- License: cc0-1.0
- Language: Jupyter Notebook
- Default Branch: main
- Size: 9.77 MB
Statistics
- Stars: 8
- Watchers: 3
- Forks: 7
- Open Issues: 4
- Releases: 35
Metadata Files
README.md
EWR tool version 2.3.7 README
Notes on recent version updates
- Including metadata report (this is still being ironed out and tested)
- CLLMMc and CLLMMd ewrs are now able to be calculated without all barrage level gauges being present in the model file.
- Including draft objective mapping files in the package (see below sub heading Objective mapping for more information). Objective mapping has been therefore pulled out of the parameter sheet
- Including an example parallel processing script for running the EWR tool
- Adding handling for cases where there are single MDBA bigmod site IDs mapping to multiple different gauges
- Fix SDL resource unit mapping in the parameter sheet
- Adding lat and lon to the parameter sheet
- ten thousand year handling - this has been brought back online.
- Remove TQDM loading bars
- Adding new model format handling - 'IQQM - netcdf'
- Standard time-series handling added - each column needs a gauge, followed by and underscore, followed by either flow or level (e.g. 409025_flow). This handling also has missing date filling - so any missing dates will be filled with NaN values in all columns.
- bug fixes: spells of length equal to the minimum required spell length were getting filtered out of the successful events table and successful interevents table, fixed misclassification of some gauges to flow, level, and lake level categories
- New EWRs: New Qld EWRs - SFFD and BFFD used to look into the FD EWRs in closer detail.
- Adding state and Surface Water SDL (SWSDL) to py-ewr output tables
Installation
Note - requires Python 3.9 to 3.13 (inclusive)
Step 1.
Upgrade pip
bash
python -m pip install –-upgrade pip
Step 2.
bash
pip install py-ewr
Option 1: Running the observed mode of the tool
The EWR tool will use a second program called gauge getter to first download the river data at the locations and dates selected and then run this through the EWR tool
```python
from datetime import datetime
USER INPUT REQUIRED>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
dates = {'startdate': datetime(YYYY, 7, 1), 'enddate': datetime(YYYY, 6, 30)}
gauges = ['Gauge1', 'Gauge2']
END USER INPUT<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
```
```python
from pyewr.observedhandling import ObservedHandler
Running the EWR tool:
ewr_oh = ObservedHandler(gauges=gauges, dates=dates)
Generating tables:
Table 1: Summarised EWR results for the entire timeseries
ewrresults = ewroh.getewrresults()
Table 2: Summarised EWR results, aggregated to water years:
yearlyewrresults = ewroh.getyearlyewrresults()
Table 3: All events details regardless of duration
allevents = ewroh.getallevents()
Table 4: Inverse of Table 3 showing the interevent periods
allinterEvents = ewroh.getallinterEvents()
Table 5: All events details that also meet the duration requirement:
allsuccessfulEvents = ewroh.getallsuccessful_events()
Table 6: Inverse of Table 5 showing the interevent periods:
allsuccessfulinterEvents = ewroh.getallsuccessfulinterEvents()
```
Option 2: Running model scenarios through the EWR tool
- Tell the tool where the model files are (can either be local or in a remote location)
- Tell the tool what format the model files are in. The current model format options are:
- 'Bigmod - MDBA' Bigmod formatted outputs
- 'Source - NSW (res.csv)' Source res.csv formatted outputs
- 'Standard time-series' The first column header should be Date with the date values in the YYYY-MM-DD format. The next columns should have the gauge followed by _ followed by either flow or level E.g. | Date | 409025flow | 409025level | 414203_flow | | --- | --- | --- | --- | | 1895-07-01 | 8505 | 5.25 | 8500 | | 1895-07-02 | 8510 | 5.26 | 8505 |
- 'ten thousand year'
This has the same formatting requirements as the 'Standard time-series'. This can handle ten thousand years worth of hydrology data.
The first column header should be *Date* with the date values in the YYYY-MM-DD format.
The next columns should have the *gauge* followed by *_* followed by either *flow* or *level*
E.g.
| Date | 409025_flow | 409025_level | 414203_flow |
| --- | --- | --- | --- |
| 105-07-01 | 8505 | 5.25 | 8500 |
| 105-07-02 | 8510 | 5.26 | 8505 |
```python
USER INPUT REQUIRED>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Minimum 1 scenario and 1 related file required
scenarios = {'Scenario1': ['file/location/1', 'file/location/2', 'file/location/3'], 'Scenario2': ['file/location/1', 'file/location/2', 'file/location/3']}
model_format = 'Bigmod - MDBA'
END USER INPUT<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
```
``` python from pyewr.scenariohandling import ScenarioHandler import pandas as pd
ewrresultsdict = {} yearlyresultsdict = {} alleventsdict = {} allinterEventsdict = {} allsuccessfulEventsdict = {} allsuccessfulinterEventsdict = {}
for scenarioname, scenariolist in scenarios.items(): ewrresults = pd.DataFrame() yearlyewrresults = pd.DataFrame() allevents = pd.DataFrame() allinterEvents = pd.DataFrame() allsuccessfulEvents = pd.DataFrame() allsuccessfulinterEvents = pd.DataFrame() for file in scenarios[scenarioname]:
# Running the EWR tool:
ewr_sh = ScenarioHandler(scenario_file = file,
model_format = model_format)
# Return each table and stitch the different files of the same scenario together:
# Table 1: Summarised EWR results for the entire timeseries
temp_ewr_results = ewr_sh.get_ewr_results()
ewr_results = pd.concat([ewr_results, temp_ewr_results], axis = 0)
# Table 2: Summarised EWR results, aggregated to water years:
temp_yearly_ewr_results = ewr_sh.get_yearly_ewr_results()
yearly_ewr_results = pd.concat([yearly_ewr_results, temp_yearly_ewr_results], axis = 0)
# Table 3: All events details regardless of duration
temp_all_events = ewr_sh.get_all_events()
all_events = pd.concat([all_events, temp_all_events], axis = 0)
# Table 4: Inverse of Table 3 showing the interevent periods
temp_all_interEvents = ewr_sh.get_all_interEvents()
all_interEvents = pd.concat([all_interEvents, temp_all_interEvents], axis = 0)
# Table 5: All events details that also meet the duration requirement:
temp_all_successfulEvents = ewr_sh.get_all_successful_events()
all_successful_Events = pd.concat([all_successful_Events, temp_all_successfulEvents], axis = 0)
# Table 6: Inverse of Table 5 showing the interevent periods:
temp_all_successful_interEvents = ewr_sh.get_all_successful_interEvents()
all_successful_interEvents = pd.concat([all_successful_interEvents, temp_all_successful_interEvents], axis = 0)
# Optional code to output results to csv files:
ewr_results.to_csv(scenario_name + 'all_results.csv')
yearly_ewr_results.to_csv(scenario_name + 'yearly_ewr_results.csv')
all_events.to_csv(scenario_name + 'all_events.csv')
all_interEvents.to_csv(scenario_name + 'all_interevents.csv')
all_successful_Events.to_csv(scenario_name + 'all_successful_Events.csv')
all_successful_interEvents.to_csv(scenario_name + 'all_successful_interEvents.csv')
# Save the final tables to the dictionaries:
ewr_results_dict[scenario_name] = ewr_results
yearly_results_dict[scenario_name] = yearly_ewr_results
all_events_dict[scenario_name] = all_events_dict
all_interEvents_dict[scenario_name] = all_interEvents
all_successful_Events_dict[scenario_name] = all_successful_Events
all_successful_interEvents_dict[scenario_name] = all_successful_interEvents
```
Purpose
This tool has two purposes: 1. Operational: Tracking EWR success at gauges of interest in real time - option 1 above. 2. Planning: Comparing EWR success between scenarios (i.e. model runs) - option 2 above.
Support For issues relating to the script, a tutorial, or feedback please contact Lara Palmer at lara.palmer@mdba.gov.au, Martin Job at martin.job@mdba.gov.au, or Joel Bailey at joel.bailey@mdba.gov.au
Disclaimer Every effort has been taken to ensure the EWR database represents the original EWRs from state Long Term Water Plans (LTWPs) and Environmental Water Management Plans (EWMPs) as best as possible, and that the code within this tool has been developed to interpret and analyse these EWRs in an accurate way. However, there may still be unresolved bugs in the EWR parameter sheet and/or EWR tool. Please report any bugs to the issues tab under the GitHub project so we can investigate further.
Notes on development of the dataset of EWRs The MDBA has worked with Basin state representatives to ensure scientific integrity of EWRs has been maintained when translating from raw EWRs in the Basin state LTWPs and EWMPs to the machine readable format found in the parameter sheet within this tool.
Compatibility
NSW: - All Queensland catchments - All New South Wales catchments - All South Australian catchments - All EWRs from river based Environmental Water Management Plans (EWMPs) in Victoria*
*Currently the wetland EWMPS and mixed wetland-river EWMPs in Victoria contain EWRs that cannot be evaluated by an automated EWR tool so the EWRs from these plans have been left out for now. The MDBA will work with our Victorian colleagues to ensure any updated EWRs in these plans are integrated into the tool where possible.
Input data
- Gauge data from the relevant Basin state websites and the Bureau of Meteorology website
- Scenario data input by the user
- Model metadata for location association between gauge ID's and model nodes
- EWR parameter sheet
Running the tool
Consult the user manual for instructions on how to run the tool. Please email the above email addresses for a copy of the user manual.
Objective mapping Objective mapping csv files are now included in the EWR tool package. Currently this objective mapping is in an early draft format. The objective mapping will be finalised after consultation with relevant state representatives. The files are intended to be used together to link EWRs to the detailed objectives, theme level targets and specific goals. The three sheets are located in the pyewr/parametermetadata folder: - ewr2obj.csv: For each planning unit, gauge, ewr combination there are either one or many envobj codes. These envobj codes come under one of five different theme level targets (Native Fish, Native vegetation, Waterbirds, Other species or Ecosystem functions) - obj2target.csv: envobj's are unique to their planning unit in the LTWP (noting there are often a lot of similarities between envobj's in the same states). The plain english wording of the env objectives is also contained in this csv. The LTWP, planning unit and envobj rows are repeated for each specific goal related to that LTWP, planning unit and envobj. - obj2yrtarget.csv: The environmental objectives are related to 5, 10 and 20 year targets
Owner
- Name: Murray-Darling Basin Authority
- Login: MDBAuth
- Kind: organization
- Email: dataservices@mdba.gov.au
- Website: http://www.mdba.gov.au
- Repositories: 3
- Profile: https://github.com/MDBAuth
The Murray-Darling Basin Authority aims to achieve a healthy working Basin for the benefit of the Australian community.
Citation (CITATION.cff)
cff-version: 2.3.7 message: "If you use this software, please cite it as below." authors: - Murray-Darling Basin Authority title: "EWR_tool" version: 2.3.7 doi: 10.5281/zenodo.7435847 date-released: 2025-02-07
GitHub Events
Total
- Release event: 12
- Delete event: 14
- Issue comment event: 4
- Push event: 244
- Pull request review event: 19
- Pull request event: 108
- Create event: 52
Last Year
- Release event: 12
- Delete event: 14
- Issue comment event: 4
- Push event: 244
- Pull request review event: 19
- Pull request event: 108
- Create event: 52
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 2
- Total pull requests: 133
- Average time to close issues: N/A
- Average time to close pull requests: 16 days
- Total issue authors: 2
- Total pull request authors: 13
- Average comments per issue: 0.0
- Average comments per pull request: 0.11
- Merged pull requests: 102
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 30
- Average time to close issues: N/A
- Average time to close pull requests: 23 days
- Issue authors: 0
- Pull request authors: 5
- Average comments per issue: 0
- Average comments per pull request: 0.13
- Merged pull requests: 16
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- galenholt (1)
- RMMay (1)
- ElishaMDBA (1)
- MartinMDBA (1)
Pull Request Authors
- MartinMDBA (62)
- ElishaMDBA (46)
- LaraMDBA (27)
- pedrojunqueira (20)
- SirousMDBA (18)
- BenBMDBA (10)
- RoryMDBA (7)
- MarkusB-DPE (5)
- galenholt (3)
- RatherBland (2)
- aaronddino (2)
- CarmenAmos (2)
- AnnabelMDBA (1)
- ZofiaMDBA (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 180 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 50
- Total maintainers: 3
pypi.org: py-ewr
Environmental Water Requirement calculator
- Homepage: https://github.com/MDBAuth/EWR_tool
- Documentation: https://py-ewr.readthedocs.io/
- License: GNU General Public License (GPL)
-
Latest release: 2.3.7
published about 1 year ago
Rankings
Maintainers (3)
Dependencies
- actions/checkout master composite
- actions/setup-python v1 composite
- pypa/gh-action-pypi-publish master composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- argon2-cffi =20.1.0=py36h27cfd23_1
- async_generator =1.10=py36h28b3542_0
- attrs =20.3.0=pyhd3eb1b0_0
- backcall =0.2.0=pyhd3eb1b0_0
- blas =1.0=mkl
- bleach =3.3.0=pyhd3eb1b0_0
- brotlipy =0.7.0=py36h27cfd23_1003
- ca-certificates =2021.7.5=h06a4308_1
- certifi =2021.5.30=py36h06a4308_0
- cffi =1.14.5=py36h261ae71_0
- chardet =4.0.0=py36h06a4308_1003
- cryptography =3.4.7=py36hd23ed53_0
- decorator =5.0.6=pyhd3eb1b0_0
- defusedxml =0.7.1=pyhd3eb1b0_0
- entrypoints =0.3=py36_0
- idna =2.10=pyhd3eb1b0_0
- importlib-metadata =3.10.0=py36h06a4308_0
- importlib_metadata =3.10.0=hd3eb1b0_0
- intel-openmp =2021.2.0=h06a4308_610
- ipykernel =5.3.4=py36h5ca1d4c_0
- ipython =7.16.1=py36h5ca1d4c_0
- ipython_genutils =0.2.0=pyhd3eb1b0_1
- ipywidgets =7.6.3=pyhd3eb1b0_1
- jedi =0.17.0=py36_0
- jinja2 =2.11.3=pyhd3eb1b0_0
- jsonschema =3.2.0=py_2
- jupyter_client =6.1.12=pyhd3eb1b0_0
- jupyter_core =4.7.1=py36h06a4308_0
- jupyterlab_pygments =0.1.2=py_0
- jupyterlab_widgets =1.0.0=pyhd3eb1b0_1
- ld_impl_linux-64 =2.33.1=h53a641e_7
- libffi =3.3=he6710b0_2
- libgcc-ng =9.1.0=hdf63c60_0
- libsodium =1.0.18=h7b6447c_0
- libstdcxx-ng =9.1.0=hdf63c60_0
- markupsafe =1.1.1=py36h7b6447c_0
- mdba-gauge-getter =0.1=pypi_0
- mistune =0.8.4=py36h7b6447c_0
- mkl =2020.2=256
- mkl-service =2.3.0=py36he8ac12f_0
- mkl_fft =1.3.0=py36h54f3939_0
- mkl_random =1.1.1=py36h0573a6f_0
- nbclient =0.5.3=pyhd3eb1b0_0
- nbconvert =6.0.7=py36_0
- nbformat =5.1.3=pyhd3eb1b0_0
- ncurses =6.2=he6710b0_1
- nest-asyncio =1.5.1=pyhd3eb1b0_0
- notebook =6.3.0=py36h06a4308_0
- numpy =1.19.2=py36h54aff64_0
- numpy-base =1.19.2=py36hfa32c7d_0
- openssl =1.1.1l=h7f8727e_0
- packaging =20.9=pyhd3eb1b0_0
- pandas =1.1.3=py36he6710b0_0
- pandoc =2.12=h06a4308_0
- pandocfilters =1.4.3=py36h06a4308_1
- parso =0.8.2=pyhd3eb1b0_0
- pexpect =4.8.0=pyhd3eb1b0_3
- pickleshare =0.7.5=pyhd3eb1b0_1003
- pip =21.0.1=py36h06a4308_0
- prometheus_client =0.10.1=pyhd3eb1b0_0
- prompt-toolkit =3.0.17=pyh06a4308_0
- ptyprocess =0.7.0=pyhd3eb1b0_2
- pycparser =2.20=py_2
- pygments =2.8.1=pyhd3eb1b0_0
- pyopenssl =20.0.1=pyhd3eb1b0_1
- pyparsing =2.4.7=pyhd3eb1b0_0
- pyrsistent =0.17.3=py36h7b6447c_0
- pysocks =1.7.1=py36h06a4308_0
- python =3.6.13=hdb3f193_0
- python-dateutil =2.8.1=pyhd3eb1b0_0
- pytz =2021.1=pyhd3eb1b0_0
- pyzmq =20.0.0=py36h2531618_1
- readline =8.1=h27cfd23_0
- requests =2.25.1=pyhd3eb1b0_0
- send2trash =1.5.0=pyhd3eb1b0_1
- setuptools =52.0.0=py36h06a4308_0
- six =1.15.0=py36h06a4308_0
- sqlite =3.35.4=hdfb4753_0
- terminado =0.9.4=py36h06a4308_0
- testpath =0.4.4=pyhd3eb1b0_0
- tk =8.6.10=hbc83047_0
- tornado =6.1=py36h27cfd23_0
- tqdm =4.59.0=pyhd3eb1b0_1
- traitlets =4.3.3=py36_0
- typing_extensions =3.7.4.3=pyha847dfd_0
- urllib3 =1.26.4=pyhd3eb1b0_0
- wcwidth =0.2.5=py_0
- webencodings =0.5.1=py36_1
- wheel =0.36.2=pyhd3eb1b0_0
- widgetsnbextension =3.5.1=py36_0
- xlsxwriter =3.0.1=pyhd3eb1b0_0
- xz =5.2.5=h7b6447c_0
- zeromq =4.3.4=h2531618_0
- zipp =3.4.1=pyhd3eb1b0_0
- zlib =1.2.11=h7b6447c_3
- pytest * development
- pytest-cov * development
- tox * development
- Jinja2 ==3.1.2
- MarkupSafe ==2.1.1
- Pygments ==2.12.0
- Send2Trash ==1.8.0
- XlsxWriter ==3.0.3
- argon2-cffi ==21.3.0
- argon2-cffi-bindings ==21.2.0
- asttokens ==2.0.5
- attrs ==21.4.0
- backcall ==0.2.0
- beautifulsoup4 ==4.11.1
- bleach ==5.0.0
- certifi ==2021.10.8
- cffi ==1.15.0
- chardet ==4.0.0
- charset-normalizer ==2.0.12
- coverage ==6.3.3
- debugpy ==1.6.0
- decorator ==5.1.1
- defusedxml ==0.7.1
- entrypoints ==0.4
- executing ==0.8.3
- fastjsonschema ==2.15.3
- idna ==2.10
- importlib-resources ==5.7.1
- iniconfig ==1.1.1
- ipykernel ==6.13.0
- ipython ==8.3.0
- ipython-genutils ==0.2.0
- ipywidgets ==7.7.0
- jedi ==0.18.1
- jsonschema ==4.5.1
- jupyter-client ==7.3.1
- jupyter-core ==4.10.0
- jupyterlab-pygments ==0.2.2
- jupyterlab-widgets ==1.1.0
- matplotlib-inline ==0.1.3
- mdba-gauge-getter ==0.2
- mistune ==0.8.4
- nbclient ==0.6.3
- nbconvert ==6.5.0
- nbformat ==5.4.0
- nest-asyncio ==1.5.5
- notebook ==6.4.11
- numpy ==1.22.3
- openpyxl ==3.0.9
- packaging ==21.3
- pandas ==1.4.2
- pandocfilters ==1.5.0
- parso ==0.8.3
- pexpect ==4.8.0
- pickleshare ==0.7.5
- pluggy ==1.0.0
- prometheus-client ==0.14.1
- prompt-toolkit ==3.0.29
- psutil ==5.9.0
- ptyprocess ==0.7.0
- pure-eval ==0.2.2
- py ==1.11.0
- pycparser ==2.21
- pyparsing ==3.0.9
- pyrsistent ==0.18.1
- pytest ==7.1.2
- pytest-cov ==3.0.0
- python-dateutil ==2.8.2
- pytz ==2022.1
- pyzmq ==22.3.0
- requests ==2.25.1
- six ==1.16.0
- soupsieve ==2.3.2.post1
- stack-data ==0.2.0
- terminado ==0.13.3
- tinycss2 ==1.1.1
- tomli ==2.0.1
- tornado ==6.1
- tqdm ==4.64.0
- traitlets ==5.2.0
- urllib3 ==1.26.9
- wcwidth ==0.2.5
- webencodings ==0.5.1
- widgetsnbextension ==3.6.0
- zipp ==3.8.0
- ipython *
- ipywidgets *
- mdba-gauge-getter *
- numpy *
- pandas *
- requests *
- tqdm *
- traitlets *
- cachetools ==5.2.0
- ipython ==8.8.0
- ipywidgets ==7.7.0
- mdba-gauge-getter ==0.4.4
- pandas ==1.4.2
- requests ==2.25.1
- tqdm ==4.64.0