NOAA-ORR-ERD / gridded

A single API for accessing / working with gridded model results on multiple grid types
https://noaa-orr-erd.github.io/gridded/index.html
The Unlicense
64 stars 14 forks source link

Time object questions #82

Open ChrisBarker-NOAA opened 8 months ago

ChrisBarker-NOAA commented 8 months ago

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:

2) Would it make sense to use a numpy datetime array, rather than an array of datetime objects?

3) 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.

4) 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.?

5) 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.