Skip to content

Commit 4a6865c

Browse files
committed
allow empty data products in Heasarc.locate_data
1 parent f3f4426 commit 4a6865c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

astroquery/heasarc/core.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,13 @@ def locate_data(self, query_result=None, catalog_name=None):
524524
session=self._session
525525
)
526526
dl_result = query.execute().to_table()
527-
dl_result = dl_result[dl_result['content_type'] == 'directory']
528-
dl_result = dl_result[['ID', 'access_url', 'content_length']]
527+
# include rows that have directory links (i.e. data) and those
528+
# that report errors (usually means there are no data products)
529+
dl_result = dl_result[np.ma.mask_or(
530+
dl_result['content_type'] == 'directory',
531+
dl_result['error_message'] != ''
532+
)]
533+
dl_result = dl_result[['ID', 'access_url', 'content_length', 'error_message']]
529534

530535
# add sciserver and s3 columns
531536
newcol = [
@@ -622,6 +627,10 @@ def download_data(self, links, host='heasarc', location='.'):
622627
'`~locate_data` first'
623628
)
624629

630+
# remove rows that dont have data, if any
631+
if 'error_message' in links.colnames:
632+
links = links[links['error_message'] == '']
633+
625634
if host == 'heasarc':
626635

627636
log.info('Downloading data from the HEASARC ...')

0 commit comments

Comments
 (0)