Skip to main content

Implementation of data assimilation for eWaterCycle

Project description

eWaterCycle-DA

Documentation Status PyPI github license badge fair-software badge

Code to run Data Assimilation with hydrological models on the eWaterCycle platform.

Installation

Install this package alongside your eWaterCycle installation

pip install ewatercycle-DA

Then DA becomes available to be used in eWaterCycle

from ewatercycle_DA import DA

docs

Documentation can be found here

Changelog

Changelog can be found in 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

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

With assimilating

...
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"))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ewatercycle_da-0.0.5.tar.gz (20.1 MB view details)

Uploaded Source

Built Distribution

ewatercycle_da-0.0.5-py2.py3-none-any.whl (24.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ewatercycle_da-0.0.5.tar.gz.

File metadata

  • Download URL: ewatercycle_da-0.0.5.tar.gz
  • Upload date:
  • Size: 20.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for ewatercycle_da-0.0.5.tar.gz
Algorithm Hash digest
SHA256 c7e58f4b08b48821b669915b76425ef0059b59cc0e1854cb6690cf27dcfc78a5
MD5 8b7826eef375c3e41b517a175b33ebc5
BLAKE2b-256 07e23c1071b670a8920997ff3d8094e701be1969befffc19a9377873c1937cd7

See more details on using hashes here.

File details

Details for the file ewatercycle_da-0.0.5-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for ewatercycle_da-0.0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 937f4b026342b8b3314cae6a6b9d90cd3dbc053eddaa65846ab39ccc57b97e63
MD5 335a2ce02902c8dd2fcfb17e7d1b9384
BLAKE2b-256 6aeb32bd950b6c404ba7a32d73fc3fe79c553511eaa69d942fbb5d42518507b1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page