Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix small bug in loading non-camels data #11

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ Adding `.finalize()` method - clears up the directory. Especially useful for DA.
- make sure you also include the alpha value which is a model output from the run, defaults to 1.26 but varies per catchment. Eq1 of camels paper.
### v1.3.2. - 1.3.3
- now correctly slices the ds to given start and end time whoops
### v1.3.4 - 1.3.8
### v1.3.4 - 1.3.9
- formalises forcing: either `.txt` or (two) `.nc` forcing supplied & run corresponding code
Binary file removed dist/ewatercycle_hbv-1.3.8.tar.gz
Binary file not shown.
Binary file not shown.
Binary file added dist/ewatercycle_hbv-1.3.9.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name = "ewatercycle-HBV"
description = "Implementation of HBV for eWaterCycle"
readme = "README.md"
license = "Apache-2.0"
version = "1.3.8"
version = "1.3.9"
authors = [
{ name = "David Haasnoot", email = "davidhaasnoot@gmail.com" },
]
Expand Down
2 changes: 1 addition & 1 deletion src/ewatercycle_HBV/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.8"
__version__ = "1.3.9"
28 changes: 9 additions & 19 deletions src/ewatercycle_HBV/forcing.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,15 @@ class HBVForcing(DefaultForcing):
"""

# either a forcing file is supplied
forcing_file: Optional[str] = "forcing.txt"
forcing_file: Optional[str] = ".txt"
# or pr and pev are supplied seperately - can also be the same dataset
pr: Optional[str] = "forcing.nc"
pev: Optional[str] = "forcing.nc"
pr: Optional[str] = ".nc"
pev: Optional[str] = ".nc"
alpha: Optional[float] = 1.26 # varies per catchment, mostly 1.26?
test_data_bool: bool = False # allows to use self.from_test_txt()


# intended use
# if test data:


#self.from_camels_txt()

# @classmethod
# def _build_recipe(
# cls,
Expand All @@ -96,22 +91,17 @@ class HBVForcing(DefaultForcing):
# )
def forcing_txt_defined(self):
"""""test whether user defined forcing file"""
try:
self.forcing_file
except NameError:
return False
else:
if len(self.forcing_file) > 4:
return True
else:
return False

def forcing_nc_defined(self):
"""""test whether user defined forcing file"""
try:
self.pr
self.pev
except NameError:
return False
else:
if (len(self.pr) > 3) and (len(self.pev) > 3):
return True
else:
return False

# TODO Implement this to take .txt and add them?
def from_test_txt(self) -> xr.Dataset:
Expand Down