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

Time object questions #82

Open
ChrisBarker-NOAA opened this issue Nov 29, 2023 · 0 comments
Open

Time object questions #82

ChrisBarker-NOAA opened this issue Nov 29, 2023 · 0 comments

Comments

@ChrisBarker-NOAA
Copy link
Contributor

ChrisBarker-NOAA commented Nov 29, 2023

I've recently added a bunch of tests to the Time object, and found a couple bugs in the process.

But a number of questions came up to keep in mind for refactoring.

  1. The constant_time class method -- produced a Time object with one arbitrary datetime in it, and does some magic to make sure that you get a singleton. which I guess is good 'cause then equality testing will work, but:
  • Maybe a subclass for constant time -- then you don't need to check for length-one in various places, and equality wouldn't require the singleton.
  • And/or simply create one at module init, and then use that.
  1. Would it make sense to use a numpy datetime array, rather than an array of datetime objects?

  2. tz_offset and displacement are the same thing -- any reason to have them both? If both, maybe tz_ofset would be in hours, rather than a timedelta? -- OK, added this :-) -- you can now pass either a timedelta or a number of hours.

  3. Interpolation: This is about how it fits inot the rest of the system, but shouldn't the interp_alpha return the index as well -- to make sure it's consistent? and/or return two indices and alphas.?

  4. There is logic inthe __init__ about trying to decode the netcdf time variable -- that logic should be in the netcdf loading code, not the main Time init.

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

No branches or pull requests

1 participant