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

[DOCS] Update docstring for date2num (module function) #483

Merged

Conversation

ukmo-ccbunney
Copy link
Contributor

@ukmo-ccbunney ukmo-ccbunney commented Sep 25, 2024

🚀 Pull Request

As per #467, but for module function date2num

The underlying cftime package will now preferentially return an integer rather than a float if if encoded datetime(s) can be expressed exactly as an integer.

Description

Docstring for cf_units.date2num updated to reflect this underlying change in behaviour.
Extra example added showing outputs of type integer where encoded allows.

#467 fixed docstring for cf_units.Unit.date2num, but this module level function was missed.

Fixes: #202

Copy link
Member

@pp-mo pp-mo left a comment

Choose a reason for hiding this comment

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

Can you please fix the Unit.date2num similarly ?

It seems increasingly that I made a mess of reviewing #467 !

cf_units/__init__.py Outdated Show resolved Hide resolved
@ukmo-ccbunney ukmo-ccbunney changed the title [DOCS] Update docstring for num2date (module function) [DOCS] Update docstring for date2num (module function) Sep 26, 2024
Copy link
Member

@pp-mo pp-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 @ukmo-ccbunney

@trexfeathers
Copy link
Collaborator

I have a fix for those pre-commit errors in #484, if you wanted to merge that one first?

@pp-mo
Copy link
Member

pp-mo commented Sep 26, 2024

( merge-in fixed the pre-commit failure. -- thanks @trexfeathers for #484 )

@pp-mo pp-mo merged commit 6d58b65 into SciTools:main Sep 26, 2024
14 checks passed
stephenworsley added a commit to stephenworsley/cf-units that referenced this pull request Sep 27, 2024
* main:
  [DOCS] Update docstring for date2num (module function) (SciTools#483)
  Modernise setup scripts (SciTools#484)
  Make antlr optional (SciTools#423)
  Ruff: smaller steps (SciTools#364)
  Updated docstring for num2date. (SciTools#467)
  updated conda lock files (SciTools#479)
  Revert to 00:03 Mondays for lockfile updates. (SciTools#480)
  New trigger time for GMT. (SciTools#478)
  Check lockfile updates @ 3pm daily (temporary for testing). (SciTools#477)
  Fixlocks (SciTools#470)

# Conflicts:
#	pyproject.toml
#	requirements/cf-units.yml
#	requirements/locks/py310-lock-linux-64.txt
#	requirements/locks/py310-lock-osx-64.txt
#	requirements/locks/py310-lock-win-64.txt
#	requirements/locks/py311-lock-linux-64.txt
#	requirements/locks/py311-lock-osx-64.txt
#	requirements/locks/py311-lock-win-64.txt
#	requirements/locks/py312-lock-linux-64.txt
#	requirements/locks/py312-lock-osx-64.txt
#	requirements/locks/py312-lock-win-64.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong dtype of return in date2num
3 participants