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

Option to default to today's date #77

Open
jrmullaney opened this issue Jun 28, 2024 · 1 comment
Open

Option to default to today's date #77

jrmullaney opened this issue Jun 28, 2024 · 1 comment

Comments

@jrmullaney
Copy link

If one is using Times SQuaRE to check nightly processing, it would be really useful if there was some way to get the date to default to today's date.

I was thinking along the lines of the developer being able to have something along the lines of:

parameters:
  day_obs:
    type: string
    description: Observation Night (YYYY-MM-DD)
    default: "{today}"

should they want to default to today's date. I guess the format of the returned value may have to be fixed, with any necessary re-formatting happening in the notebook.

@mfisherlevine
Copy link

mfisherlevine commented Jul 1, 2024

Just noting some useful functions here:

from lsst.summit.utils.utils import getCurrentDayObs_int, getCurrentDayObs_humanStr
from lsst.summit.utils.efdUtils import offsetDayObs, calcPreviousDay

dayObs = getCurrentDayObs_int()
dayObsStr = getCurrentDayObs_humanStr()
previousDayObs = calcPreviousDay(dayObs)
aYearAgo = offsetDayObs(dayObs, -365)
print(f"Today's dayObs is {dayObs} which looks like {dayObsStr}, and previously it was {previousDayObs}, 365 days ago it was {aYearAgo}")
>>> Today's dayObs is 20240630 which looks like 2024-06-30, and previously it was 20240629, 365 days ago it was 20230701

I'm aware that a) these should probably all be in the same file, and that b) the mixing of camel and snake case is super gross, so expect some minor API changes there, but I figured I'd still drop these here as they're useful in this context, partly because working with dates is annoying and partly because of the subtleties of the definition of the dayObs.

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

2 participants