GithubHelp home page GithubHelp logo

Comments (3)

HaroldMills avatar HaroldMills commented on September 17, 2024

Continuing to think about this issue, I currently think the following would be best:

  • Store times in an archive as UTC.
  • Include station timezone information in an archive. I'm not sure yet exactly what form this will take, but it might include a standard time UTC offset, an indication of whether or not DST is observed, and if so, the DST start and end times for each year for which there are data in the archive. This might be accomplished with two tables, a TimeZone table and a DST table. The TimeZone table might have columns for time zone name (e.g. US Eastern), UTC offset, and DST name (e.g. US). The DST table might have columns for DST name (e.g. US), year, start time, and end time.

Tools like the NFC Wrangler that add clips to an archive will need to be able to convert local times to UTC as needed. Tools like the NFC Viewer that present clips from an archive should allow the user to choose whether displayed times are UTC, local standard time, or local daylight time.

from vesper.

HaroldMills avatar HaroldMills commented on September 17, 2024

In an NFC archive:

  1. Each clip has a UTC start time.
  2. Each clip is assigned to a night, which is the local start date of the night on which the clip was recorded.
  3. Each station has an associated time zone. As far as I am aware, the Olsen time zone database includes all of the time zones that we might need.

In our implementation of this:

  1. The start time of a clip will be represented in Python as an aware (i.e. with an appropriate UTC tzinfo) datetime object. Note that a datetime can easily be converted to a local time using the datetime.astimezone function. I believe we can use pytz time zones for all the stations of which I am aware.
  2. As in the current implementation, the night of a clip will be represented in the database as a 7-digit integer of the form YYYYMMDD, but in Python code as a date object. We might consider changing the database implementation to a date, however, unless that's a lot slower. It's also not clear to me that we really need to store nights at all. Would it suffice to define a night as a certain UTC time interval (e.g. noon to noon local time) and use that interval for queries? We currently use nights to help accelerate queries that return clip counts, but I suspect that we may just want to store the clip counts directly (adding some redundancy to archives, but facilitating certain kinds of analyses), which might reduce the need for storing nights.
  3. The time zone of a station will be represented in the database by its Olson name (e.g. "US/Eastern"), and in Python code as an appropriate timezone instance obtained from pytz. If it turns out that at some point we need time zones that are not in the Olson database, we can use non-Olson names for them and provide some fallback mechanism for obtaining whatever information is needed from the names.

from vesper.

HaroldMills avatar HaroldMills commented on September 17, 2024

The archive now requires that clip times be specified (to the add_clip method) with the pytz.utc time zone, and also yields them (via the get_clips method) in that form. Each station has a time zone, stored persistently as an Olson time zone name. The viewer displays clip times in the local time zone.

from vesper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.