astropy / astropy/astroquery

Vizier.get_catalogs() should throw an exception when receiving an empty RESOURCE

Open
#1,146 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
791
Forks
451
Avg merge
1d 3h
Merged PRs (30d)
4

Description

A catalog I use appears to have disappeared from VizieR. However, since I discovered the problem with astroquery I originally suspected the problem was there, not with CDS. (I have contacted CDS about it.)

Below is the test code and output I (eventually) put together by reading astroquery source code. An exception saying "VizieR returned an empty resource for catalog J/ApJ/457/L99" would have saved me a few hours of useless debugging.

Also, there is a warning in the VOtable XML that may be another issue that should be fixed.

```python
V = astroquery.vizier.Vizier(row_limit=-1)
catstring = "J/ApJ/457/L99"
finds = V.find_catalogs(catstring)
print "=== find_catalogs() ===\n", finds
query_payload = V.get_catalogs_async(catalog=catstring, get_query_payload=True)
print "=== query_payload ===\n", query_payload
catalog = V.get_catalogs_async(catalog=catstring, verbose=True)
print "=== get_catalogs_async() ===\n", catalog.content
catalog = V.get_catalogs(catalog=catstring, verbose=True)
print "=== get_catalogs() ===\n", catalog
```

```
=== find_catalogs() ===
OrderedDict([(u'J/ApJ/457/L99', )])
=== query_payload ===
-source=J/ApJ/457/L99
-out=*
-out.add=*
-out.max=unlimited
-out.meta=huUD
-out.form=mini
-oc.form=d
=== get_catalogs_async() ===


VizieR Astronomical Server vizier.u-strasbg.fr
Date: 2018-05-21T19:58:12 [V1.99+ (14-Oct-2013)]
Explanations and Statistics of UCDs: See LINK below
In case of problem, please report to: cds-question@unistra.fr
In this version, NULL integer columns are written as an empty string
<TD></TD>, explicitely possible from VOTable-1.3

-oc.form=d
-source=J/ApJ/457/L99
-out=*
-out.add=*
-out.max=unlimited

=== get_catalogs() ===
Empty TableList
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the example using Vizier.get_catalogs() and get_catalogs_async() with catalog J/ApJ/457/L99, then inspect the Vizier catalog-response handling. Add a regression test for a VOTable containing an empty RESOURCE and verify that get_catalogs() raises the requested exception instead of returning an empty TableList.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.