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

Add two new time filters to jinja #25

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

DavidHuber-NOAA
Copy link
Collaborator

@DavidHuber-NOAA DavidHuber-NOAA commented Apr 22, 2024

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 NOAA-EMC/global-workflow#2491

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • pynorms
  • pytests

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes need updates to the documentation. I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • New and existing tests pass with my changes

Copy link

codecov bot commented Apr 22, 2024

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 ⚠️
Additional details and impacted files
@@             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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@aerorahul aerorahul left a comment

Choose a reason for hiding this comment

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

looks good.
Would you mind putting in the PR description what the template would look like for posterity?

@DavidHuber-NOAA
Copy link
Collaborator Author

Sure thing. Done.

@aerorahul aerorahul merged commit 2c48c56 into NOAA-EMC:develop Apr 22, 2024
7 of 9 checks passed
@DavidHuber-NOAA DavidHuber-NOAA deleted the feature/time_filters branch May 3, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants