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

Prob compare #169

Merged
merged 13 commits into from
Dec 15, 2023
Merged

Prob compare #169

merged 13 commits into from
Dec 15, 2023

Conversation

fernando-aristizabal
Copy link
Member

@fernando-aristizabal fernando-aristizabal commented Dec 12, 2023

Probabilistic metrics

  1. added xskillscore as dependency for prob metrics
  2. updated _assert_pairing_dict_equal() to use deep diff.DeepDiff() function
    • addition of xskillscore slightly changed some values for continuous metrics.
  3. updated tests to use Prob_metrics_df schema for expected_dfs
  4. stopped coercion for Prob_metrics_df schema
  5. ran black and flake8
  6. updated crps_ensemble test to use correct size variable
  7. added probabilistic metrics via compute_probabilistic_metrics.py
  8. added probabilistic_compare() as gval accessor method
  9. added _compare_metrics_df_with_xarray() to compare df's with xarray objects
  10. added probabilistic compare accessor method
  11. updated docstrings to represent correct module name or function
  12. deprecated load_raster_as_xarray(). closes Deprecate _load_xarray() and _load_raster_as_xarray() #50
  13. added _create_circle_mask(), _create_xarray(), and _create_xarray_pairs()
  14. added Prob_metrics_df dataframe schema

- added probabilistic metrics via `compute_probabilistic_metrics.py`
- added `probabilistic_compare()` as gval accessor method
- added `_compare_metrics_df_with_xarray()` to compare df's with xarray objects
- added probabilistic compare accessor method
- added xskillscore as dependency
- updated docstrings to represent correct module name or function
- deprecated `load_raster_as_xarray()` #50
- added `_create_circle_mask()`, `_create_xarray()`, and `_create_xarray_pairs()`
- added `Prob_metrics_df` dataframe schema
- updated tests to use `Prob_metrics_df` schema for `expected_df`s
- stopped coercion for `Prob_metrics_df` schema
- ran `black` and `flake8`
- updated crps_ensemble test to use correct size variable
- updated `_assert_pairing_dict_equal()` to use `np.testing.assert_equal()`
- addition of xskillscore slightly changed some values for continuous metrics.
- fixed skipped test `test_create_xarray_pairs()`
@fernando-aristizabal fernando-aristizabal added the enhancement New feature or request label Dec 12, 2023
@fernando-aristizabal fernando-aristizabal self-assigned this Dec 12, 2023
- updated `_assert_pairing_dict_equal()` to use deepdiff
- added deepdiff as dev dependency
- updated values for continuous compare metrics
    - most likely introduced due to dependency updates
    - differences are very minor to 10+ decimal places
- ensured expected dict is PairingDict object
- updated `_assert_pairing_dict_equal()` docstring
Copy link
Collaborator

@GregoryPetrochenkov-NOAA GregoryPetrochenkov-NOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor changes, some other things I am going to open up as issues.

(0, 1, (7, 7), 3), # band 2
]

data_band_1 = np.array(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and data defined at line 47, 116, and 280 could be defined once somewhere in the script. Perhaps other variables could be not repeated as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All repeated variables in this module were moved to global status. Changes in those values at the function level remain in place.

sizes = (sizes, sizes)

# handle shapes
if shapes == "circle":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove 318-325 and delegate check for valid shape to the loop starting 330 unless this is for memory purposes or some future masks may generalize to multiple shapes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the purpose of this is to support other array creation functions eventually.

# background value, circle value, circle center, and circle radius
band_params_benchmark = [
(145, 360, (25, 25), 15),
# (160, 360, (2, 2), 3),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless there is a purpose remove commented lines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

- moved function level variables to global where applicable in `cases_load_xarray.py`
- updated comments for band level params to include (x, y) coords
- removed legacy commented lines
@GregoryPetrochenkov-NOAA GregoryPetrochenkov-NOAA merged commit 02db25c into main Dec 15, 2023
4 checks passed
@GregoryPetrochenkov-NOAA GregoryPetrochenkov-NOAA deleted the prob_compare branch December 15, 2023 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate _load_xarray() and _load_raster_as_xarray()
2 participants