feat: Implement Advanced Spatial (FSS) and Categorical Verification Metrics - #7
feat: Implement Advanced Spatial (FSS) and Categorical Verification Metrics#7GiGiKoneti wants to merge 4 commits into
Conversation
52fa97c to
91b986d
Compare
91b986d to
d57e3cd
Compare
|
@mfroelund |
mfroelund
left a comment
There was a problem hiding this comment.
Looks really good, thanks for all your work. I've put a bunch of comments to consider, but overall very nice improvements!
| **stats_op_kwargs: Additional keyword arguments. | ||
|
|
||
| Returns: | ||
| Dataset or DataArray with ETS values. Range: -1/3 to 1. |
There was a problem hiding this comment.
Just to be sure, should it be 0 - 1 and not -1/3 - 1, or what does -1/3 signify ?
There was a problem hiding this comment.
The range of the Equitable Threat Score (ETS) is indeed [-1/3, 1].
- A score of
1indicates a perfect forecast. - A score of
0indicates no skill (performing no better than a random forecast). - A score of
-1/3represents the worst possible forecast under certain conditions (specifically, when predictions and observations are completely mismatched with a base rate of0.5, as discussed in Section 3a of Hogan et al., 2010).
I've kept -1/3 to 1 as the range in the docstring and added the citation to the Hogan et al. (2010) paper to clarify this.
| da_prediction: xr.DataArray, | ||
| threshold: float, | ||
| window_sizes: list[int], | ||
| spatial_dims: Optional[list[str]] = None, |
There was a problem hiding this comment.
Would it make sense to put ["x", "y"] as a default value, instead of doing that inside the function on line 643? That way, it's more clear from the function argument list, what spatial_dims are used if none are provided?
There was a problem hiding this comment.
If accepted, then the Optional part of the type hint should be omitted as described in below comment.
There was a problem hiding this comment.
Good suggestion. I've updated the function signature to specify spatial_dims: list[str] = ["x", "y"] and removed the redundant fallback check inside the function body.
5e3b132 to
48498e9
Compare
|
@mfroelund
All tests and pre-commit hooks are passing locally. Please let me know if you need anything else! |
mfroelund
left a comment
There was a problem hiding this comment.
Final small comments. Also there are two comments from the previous review, that I still would like to hear your thoughts on.
| ... spatial_dims=["x", "y"], | ||
| ... ) | ||
| """ | ||
| if spatial_dims is None: |
There was a problem hiding this comment.
I suggest to do the same here as in 48498e9#diff-15c7e6b996e82bcc0f02abdd0aa702dcc8d0afae552cec7872cbc1005081c896R617
There was a problem hiding this comment.
I have updated the fractions_skill_score() function signature to default directly to spatial_dims: list[str] = ["x", "y"] and removed the internal check, matching the design pattern of plot_fss_scale().
There was a problem hiding this comment.
I don't see a difference between Model A and Model B. Could maybe be good to add some noise to make the example look more realistic.
There was a problem hiding this comment.
I've regenerated the plot with realistic synthetic data: Model A represents a high-skill forecast with low noise, while Model B has higher noise and a spatial displacement offset to simulate the double-penalty behavior. The new plot clearly illustrates Model A's superior performance across scales.
eb74912 to
2837ad7
Compare
2837ad7 to
d12a745
Compare
|
@mfroelund |
Describe your changes
This PR implements advanced spatial and categorical verification metrics as proposed in Issue #6:
fractions_skill_score()(FSS) instatistics.pyfor spatial scale-selective verification.equitable_threat_score()(ETS) instatistics.pyfor categorical skill evaluation.brier_score()instatistics.pyfor probabilistic threshold verification.plot_fss_scale()inplot.pyfor scale-selective FSS visualization.No new dependencies are required.
Issue Link
Closes #6
Type of change
Checklist before requesting a review
pullwith--rebaseoption if possible).