-
-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAC csv parsing error #1401
Comments
cc @guillochon |
I came across this while investigating #1672. Here is more info: import csv
import json
from astroquery.oac import OAC as self
request_payload = OAC._args_to_payload('SN2014J', None, None, None, 'csv')
response = self._request('GET', self.URL, data=json.dumps(request_payload), timeout=self.TIMEOUT, headers=self.HEADERS)
raw_output = response.text
split_output = raw_output.splitlines()
columns = list(csv.reader([split_output[0]], delimiter=',', quotechar='"'))[0]
rows = split_output[1:]
test_row = list(csv.reader([rows[0]], delimiter=',', quotechar='"'))[0] >>> len(columns)
38
>>> len(test_row)
39
>>> raw_output
'event,download,escapevelocity,lumdist,claimedtype,redshift,instruments,hostdec,discoverer,stellarclass,spectraltype,galactocentricvelocity,spectralink,maxappmag,dec,catalog,ebv,maxdate,propermotiondec,photolink,velocity,maxabsmag,propermotionra,name,hostoffsetdist,masses,xraylink,host,ra,boundprobability,hostoffsetang,hostra,alias,sources,color,discoverdate,radiolink,references\nSN2014J,e,,2.998,"Ia,Ia-HV","0.000677,0.000739,0.000841","IRAC (I1, I2), UVOT (W2, W1, M2, U, B, V), VLA, CLEAR, U, B, g, g\', V, r, r\', R, i, i\', I, z, z\'",+69:40:47,"Fossey et al.,Steve J. Fossey",,,,"78,-8.49,351",8.98,"+69:40:25.9,+69:40:26.0",sne,0.1358,2014/01/31,,"1482,-15.1,442",300,-18.4,,SN2014J,0.8813,,,"NGC 3034,M82","09:55:42.12,09:55:42.14",,55.63,09:55:52,"SN2014J,PSN J09554214+6940260,<a id="PSNJ09554214+6940260">PSN J09554214+6940260</a>,iPTF14jj",,,2014/01/21,0,"2012PASP..124..668Y,2015arXiv151006596G,2014AJ....148....1Z,2018PASP..130f4101V,2016MNRAS.457.1000S"'
>>> columns
['event',
'download',
'escapevelocity',
'lumdist',
'claimedtype',
'redshift',
'instruments',
'hostdec',
'discoverer',
'stellarclass',
'spectraltype',
'galactocentricvelocity',
'spectralink',
'maxappmag',
'dec',
'catalog',
'ebv',
'maxdate',
'propermotiondec',
'photolink',
'velocity',
'maxabsmag',
'propermotionra',
'name',
'hostoffsetdist',
'masses',
'xraylink',
'host',
'ra',
'boundprobability',
'hostoffsetang',
'hostra',
'alias',
'sources',
'color',
'discoverdate',
'radiolink',
'references']
>>> rows
['SN2014J,e,,2.998,"Ia,Ia-HV","0.000677,0.000739,0.000841","IRAC (I1, I2), UVOT (W2, W1, M2, U, B, V), VLA, CLEAR, U, B, g, g\', V, r, r\', R, i, i\', I, z, z\'",+69:40:47,"Fossey et al.,Steve J. Fossey",,,,"78,-8.49,351",8.98,"+69:40:25.9,+69:40:26.0",sne,0.1358,2014/01/31,,"1482,-15.1,442",300,-18.4,,SN2014J,0.8813,,,"NGC 3034,M82","09:55:42.12,09:55:42.14",,55.63,09:55:52,"SN2014J,PSN J09554214+6940260,<a id="PSNJ09554214+6940260">PSN J09554214+6940260</a>,iPTF14jj",,,2014/01/21,0,"2012PASP..124..668Y,2015arXiv151006596G,2014AJ....148....1Z,2018PASP..130f4101V,2016MNRAS.457.1000S"'] The output is obviously CSV, not JSON, but because of the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The cause of this issue is the HTML tag in the
alias
filed, that doesn't parse properly when using the csv data format.Suggested workaround: remote data_format kwarg as it shouldn't matter for the end user what server output format we parse internally.
Cross-reference: astrocatalogs/OACAPI#11
==============
There are a few new(ish) test failures with OAC: https://travis-ci.org/astropy/astroquery/jobs/512564435#L4631
The text was updated successfully, but these errors were encountered: