Skip to content

MAST Observations get_urls#11

Open
cpparts wants to merge 4 commits into
snbianco:mast-beta-releasefrom
cpparts:obs-get-urls
Open

MAST Observations get_urls#11
cpparts wants to merge 4 commits into
snbianco:mast-beta-releasefrom
cpparts:obs-get-urls

Conversation

@cpparts

@cpparts cpparts commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Implementing MAST Observation method that gets the list of URLs for a table product but doesn't download them. Includes tests for get_urls.

@snbianco snbianco force-pushed the mast-beta-release branch from 6413c31 to b317f74 Compare June 9, 2026 14:00
Comment thread astroquery/mast/tests/test_mast.py Outdated

@snbianco snbianco left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial review! I think some things will have to be reworked, so I'll do a more detailed review later on.

Comment thread astroquery/mast/tests/test_mast.py Outdated
Comment thread astroquery/mast/observations.py Outdated

return manifest

def get_urls(self, products, *, mrp_only=False, cloud_only=False, include_bucket=True,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should call this function something more specific. Maybe get_download_urls or get_product_urls? @scfleming do you have any thoughts on this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to change to whatever you/@scfleming think is best!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these are URLs for products/files, I would suggest get_file_urls or get_product_urls, and out of the two I think "product" is more descriptive than "file" (which could be something other than a data product).

Comment thread astroquery/mast/observations.py
Comment thread astroquery/mast/observations.py
@cpparts cpparts requested a review from snbianco June 18, 2026 16:34
@snbianco snbianco force-pushed the mast-beta-release branch from 68e67e8 to 77cf87d Compare June 30, 2026 19:59
snbianco and others added 4 commits July 1, 2026 10:35
TAP URL constant, add comments

Updating docstrings, don't set `available_collections` in method
Comment thread astroquery/mast/observations.py
Comment thread astroquery/mast/collections.py
assert uri_list[0] == data_uri


def test_observations_get_product_urls(monkeypatch):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you break up this test a bit? Maybe so that you don't have to toggle the cloud as much.

products = self.filter_products(products, mrp_only=mrp_only, **filters)

# remove duplicate products
products = utils.remove_duplicate_products(products, 'dataURI')

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add 1115-1120 to the helper function since it's the same in download_products? Also, if a list if raw URIs is passed that can't be filtered, the filter_products call should be skipped.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

download_products always applies filtering (and doesn't accept raw URIs), but get_product_urls intentionally skips filtering when the input is a list of raw URIs. Since download_products should always have an empty URI_list, we can move all of it into the helper _build_products_list (with the conditional of if uri_list is None), and it will always apply the filtering for download_products and only when required for get_product_urls

@cpparts cpparts Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this is not actually possible. Moving the filtering logic leads to download_products failures which I imagine are related to an issue in URI resolution

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants