I'm trying to automate downloading FITS files from SDSS. Currently, I'm getting information on the plate, mjd, and fiberID of certain objects from an SQL query on SpecObj, which I'm using in an url like https://dr18.sdss.org/sas/dr18/spectro/sdss/redux/26/spectra/PLATE/spec-PLATE-MJD-FIBERID.fits to download the .fits files. However, some of the plates I got are not present in SDSS SAS, namely ones past 3006. Does anybody know an automatable way to get SDSS spectra for all the plates?
There are plates beyond 3006 (up to #12547) but there are considerable gaps in the sequence, corresponding to the different surveys that have run as part of SDSS during its (long) history.
I think the easiest way to find out what's available, if you are planning on downloading a large fraction of the available spectra, is to use the
plates-dr17.fits FITS binary table from the Available Optical Spectral Data which list all the plates taken, along with a large amount of other data (131 columns in total).
This table can be accessed using e.g. AstroPy in Python or using table tools such as TOPCAT; a screenshot of the table (with many columns hidden, jump in PLATE number rows highlighted) shows the jump from
PLATE=3006 which looks to be the last plate taken under the legacy survey (see
PROGRAMNAME columns), and then
PLATE=3105 which is the first of the new (at the time) of the SEGUE2 survey during the SDSS-III era:
Use of this table, possibly combined with suitable cuts on the quality e.g. using the
PLATEQUALITY column, should give you a list of useful/valid plates to query for the associated spectra.