# eWaterCycle-DA
<!-- [![Python package](https://github.com/Daafip/ewatercycle-hbv/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Daafip/ewatercycle-hbv/actions/workflows/test.yml) -->
[![Documentation Status](https://readthedocs.org/projects/ewatercycle-da/badge/?version=latest)](https://ewatercycle-da.readthedocs.io/en/latest/?badge=latest)
[![PyPI](https://img.shields.io/pypi/v/ewatercycle-DA)](https://pypi.org/project/ewatercycle-DA/)
[![github license badge](https://img.shields.io/github/license/Daafip/ewatercycle-DA)](https://github.com/Daafip/ewatercycle-DA)
[![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B%20%20%E2%97%8B-yellow)](https://fair-software.eu)
Code to run Data Assimilation with hydrological models on the [eWaterCycle](https://github.com/eWaterCycle/ewatercycle) platform.
## Installation
Install this package alongside your [eWaterCycle installation](https://github.com/eWaterCycle/ewatercycle/blob/main/README.md#install)
```console
pip install ewatercycle-DA
```
Then DA becomes available to be used in eWaterCycle
```python
from ewatercycle_DA import DA
```
## docs
Documentation can be found [here](https://ewatercycle-da.readthedocs.io/en/latest/)
## Changelog
Changelog can be found in [CHANGELOG.md](https://github.com/Daafip/ewatercycle-da/blob/main/CHANGELOG.md) on GitHub.
## Quick Usage overiew
_(maybe migrate this to docs?)_
Can be used with or without assimilating, this will run 10 versions of the same model.
By varying the setup_kwargs you can vary the model run itself.
### Without assimilating
```py
HBVForcing = ...
ensemble = DA.Ensemble(N=10)
ensemble.setup()
ensemble.initialize(model_name="HBV",
forcing=HBVForcing,
setup_kwargs={'parameters':'7.6,0.5,460,3.8,0.19,1.3,0.082,0.0061',
'initial_storage':'0,100,0,5'}
)
ref_model = ensemble.ensemble_list[0].model
lst_Q = []
while ref_model.time < ref_model.end_time:
ensemble.update(assimilate=False)
lst_Q.append(ensemble.get_value("Q"))
```
_For running HBV see seperate [docs](https://github.com/Daafip/ewatercycle-hbv)_
### With assimilating
```py
...
ref_model = ...
#... same as above just add two more definitions
def H(Z):
"""returns discharge which is the last value on the state vector for HBV"""
return Z[-1]
ds_obs_dir = ...
ensemble.initialize_da_method(ensemble_method_name = "PF",
hyper_parameters = {
'like_sigma_weights' : 0.05,
'like_sigma_state_vector' : 0.01,
},
state_vector_variables = "all",
# the next three are keyword arguments but are needed:
observation_path = ds_obs_dir,
observed_variable_name = "Q",
measurement_operator = H,
)
lst_Q = []
while ref_model.time < ref_model.end_time:
ensemble.update(assimilate=True)
lst_Q.append(ensemble.get_value("Q"))
```
Raw data
{
"_id": null,
"home_page": null,
"name": "ewatercycle-DA",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "data assimilation, ewatercycle, hydrology, parallelisation",
"author": null,
"author_email": "David Haasnoot <davidhaasnoot@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/98/88/0237d508a3aef608550bc0fc13d46dd0f256eec329bf7117d5b242a43027/ewatercycle_da-0.0.7.tar.gz",
"platform": null,
"description": "# eWaterCycle-DA\n<!-- [![Python package](https://github.com/Daafip/ewatercycle-hbv/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Daafip/ewatercycle-hbv/actions/workflows/test.yml) -->\n[![Documentation Status](https://readthedocs.org/projects/ewatercycle-da/badge/?version=latest)](https://ewatercycle-da.readthedocs.io/en/latest/?badge=latest)\n[![PyPI](https://img.shields.io/pypi/v/ewatercycle-DA)](https://pypi.org/project/ewatercycle-DA/)\n[![github license badge](https://img.shields.io/github/license/Daafip/ewatercycle-DA)](https://github.com/Daafip/ewatercycle-DA)\n[![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B%20%20%E2%97%8B-yellow)](https://fair-software.eu)\n\n\n\n\nCode to run Data Assimilation with hydrological models on the [eWaterCycle](https://github.com/eWaterCycle/ewatercycle) platform. \n\n## Installation\nInstall this package alongside your [eWaterCycle installation](https://github.com/eWaterCycle/ewatercycle/blob/main/README.md#install)\n\n```console\npip install ewatercycle-DA\n```\n\nThen DA becomes available to be used in eWaterCycle\n\n```python\nfrom ewatercycle_DA import DA\n\n```\n\n\n## docs\nDocumentation can be found [here](https://ewatercycle-da.readthedocs.io/en/latest/)\n\n## Changelog\nChangelog can be found in [CHANGELOG.md](https://github.com/Daafip/ewatercycle-da/blob/main/CHANGELOG.md) on GitHub. \n\n## Quick Usage overiew\n_(maybe migrate this to docs?)_\n\nCan be used with or without assimilating, this will run 10 versions of the same model.\nBy varying the setup_kwargs you can vary the model run itself.\n\n### Without assimilating\n```py\n\nHBVForcing = ...\n\nensemble = DA.Ensemble(N=10)\nensemble.setup()\n\nensemble.initialize(model_name=\"HBV\",\n forcing=HBVForcing,\n setup_kwargs={'parameters':'7.6,0.5,460,3.8,0.19,1.3,0.082,0.0061',\n 'initial_storage':'0,100,0,5'}\n )\n\nref_model = ensemble.ensemble_list[0].model\n\nlst_Q = []\nwhile ref_model.time < ref_model.end_time:\n ensemble.update(assimilate=False)\n lst_Q.append(ensemble.get_value(\"Q\"))\n```\n_For running HBV see seperate [docs](https://github.com/Daafip/ewatercycle-hbv)_\n### With assimilating\n\n```py\n\n...\nref_model = ...\n#... same as above just add two more definitions\ndef H(Z):\n \"\"\"returns discharge which is the last value on the state vector for HBV\"\"\"\n return Z[-1] \n\nds_obs_dir = ...\nensemble.initialize_da_method(ensemble_method_name = \"PF\", \n hyper_parameters = {\n 'like_sigma_weights' : 0.05,\n 'like_sigma_state_vector' : 0.01,\n },\n state_vector_variables = \"all\", \n # the next three are keyword arguments but are needed:\n observation_path = ds_obs_dir,\n observed_variable_name = \"Q\",\n measurement_operator = H, \n \n )\nlst_Q = []\nwhile ref_model.time < ref_model.end_time:\n ensemble.update(assimilate=True)\n lst_Q.append(ensemble.get_value(\"Q\"))\n\n```",
"bugtrack_url": null,
"license": null,
"summary": "Implementation of data assimilation for eWaterCycle",
"version": "0.0.7",
"project_urls": {
"homepage": "https://github.com/Daafip/ewatercycle-da"
},
"split_keywords": [
"data assimilation",
" ewatercycle",
" hydrology",
" parallelisation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3e6f11613a1fb6775ab1654febad286d34d6d8bceeb5b98209278cff6b1c2bf2",
"md5": "e4e13795e4c88552380cb2874a147dc0",
"sha256": "f6344d431845cfa87cb3cdb169b8f961de3b67d0fff4d6f1b8ca8eae03d631f2"
},
"downloads": -1,
"filename": "ewatercycle_da-0.0.7-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "e4e13795e4c88552380cb2874a147dc0",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 24506,
"upload_time": "2024-04-30T10:15:47",
"upload_time_iso_8601": "2024-04-30T10:15:47.395720Z",
"url": "https://files.pythonhosted.org/packages/3e/6f/11613a1fb6775ab1654febad286d34d6d8bceeb5b98209278cff6b1c2bf2/ewatercycle_da-0.0.7-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "98880237d508a3aef608550bc0fc13d46dd0f256eec329bf7117d5b242a43027",
"md5": "09437876f0f2cfef449925ec8a1b09a4",
"sha256": "0fb38116097d2a07b5aba847f17af6375171d06f4fd85cd608fca0e13cc27398"
},
"downloads": -1,
"filename": "ewatercycle_da-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "09437876f0f2cfef449925ec8a1b09a4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20141719,
"upload_time": "2024-04-30T10:15:49",
"upload_time_iso_8601": "2024-04-30T10:15:49.451560Z",
"url": "https://files.pythonhosted.org/packages/98/88/0237d508a3aef608550bc0fc13d46dd0f256eec329bf7117d5b242a43027/ewatercycle_da-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-30 10:15:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Daafip",
"github_project": "ewatercycle-da",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ewatercycle-da"
}