Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-37823

Add toAstropy to DateTime

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: daf_base
    • Labels:
      None
    • Story Points:
      1
    • Sprint:
      AP S23-3 (February)
    • Team:
      Alert Production
    • Urgent?:
      No

      Description

      Merlin Fisher-Levine asked on slack about the how to correctly get an astropy time from our DateTime object. We should just add `toAstropy()` in datetimeContinued.py to handle that correctly for users.

      I believe all that is necessary is:

      astropy.time.Time(date.get(system=DateTime.MJD, scale=DateTime.TAI), scale="tai", format="mjd") 
      

        Attachments

          Issue Links

            Activity

            Hide
            Parejkoj John Parejko added a comment -

            Tim Jenness: do you mind doing this small review? It's pretty trivial code, but it's easy for a user to forget the right specification to astropy.Time. Ideas for other tests are welcome.

            One question I have is that the existing toPython method does the import datetime internally, but I've put the import astropy outside the continue class itself. I don't see a reason to do the import inside the functions here: do you?

            PR: https://github.com/lsst/daf_base/pull/79

            Show
            Parejkoj John Parejko added a comment - Tim Jenness : do you mind doing this small review? It's pretty trivial code, but it's easy for a user to forget the right specification to astropy.Time. Ideas for other tests are welcome. One question I have is that the existing toPython method does the import datetime internally, but I've put the import astropy outside the continue class itself. I don't see a reason to do the import inside the functions here: do you? PR: https://github.com/lsst/daf_base/pull/79
            Show
            Parejkoj John Parejko added a comment - Jenkins: https://ci.lsst.codes/blue/organizations/jenkins/stack-os-matrix/detail/stack-os-matrix/38072/pipeline
            Hide
            tjenness Tim Jenness added a comment -

            Thanks for this. As I say on the PR I'm inclined to defer the import of astropy until it's needed because it's a big package to import and nothing around daf_base will be importing it so making it optional seems right to me.

            Show
            tjenness Tim Jenness added a comment - Thanks for this. As I say on the PR I'm inclined to defer the import of astropy until it's needed because it's a big package to import and nothing around daf_base will be importing it so making it optional seems right to me.

              People

              Assignee:
              Parejkoj John Parejko
              Reporter:
              Parejkoj John Parejko
              Reviewers:
              Tim Jenness
              Watchers:
              Eric Bellm, John Parejko, Kian-Tat Lim, Merlin Fisher-Levine, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.