Skip to content

Commit 6aa80d0

Browse files
committed
second pass thru the PR: fixed typo of 355Rows corrected from 356Rows, explicitly calling table variable to download_products output, and reverting changes made to observations.py
1 parent 1dbe04f commit 6aa80d0

File tree

3 files changed

+18
-29
lines changed

3 files changed

+18
-29
lines changed

astroquery/mast/observations.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -551,18 +551,11 @@ def download_file(self, uri, local_path=None, base_url=None, cache=True, cloud_o
551551
url = None
552552

553553
try:
554-
if self._cloud_connection is not None:
555-
fall_back = False
556-
if not self._cloud_connection.is_supported(data_product):
557-
log.warn("Data product not in S3.")
558-
fall_back = True
559-
else:
560-
try:
561-
self._cloud_connection.download_file(data_product, local_path, cache)
562-
except Exception as ex:
563-
log.exception("Error pulling from S3 bucket: {}".format(ex))
564-
fall_back = True
565-
if fall_back:
554+
if self._cloud_connection is not None and self._cloud_connection.is_supported(data_product):
555+
try:
556+
self._cloud_connection.download_file(data_product, local_path, cache)
557+
except Exception as ex:
558+
log.exception("Error pulling from S3 bucket: {}".format(ex))
566559
if cloud_only:
567560
log.warn("Skipping file...")
568561
local_path = ""
@@ -572,7 +565,6 @@ def download_file(self, uri, local_path=None, base_url=None, cache=True, cloud_o
572565
self._download_file(data_url, local_path,
573566
cache=cache, head_safe=True, continuation=False)
574567
else:
575-
576568
self._download_file(data_url, local_path,
577569
cache=cache, head_safe=True, continuation=False)
578570

astroquery/mast/tests/test_mast_remote.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def test_observations_download_products(self, tmpdir):
291291

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

296296
# pull a single data product
297297
products = mast.Observations.get_product_list(test_obs[0]["obsid"])
@@ -895,4 +895,3 @@ def test_zcut_get_cutouts(self):
895895
assert isinstance(cutout_list, list)
896896
assert len(cutout_list) == 1
897897
assert isinstance(cutout_list[0], fits.HDUList)
898-

docs/mast/mast.rst

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ with a `~astropy.table.Table` of data products, or a list (or single) obsid as t
306306
307307
>>> print(manifest)
308308
309-
Local Path Status Message URL
309+
Local Path Status Message URL
310310
------------------------------------------------ -------- ------- ----
311311
./mastDownload/IUE/lwp13058/lwp13058.mxlo.gz COMPLETE None None
312312
./mastDownload/IUE/lwp13058/lwp13058mxlo_vo.fits COMPLETE None None
@@ -317,12 +317,10 @@ with a `~astropy.table.Table` of data products, or a list (or single) obsid as t
317317
318318
>>> from astroquery.mast import Observations
319319
320-
>>> single_obs = Observations.query_criteria(obs_collection="IUE",obs_id="lwp13058")
320+
>>> single_obs = Observations.query_criteria(obs_collection="IUE", obs_id="lwp13058")
321321
>>> data_products = Observations.get_product_list(single_obs)
322-
323-
>>> Observations.download_products(data_products,
324-
... productType="SCIENCE",
325-
... curl_flag=True)
322+
323+
>>> table = Observations.download_products(data_products, productType="SCIENCE", curl_flag=True)
326324
327325
Downloading URL https://mast.stsci.edu/portal/Download/stage/anonymous/public/514cfaa9-fdc1-4799-b043-4488b811db4f/mastDownload_20170629162916.sh to ./mastDownload_20170629162916.sh ... [Done]
328326
@@ -340,11 +338,11 @@ the ``local_path`` keyword argument.
340338
341339
>>> single_obs = Observations.query_criteria(obs_collection="IUE",obs_id="lwp13058")
342340
>>> data_products = Observations.get_product_list(single_obs)
343-
341+
344342
>>> product = data_products[0]["dataURI"]
345343
>>> print(product)
346344
mast:IUE/url/pub/iue/data/lwp/13000/lwp13058.elbll.gz
347-
345+
348346
>>> result = Observations.download_file(product)
349347
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:IUE/url/pub/iue/data/lwp/13000/lwp13058.elbll.gz to ./lwp13058.elbll.gz ... [Done]
350348
@@ -829,13 +827,13 @@ The moving_target may be any object name or ID understood by the
829827
>>> hdulist[0].info()
830828
Filename: <class '_io.BytesIO'>
831829
No. Name Ver Type Cards Dimensions Format
832-
0 PRIMARY 1 PrimaryHDU 54 ()
833-
1 PIXELS 1 BinTableHDU 150 356R x 16C [D, E, J, 25J, 25E, 25E, 25E, 25E, J, E, E, 38A, D, D, D, D]
834-
2 APERTURE 1 ImageHDU 97 (2136, 2078) int32
830+
0 PRIMARY 1 PrimaryHDU 54 ()
831+
1 PIXELS 1 BinTableHDU 150 355R x 16C [D, E, J, 25J, 25E, 25E, 25E, 25E, J, E, E, 38A, D, D, D, D]
832+
2 APERTURE 1 ImageHDU 97 (2136, 2078) int32
833+
835834
836835
837836
838-
839837
The `~astroquery.mast.TesscutClass.download_cutouts` function takes a coordinate, object name
840838
(i.e. "M104" or "TIC 32449963"), or moving target (i.e. "Eleonora") and cutout size
841839
(in pixels or an angular quantity) and downloads the cutout target pixel file(s).
@@ -856,7 +854,7 @@ more than one camera or ccd a target pixel file will be produced for each one.
856854
Inflating...
857855
858856
>>> print(manifest)
859-
Local Path
857+
Local Path
860858
----------------------------------------------------------
861859
./tess-s0009-4-1_107.186960_-70.509190_21x15_astrocut.fits
862860
@@ -899,7 +897,7 @@ To access sector information for a particular coordinate, object, or moving targ
899897
sectorName sector camera ccd
900898
-------------- ------ ------ ---
901899
tess-s0029-1-4 29 1 4
902-
900+
903901
Zcut
904902
====
905903

0 commit comments

Comments
 (0)