Skip to content
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

List tables associated to a Vizier catalogue without having to download the whole tables? #3167

Closed
Gabriel-p opened this issue Jan 4, 2025 · 7 comments

Comments

@Gabriel-p
Copy link

Gabriel-p commented Jan 4, 2025

If I'm queriyng for exampe this catalogue in Vizier https://vizier.cds.unistra.fr/viz-bin/VizieR?-source=J/A+A/659/A59I'd use something like:

viz = Vizier(row_limit=-1, columns=["all"])
cds_url = 'J/A+A/659/A59'
vdict = viz.find_catalogs(cds_url)

But this <class 'collections.OrderedDict'> object does not contain (as far as I can see) information on the tables listed within that catalogue. In this example there are two tables, one I'm interested in and another very large one that I do not need.

Apparently I can only download all the listed tables with:

cat = viz.get_catalogs(vdict)

and then select which one I want to keep?

Am I missing something or listing the tables and then selecting which table I want is not possible currently?

(Maybe related to #3144?)

@keflavich
Copy link
Contributor

You can just request the specific catalog you want instead of all catalogs associated with a publication. i.e.:

viz.get_catalogs(cds_url+'/table2')

@Gabriel-p
Copy link
Author

I don't know a priori that table2 exists, that's precisely what I'm after: a list of tables (catalogues) for that url.

I only have the url for the page with all the tables, which is what I obtain from NASA/ADS for example.

@keflavich
Copy link
Contributor

You can construct the appropriate table ID from Vizier, or using astroquery, just run get_catalogs twice, the first time with a row limit in place:

>>> Vizier(row_limit=1).get_catalogs('J/A+A/659/A59')
TableList with 2 tables:
	'0:J/A+A/659/A59/table1' with 58 column(s) and 1 row(s)
	'1:J/A+A/659/A59/table2' with 24 column(s) and 1 row(s)

@Gabriel-p
Copy link
Author

That's a clever workaround, thank you. What do you think about something like a get_tables() method that would do this? Not worth the effort?

@keflavich
Copy link
Contributor

I think of this as a primary use case for get_catalogs rather than a workaround. I'd say instead that we should include an example in the documentation on data exploration like this.

Actually, the documentation already shows how to do this, but possibly not in an easy to understand way:
https://astroquery.readthedocs.io/en/latest/vizier/vizier.html#get-a-whole-catalog
It's not exactly the same approach, though.

One general tip: find_catalogs is intended for keyword search, etc, when you don't know the vizier code for the catalog. As you've seen, it's not useful when you already know the catalog ID.

@ManonMarchand
Copy link
Member

Maybe that could be a note in this section?

@Gabriel-p
Copy link
Author

An example in the docs would be nice but if there's no consensus on this being a noteworthy issue, feel free to close.

Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants