astropy / astroquery

Functions and classes to access online data resources. Maintainers: @keflavich and @bsipocz and @ceb8
http://astroquery.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
703 stars 396 forks source link

astroquery.mast.Zcut: `get_surveys` breaks at radius=0 and 180 #2221

Open jaymedina opened 2 years ago

jaymedina commented 2 years ago

astroquery.mast.Zcut's get_surveys method breaks when radius is set to default (0) or 180 degrees. For some reason it ends up producing just the root URL without any endpoints, which leads it to crash.

Example 1:

In [18]: Zcut.get_surveys('83.6333, 22.0144', radius='0d') HTTPError: 500 Server Error: Internal Server Error for url: https://mast.stsci.edu/zcut/api/v0.1/survey

Example 2:

Zcut.get_surveys('83.6333, 22.0144', radius='180d') HTTPError: 500 Server Error: Internal Server Error for url: https://mast.stsci.edu/zcut/api/v0.1/survey

Example 3 (where it doesn't break):

In [19]: Zcut.get_surveys('83.6333, 22.0144', radius='2d')
WARNING: NoResultsWarning: Coordinates are not in an available deep field survey. [astroquery.mast.cutouts]
Out[19]: []
jaymedina commented 2 years ago

I intend to tackle this next week.

jaymedina commented 2 years ago

Nvm it's also breaking in other radii inputs: Zcut.get_surveys(coords, '10d')

also broke

jaymedina commented 2 years ago

Think the issue is happening here. Basically service_url shows up empty. Am able to recreate the error. Don't see how service_url is able to get the ra/dec but will keep tinkering. https://github.com/astropy/astroquery/blob/cbec82e8ec40cd409af1044b7366ff54d74abed3/astroquery/mast/services.py#L250

jaymedina commented 2 years ago

The Zcut wrapper seems to work fine; the problem seems to be with the URL requests. So for example:

https://mast.stsci.edu/zcut/api/v0.1/survey?ra=150.0945&dec=2.38681&radius=0d

works, but:

https://mast.stsci.edu/zcut/api/v0.1/survey?ra=150.0945&dec=2.38681&radius=10d

does not. So it's likely the changes that need to be made are in our end and not in the Zcut wrapper in astroquery. I'll come back to this ticket if there's anything that needs to be done on the GitHub end. Otherwise, I'll close this ticket after sorting things out on the Gitlab end.

bsipocz commented 1 year ago

The '0d' case now also seems to work, but the '180d' one still raises the 500 Server Error.