Skip to content
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
6 changes: 4 additions & 2 deletions docs/api/skill.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

## Aggregated Skill

::: modelskill.skill.AggregatedSkill
::: modelskill.skill.SkillTable

::: modelskill.skill.AggregatedSkillPlotter
::: modelskill.skill.SkillArray

::: modelskill.skill.SkillArrayPlotter

## Gridded Skill

Expand Down
16 changes: 8 additions & 8 deletions modelskill/comparison/_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ..plotting import taylor_diagram, TaylorPoint

from ._collection_plotter import ComparerCollectionPlotter
from ..skill import AggregatedSkill
from ..skill import SkillTable
from ..skill_grid import SkillGrid
from ..settings import options, reset_option

Expand Down Expand Up @@ -415,7 +415,7 @@ def skill(
by: Optional[Union[str, List[str]]] = None,
metrics: Optional[List[str]] = None,
**kwargs,
) -> Optional[AggregatedSkill]:
) -> Optional[SkillTable]:
"""Aggregated skill assessment of model(s)

Parameters
Expand Down Expand Up @@ -491,7 +491,7 @@ def skill(

res = _groupby_df(df.drop(columns=["x", "y"]), by, metrics)
res = cmp._add_as_col_if_not_in_index(df, skilldf=res)
return AggregatedSkill(res)
return SkillTable(res)

def _add_as_col_if_not_in_index(
self, df, skilldf, fields=["model", "observation", "variable"]
Expand Down Expand Up @@ -695,7 +695,7 @@ def mean_skill(
weights: Optional[Union[str, List[float], Dict[str, float]]] = None,
metrics: Optional[list] = None,
**kwargs,
) -> Optional[AggregatedSkill]: # TODO raise error if no data?
) -> Optional[SkillTable]: # TODO raise error if no data?
"""Weighted mean of skills

First, the skill is calculated per observation,
Expand All @@ -718,7 +718,7 @@ def mean_skill(

Returns
-------
AggregatedSkill
SkillTable
mean skill assessment as a skill object

See also
Expand Down Expand Up @@ -789,14 +789,14 @@ def weighted_mean(x):

# output
res = cmp._add_as_col_if_not_in_index(df, res, fields=["model", "variable"])
return AggregatedSkill(res.astype({"n": int}))
return SkillTable(res.astype({"n": int}))

def mean_skill_points(
self,
*,
metrics: Optional[list] = None,
**kwargs,
) -> Optional[AggregatedSkill]: # TODO raise error if no data?
) -> Optional[SkillTable]: # TODO raise error if no data?
"""Mean skill of all observational points

All data points are pooled (disregarding which observation they belong to),
Expand All @@ -816,7 +816,7 @@ def mean_skill_points(

Returns
-------
AggregatedSkill
SkillTable
mean skill assessment as a skill object

See also
Expand Down
8 changes: 4 additions & 4 deletions modelskill/comparison/_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
TimeTypes,
IdOrNameTypes,
)
from ..skill import AggregatedSkill
from ..skill import SkillTable
from ..skill_grid import SkillGrid
from ..settings import options, register_option, reset_option
from ..utils import _get_name
Expand Down Expand Up @@ -911,7 +911,7 @@ def skill(
by: Optional[Union[str, List[str]]] = None,
metrics: Optional[list] = None,
**kwargs,
) -> AggregatedSkill:
) -> SkillTable:
"""Skill assessment of model(s)

Parameters
Expand All @@ -926,7 +926,7 @@ def skill(

Returns
-------
AggregatedSkill
SkillTable
skill assessment object

See also
Expand Down Expand Up @@ -969,7 +969,7 @@ def skill(
df = cmp.to_dataframe() # TODO: avoid df if possible?
res = _groupby_df(df.drop(columns=["x", "y"]), by, metrics)
res = self._add_as_col_if_not_in_index(df, skilldf=res)
return AggregatedSkill(res)
return SkillTable(res)

def _add_as_col_if_not_in_index(self, df, skilldf):
"""Add a field to skilldf if unique in df"""
Expand Down
Loading