astropy / astropy/astroquery

BUG: jplspec: max_lines warning is stored in metadata and therefore hidden from users

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

Description

For queries that has more lines than the max_lines, the logic is broken. The warning about hitting the limit is parsed out from the response table, and is stored in the metadata of the result table, and is not hit currently, which is not surprising as the server returns only maxlines number of lines, plus the warning that we parse out.

```
if len(result) > self.maxlines:
warnings.warn("This form is currently limited to {0} lines."
"Please limit your search.".format(self.maxlines))
```

Also, while I see that the we just try to reraise the warning coming from the service, I find the actual warning message confusing. What does `Please limit your search` try to actually mean?

```
>>> from astroquery.jplspec import JPLSpec
>>> import astropy.units as u
>>> result = JPLSpec.query_lines(min_frequency=100 * u.GHz,
... max_frequency=1000 * u.GHz,
... min_strength=-500,
... molecule="H2O",
... max_lines=10,
... parse_name_locally=True)

>>> result.meta
OrderedDict([('comments',
['',
'',
'',
'form is currently limilted to 10 lines. Please limit your search.'])])
```

Contributor guide

Open the contributing guide

Research direction

Start at astroquery.jplspec.JPLSpec.query_lines and trace how the max_lines response warning is parsed and placed in result.meta. Reproduce the query shown with max_lines=10, then inspect the related JPLSpec tests if present. Done means the limit warning is surfaced to users clearly rather than being hidden in metadata, with wording that explains the required action.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.