Skip to content

Commit

Permalink
Add det cont metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiggi committed Oct 16, 2023
1 parent c399047 commit 68ff6bd
Show file tree
Hide file tree
Showing 12 changed files with 657 additions and 279 deletions.
5 changes: 2 additions & 3 deletions tutorials/Z_TODO.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
##############
#### TODO ####
##############
# Return same skills between loop and vectorized
# Create nanquantile dask function using mapblock !

# Working loop and vectorized solutions
# - Deterministic Continuous and Binary
# Implement binary data_type

# Expand thresholds (category ...) --> Add new dimension

Expand Down
23 changes: 23 additions & 0 deletions tutorials/dev_continuous_loop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 16 21:28:13 2023
@author: ghiggi
"""
### Patterns to search and adapt from vectorized to loop
# ,axis=axis
# axis=axis
# nan
# , )
# np.expand_dims

import numpy as np
from xverif.metrics.deterministic.continuous_loop import _get_metrics

pred = np.arange(0,10)
obs = np.arange(0, 10)

metrics = _get_metrics(pred, obs, drop_options=None)
len(metrics)

11 changes: 9 additions & 2 deletions tutorials/dev_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{"inf": True, "conditioned_on": "any"},
# {"equal_values": False},
{"values": 0, "conditioned_on": "both"},
{"below_threshold": 1.5, "conditioned_on": "both"},
# {"below_threshold": 1.5, "conditioned_on": "both"},
# {"above_threshold": 3, "conditioned_on": "obs"},
]

Expand All @@ -63,7 +63,7 @@
)


ds_skills = xverif.deterministic(
ds_skills1 = xverif.deterministic(
pred=pred,
obs=obs,
data_type="continuous",
Expand All @@ -72,6 +72,13 @@
skip_options=skip_options,
)


for var in ds_skills.data_vars:
xr.testing.assert_allclose(ds_skills[var], ds_skills1[var])
# xr.testing.assert_equal(ds_skills[var], ds_skills1[var])
# ds_skills[var] - ds_skills1[var]


# Convert Dataset skills to Dataset Variable
ds_skills.to_array(dim="skill").to_dataset(dim="variable")

Expand Down
8 changes: 7 additions & 1 deletion tutorials/notes_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
####--------------------------------------------------------------------------.
#### Data, Metric, Support Type
# data_type: binary, multiclass, ordered, probability, continuous
# metric_type: deterministic, probabilistic (spatial, temporal)
# metric_type: deterministic, probabilistic
# support_type: point, spatial, temporal

####--------------------------------------------------------------------------.
Expand Down Expand Up @@ -109,6 +109,12 @@
# - applied to entire input spatial image
# - applied on sliding window

# Temporal metrics
# - Require time index
# - Time scale of interest ?
# - Daily/Weekly/Monthly/Seasonal/Annual ...


# TODO Distribution metrics
# --> in which <XXXX_type>?

Expand Down
File renamed without changes.
Loading

0 comments on commit 68ff6bd

Please sign in to comment.