B612-Asteroid-Institute / precovery

Fast precovery of small body observations at scale
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

Add dataset metadata to index.db, add cutout service urls to FrameCandidate and PrecoveryCandidate #26

Closed moeyensj closed 2 years ago

moeyensj commented 2 years ago

Tracking metadata such as dataset name and other information like where documentation exists, what cutout service to use, etc.. will be useful as we add more datasets and for cutout link generation.

Once the table is implemented then generating cutout urls for each frame using the metadata should be pretty easy. For example:

cutout_service = "https://datalab.noirlab.edu/svc/cutout" # metadata table
dataset = "nsc_dr2" # metdata table
exposure_id = "c4d_130903_045146_ooi_g_ls9"
ra = 325.7731518779698
dec = 0.3930505122291065
length = 30 # arcsec (hard code for now)
width = 30 # arcsec (hard code for now)
preview = True

cutout_url = f"{cutout_service}?col={dataset}&siaRef={exposure_id}.fits.fz&extn=7&POS={ra:.10f},{dec:.10f}&SIZE={length/3600},{width/3600}&preview={preview}"
print(cutout_url)

Which prints:

https://datalab.noirlab.edu/svc/cutout?col=nsc_dr2&siaRef=c4d_130903_045146_ooi_g_ls9.fits.fz&extn=7&POS=325.7731518780,0.3930505122&SIZE=0.008333333333333333,0.008333333333333333&preview=True
moeyensj commented 2 years ago

Unfortunately, the extn parameter in cutout_url is not something that is dataset agnostic and so at this time we do not have enough fields in the indexed observations to create cutout URLs. We will need to fall back on querying Simple Image Access (SIA), as we currently do in the cutouts package.

PR #27 does, however, add some support for general metadata which partially completes and closes this issue.