Skip to content

Add points/bounds formatting method and class, handling datetimes#6978

Merged
ESadek-MO merged 8 commits intoSciTools:mainfrom
stephenworsley:date_strings_from_units
Mar 16, 2026
Merged

Add points/bounds formatting method and class, handling datetimes#6978
ESadek-MO merged 8 commits intoSciTools:mainfrom
stephenworsley:date_strings_from_units

Conversation

@stephenworsley
Copy link
Copy Markdown
Contributor

Addresses #4508.

To access a numpy array of formatted strings for a coordinates points, for example, this can be called as follows:

coord.as_string_arrays().points

Note that calling the points in this way avoids having to calculate the bounds and vice versa.


To print a formatted summary of both the points and bounds:

print(coord.as_string_arrays())

To format dates in a particular form, e.g:

fmt = "%Y-%m-%d"
print(coord.as_string_arrays(fmt))

Note that this can also format other data types like foat or int.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.12%. Comparing base (043b0bc) to head (895483d).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6978      +/-   ##
==========================================
+ Coverage   90.11%   90.12%   +0.01%     
==========================================
  Files          91       91              
  Lines       24912    24951      +39     
  Branches     4675     4683       +8     
==========================================
+ Hits        22449    22488      +39     
  Misses       1684     1684              
  Partials      779      779              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stephenworsley stephenworsley marked this pull request as ready for review March 16, 2026 10:44
Copy link
Copy Markdown
Contributor

@ESadek-MO ESadek-MO left a comment

Choose a reason for hiding this comment

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

A couple of doc changes only! One of which is a whatsnew!

scitools-ci[bot]
scitools-ci bot previously requested changes Mar 16, 2026
Copy link
Copy Markdown
Contributor

@scitools-ci scitools-ci bot left a comment

Choose a reason for hiding this comment

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

Templating

This PR includes changes that may be worth sharing via templating. For each file listed below, please either:

  • Action the suggestion via a pull request editing/adding the relevant file in the SciTools/.github templates/ directory. 1
  • Raise an issue against the SciTools/.github repo for the above action if you really don't have 10mins spare right now. Include an assignee, to avoid it being forgotten.
  • Dismiss the suggestion if the changes are not suitable for templating.

You will need to dismiss this review before this PR can be merged. Recommend the reviewer does this as their final action before merging, as this text will continually update as commits come in.

Template candidates

The following changed files are not currently templated, but their parent directories suggest they may be good candidates for a new template to be created:

Footnotes

  1. Include this text in the PR body to avoid any notifications about applying the template changes back to the source repo!
    @scitools-templating: please no update notification on: iris

Copy link
Copy Markdown
Contributor

@ESadek-MO ESadek-MO left a comment

Choose a reason for hiding this comment

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

Couple more!

Co-authored-by: Elias <110238618+ESadek-MO@users.noreply.github.com>
@ESadek-MO ESadek-MO dismissed scitools-ci[bot]’s stale review March 16, 2026 14:02

This change is unique to Iris, and more specifically this particular whatsnew

@ESadek-MO ESadek-MO enabled auto-merge (squash) March 16, 2026 14:02
@ESadek-MO ESadek-MO disabled auto-merge March 16, 2026 14:26
Copy link
Copy Markdown
Contributor

@ESadek-MO ESadek-MO left a comment

Choose a reason for hiding this comment

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

Thanks @stephenworsley !

Copy link
Copy Markdown
Contributor

@ESadek-MO ESadek-MO left a comment

Choose a reason for hiding this comment

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

I meant to approve...

@ESadek-MO ESadek-MO merged commit e195517 into SciTools:main Mar 16, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Provide a neat way to get date strings from arrays with date units.

2 participants