ESMValGroup / ESMValCore

ESMValCore: A community tool for pre-processing data from Earth system models in CMIP and running analysis scripts.
https://www.esmvaltool.org
Apache License 2.0
42 stars 38 forks source link

Update interval check in resample_hours #2362

Closed axel-lauer closed 5 months ago

axel-lauer commented 6 months ago

Description

This PR updates the check of argument interval in the preprocessor function resample_hours (line 1236 in _time.py) from

if cube_period.total_seconds() / 3600 >= interval: to if cube_period.total_seconds() / 3600 > interval:

This change allows to process 3-hourly CMIP6 data and hourly ERA5 data with the same preprocessor settings. This is needed e.g. when calculating diurnal cycles from CMIP6 and ERA5 that need to have the same time coordinate (frequency and actual values) to be compared with the preprocessor function distance_metric.

The preprocessor resample_hours is currently not used by any recipe in the main branch, so risks of this change affecting existing diagnostics is expected to be very small.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.12%. Comparing base (bf04feb) to head (bddf137).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2362 +/- ## ======================================= Coverage 94.12% 94.12% ======================================= Files 241 241 Lines 13393 13393 ======================================= Hits 12606 12606 Misses 787 787 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.