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

Review using datetime related metadata keys #448

Open
sandorkertesz opened this issue Sep 11, 2024 · 0 comments
Open

Review using datetime related metadata keys #448

sandorkertesz opened this issue Sep 11, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@sandorkertesz
Copy link
Collaborator

sandorkertesz commented Sep 11, 2024

Current situation

  • Field has the datetime() method. It returns a dict with the base_date and valid_date items (both are datetime.datetime objects)
  • there is the valid_datetime generated metadata key. Field.metadata("valid_datetime") returns an ISO date string.
  • the Metadata object has the base_datetime() and valid_datetime() methods. They return datetime.datetime.
f.datetime()
>>> {'base_time': datetime.datetime(2018, 8, 1, 12, 0),
 'valid_time': datetime.datetime(2018, 8, 2, 0, 0)}

f.metadata("valid_datetime")
>>> '2018-08-02T:00:00:00'

f.metadata().valid_datetime()
>>> datetime.datetime(2018, 8, 2, 0, 0)

f.metadata().base_datetime()
>>> datetime.datetime(2018, 8, 1, 12, 0)

Problems

  • inconsistent naming: "valid_time" vs. "valid_datetime"
  • inconsitent values: datetime.datetime vs. ISO date string
  • datetime() always returns two values even if we only want to use one of them. Can be a waste of resources when metadata access is expensive.

Suggestions

A:

  • use base_datetime and valid_datetime keys in datetime().
  • add a base_datetime metadata key
  • consider changing the value of the base_datetime and valid_datetime metadata keys to datetime.datetime

B:

  • add the valid_datetime() and base_datetime() methods to Field.

Obviously, some of these his would not be backward compatible.

@sandorkertesz sandorkertesz added the enhancement New feature or request label Sep 11, 2024
@sandorkertesz sandorkertesz self-assigned this Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant