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 yyyy() and nemo_yyyymm() date formatters. #40

Merged
merged 14 commits into from
Sep 2, 2022

Conversation

douglatornell
Copy link
Member

@douglatornell douglatornell commented Aug 8, 2022

This supports Greig's use of Reshapr for his coarsened SalishSeaCast hindcast work.

Also includes a refactoring of:

  • dataset paths list calculation
  • date formatter functions into reshapr.utils.date_formatters module

Handling nc_file_pattern from config as a str instead of a Path allows
replacement of formatted date placeholders in both path and filename sections
in a single .format() call. That make the code suitable to change from a
loop to a list comprehension.
Caught by PyCharm code analyzer. Probably due to change in type annotations
in xarray=2022.06.0.
@douglatornell douglatornell self-assigned this Aug 8, 2022
@douglatornell douglatornell added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 8, 2022
@douglatornell douglatornell added this to the v22.1 milestone Aug 8, 2022
@douglatornell
Copy link
Member Author

douglatornell commented Aug 12, 2022

Unfortunately, this in only part of what is required to handle the coarsened SalishSeaCast files. They are the product of ncrcat applied to a model-month's of day-average files with the file pattern values like
{yyyy}/SalishSea1500-RUN203_1h_grid_V_y{nemo_yyyymm}.nc
That requirement is somewhat related to what is needed to resolve issue #32 and issue #41.

This automatically installs the package as part of environment creation.

Thanks to Michael for the tip that this is possible.
Use local timezone to resolve arrow pkg parsing exception, and add timezone
offset to formatted date/time to make it location agnostic.

re: issue #42
@codecov
Copy link

codecov bot commented Aug 31, 2022

Codecov Report

Merging #40 (2e47137) into main (e22ca01) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #40      +/-   ##
==========================================
+ Coverage   96.53%   96.55%   +0.02%     
==========================================
  Files          13       15       +2     
  Lines        1528     1539      +11     
  Branches      137      138       +1     
==========================================
+ Hits         1475     1486      +11     
  Misses         50       50              
  Partials        3        3              
Flag Coverage Δ
unittests 96.55% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
reshapr/core/info.py 97.16% <ø> (ø)
reshapr/core/extract.py 85.01% <100.00%> (-0.49%) ⬇️
reshapr/utils/date_formatters.py 100.00% <100.00%> (ø)
tests/core/test_extract.py 100.00% <100.00%> (ø)
tests/utils/test_date_formatters.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@douglatornell douglatornell marked this pull request as ready for review September 2, 2022 21:26
@douglatornell douglatornell merged commit c938cf8 into main Sep 2, 2022
@douglatornell douglatornell deleted the add-date-formatters branch September 2, 2022 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant