Skip to content

Commit

Permalink
Merge pull request #2261 from jaymedina/add-galex
Browse files Browse the repository at this point in the history
`astroquery.mast` : adding GALEX mission Cloud support
  • Loading branch information
ceb8 authored Feb 13, 2022
2 parents 08e57d7 + 8711b84 commit ed4bcbe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ mast

- Adding moving target functionality to ``astroquery.mast.Tesscut`` [#2121]

- GALEX data is now available to download anonymously from the public STScI S3 buckets. [#2261]

Infrastructure, Utility and Other Changes and Additions
-------------------------------------------------------
Expand Down
7 changes: 5 additions & 2 deletions astroquery/mast/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, provider="AWS", profile=None, verbose=False):
import boto3
import botocore

self.supported_missions = ["mast:hst/product", "mast:tess/product", "mast:kepler"]
self.supported_missions = ["mast:hst/product", "mast:tess/product", "mast:kepler", "mast:galex"]

self.boto3 = boto3
self.botocore = botocore
Expand Down Expand Up @@ -116,7 +116,10 @@ def get_cloud_uri(self, data_product, include_bucket=True, full_url=False):
if path is None:
raise InvalidQueryError("Malformed data uri {}".format(data_product['dataURI']))

path = path.lstrip("/")
if 'galex' in path:
path = path.lstrip("/mast/")
else:
path = path.lstrip("/")

try:
s3_client.head_object(Bucket=self.pubdata_bucket, Key=path)
Expand Down
20 changes: 15 additions & 5 deletions astroquery/mast/tests/test_mast_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,25 @@ def test_observations_download_products(self, tmpdir):
assert len(result2) == 1

def test_observations_download_file(self, tmpdir):
test_obs_id = OBSID
test_obs = mast.Observations.query_criteria(filters=["NUV", "FUV"], objectname="M101")

# pull a single data product
products = mast.Observations.get_product_list(test_obs[0]["obsid"])
# enabling cloud connection
mast.Observations.enable_cloud_dataset(provider='AWS')

# get observations from GALEX instrument with query_criteria
observations = mast.Observations.query_criteria(objectname='M1',
radius=0.2,
instrument_name='GALEX')

assert len(observations) > 0, 'No results found for GALEX query.'

# pull data products from a single observation
products = mast.Observations.get_product_list(observations['obsid'][0])

# pull the URI of a single product
uri = products['dataURI'][0]

# download it
result = mast.Observations.download_file(uri)
result = mast.Observations.download_file(uri, cloud_only=True)
assert result == ('COMPLETE', None, None)

def test_get_cloud_uri(self):
Expand Down
2 changes: 1 addition & 1 deletion docs/mast/mast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ Cloud Data Access
Public datasets from the Hubble, Kepler and TESS telescopes are also available for free on Amazon Web Services
in `public S3 buckets <https://registry.opendata.aws/collab/stsci/>`__.

Using AWS resources to process public data no longer requires an AWS account for all AWS regions. To enable cloud data access for the Hubble, Kepler, and TESS missions, follow the steps below:
Using AWS resources to process public data no longer requires an AWS account for all AWS regions. To enable cloud data access for the Hubble, Kepler, TESS, and GALEX missions, follow the steps below:

You can enable cloud data access via the `~astroquery.mast.ObservationsClass.enable_cloud_dataset` function, which sets AWS to become the preferred source for data access as opposed to on-premise MAST until it is disabled with `~astroquery.mast.ObservationsClass.disable_cloud_dataset`.

Expand Down

0 comments on commit ed4bcbe

Please sign in to comment.