Skip to content
Draft
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
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ wheel-exclude = ["**/.mypy_cache**","**/.mypy_cache/**"]

[project]
name = "modelskill"
version = "1.3.0"
version = "1.3.2"
dependencies = [
"numpy > 1.24.4",
"pandas >= 1.4",
"pandas >= 1.4, < 3",
"mikeio >= 1.2",
"matplotlib",
"xarray",
"netCDF4",
"scipy",
"jinja2", # used for skill.style
"pyyaml", # used for from_config() and settings
]

authors = [
Expand Down
2 changes: 1 addition & 1 deletion src/modelskill/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def peak_ratio(
time = obs.index

# Calculate number of years
dt_int = time[1:].values - time[0:-1].values
dt_int = (time[1:].values - time[0:-1].values).view("int64")
dt_int_mode = float(stats.mode(dt_int, keepdims=False)[0]) / 1e9 # in seconds
N_years = dt_int_mode / 24 / 3600 / 365.25 * len(time)
peak_index, AAP_ = _partial_duration_series(
Expand Down
6 changes: 3 additions & 3 deletions src/modelskill/model/dfsu.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def _extract_point(

# TODO not sure why we rename here
assert self.name is not None
ds_model.rename({ds_model.items[0].name: self.name}, inplace=True)
ds_model = ds_model.rename({ds_model.items[0].name: self.name})

return PointModelResult(
data=ds_model,
Expand Down Expand Up @@ -268,7 +268,7 @@ def _extract_track(

if isinstance(self.data, mikeio.DataArray):
ds_model = self.data.extract_track(track=track, method=method)
ds_model.rename({self.data.name: self.name}, inplace=True)
ds_model = ds_model.rename({self.data.name: self.name})
aux_items = None
else:
if isinstance(self.data, mikeio.dfsu.Dfsu2DH):
Expand All @@ -279,7 +279,7 @@ def _extract_track(
ds_model = self.data[self.sel_items.all].extract_track(
track=track, method=method
)
ds_model.rename({self.sel_items.values: self.name}, inplace=True)
ds_model = ds_model.rename({self.sel_items.values: self.name})
aux_items = self.sel_items.aux

item_names = [i.name for i in ds_model.items]
Expand Down
3 changes: 0 additions & 3 deletions tests/model/test_dfsu.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ def test_dfsu_repr(hd_oresund_2d):
def test_dfsu_properties(hd_oresund_2d):
mr = ms.model_result(hd_oresund_2d, name="Oresund2d", item="Surface elevation")

# TODO Not sure this assert is useful
assert mr.data.geometry.is_2d

# Note != name of item
assert mr.quantity.name == "Surface Elevation"
assert mr.quantity.unit == "m"
Expand Down
8 changes: 3 additions & 5 deletions tests/test_combine_comparers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ def test_merge(o123, mrmike, mrmike2):
assert cc12b.score() == cc12.score()
assert cc12b.n_points == cc12.n_points

# deprecated
with pytest.warns(FutureWarning, match="deprecated"):
cc12c = cc1 + cc2
assert cc12c.score() == cc12.score()
assert cc12c.n_points == cc12.n_points
cc12c = cc1 + cc2
assert cc12c.score() == cc12.score()
assert cc12c.n_points == cc12.n_points


def test_merge_models_different_time(o123, mrmike, mr2days):
Expand Down
1 change: 0 additions & 1 deletion tests/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from modelskill.comparison._comparison import ItemSelection
from modelskill.model.dfsu import DfsuModelResult


@pytest.fixture
def o1():
fn = "tests/testdata/SW/HKNA_Hm0.dfs0"
Expand Down
Loading