NOAA-EMC / wxflow

Tools for Weather Workflows
https://wxflow.readthedocs.io/en/latest
GNU Lesser General Public License v3.0
0 stars 7 forks source link

Add two new time filters to jinja #25

Closed DavidHuber-NOAA closed 4 months ago

DavidHuber-NOAA commented 4 months ago

Description This adds the timetools functions to_timedelta and add_to_datetime to the jinja filter list.

Here's an example of how to use the new filters:

{% for restart_offset in ["+3", "+6", "+9"] %}
{% set restart_delta = restart_offset | to_timedelta %}
{% set restart_datetime = current_cycle | add_to_datetime(restart_delta) %}
{% endfor %}

Needed for https://github.com/NOAA-EMC/global-workflow/pull/2491

Type of change

How Has This Been Tested?

Checklist

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 47.84%. Comparing base (c237f19) to head (cdc9751).

Files Patch % Lines
src/wxflow/jinja.py 33.33% 0 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #25 +/- ## =========================================== - Coverage 47.90% 47.84% -0.06% =========================================== Files 18 18 Lines 1647 1649 +2 Branches 333 335 +2 =========================================== Hits 789 789 Misses 801 801 - Partials 57 59 +2 ```

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

DavidHuber-NOAA commented 4 months ago

Sure thing. Done.