25. EPN-TAP 2: Querying EPN-TAP

EPN-TAP services are queried like any other TAP service. Use a table browser to see what columns are available or check the standard.

for svcrow in epn_services.table():
  service = pyvo.dal.TAPService(svcrow["accessurl"])
  for table_name in svcrow["tables"].split("#"):
    print("\nQuerying {} on {}".format(
      table_name, svcrow["accessurl"]))
    for row in vohelper.run_sync_resilient(service,
        "SELECT TOP 2 * FROM {} WHERE target_name='Mars'".format(
        table_name).table():
      print(row)

[See epnquery.py]

This looks a bit more complex than before because a single service can have multiple EPN-TAP tables, so we have another iteration to go, and we need to fiddle in the table names into the queries.

Things are a bit more complex than in anything we’ve seen so far because EPN-TAP lets people stick in almost any kind of data into such tables, and what your access_url points to – spectra, profiles of elemental abundances, odd magnetospheric data, or nothing at all – is impossible to tell before at least inspecting the dataproduct_type column (and even then your average non-solar-system astronomer may be stumped )

Of course, you want to do smarter things than print a row.

Problems

(1)

Get the little epnquery program and change it to only discover spectra. then send the first two spectra your program finds to TOPCAT (or SPLAT, if you have it).

Files


Markus Demleitner, Hendrik Heinl