Skip to content

Commit 6a3dc96

Browse files
committed
URL creation fix: different for ASDMs and other
1 parent 4ffc5f1 commit 6a3dc96

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

astroquery/alma/core.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,11 @@ def stage_data(self, uids):
295295

296296
username = self._username if hasattr(self, '_username') else 'anonymous'
297297

298+
# templates:
299+
# https://almascience.eso.org/dataPortal/requests/keflavich/946895898/ALMA/
300+
# 2013.1.00308.S_uid___A001_X196_X93_001_of_001.tar/2013.1.00308.S_uid___A001_X196_X93_001_of_001.tar
301+
# uid___A002_X9ee74a_X26f0/2013.1.00308.S_uid___A002_X9ee74a_X26f0.asdm.sdm.tar
302+
298303
url_decomposed = urlparse(data_page_url)
299304
base_url = ('{uri.scheme}://{uri.netloc}/'
300305
'dataPortal/requests/{username}/'
@@ -894,13 +899,26 @@ def _json_summary_to_table(self, data, base_url):
894899
# example template for constructing url:
895900
# https://almascience.eso.org/dataPortal/requests/keflavich/940238268/ALMA/
896901
# uid___A002_X9d6f4c_X154/2013.1.00546.S_uid___A002_X9d6f4c_X154.asdm.sdm.tar
897-
# above is WRONG
902+
# above is WRONG... except for ASDMs, when it's right
898903
# should be:
899904
# 2013.1.00546.S_uid___A002_X9d6f4c_X154.asdm.sdm.tar/2013.1.00546.S_uid___A002_X9d6f4c_X154.asdm.sdm.tar
900-
url = os.path.join(base_url,
901-
entry['file_name'],
902-
entry['file_name'],
903-
)
905+
#
906+
# apparently ASDMs are different from others:
907+
# templates:
908+
# https://almascience.eso.org/dataPortal/requests/keflavich/946895898/ALMA/
909+
# 2013.1.00308.S_uid___A001_X196_X93_001_of_001.tar/2013.1.00308.S_uid___A001_X196_X93_001_of_001.tar
910+
# uid___A002_X9ee74a_X26f0/2013.1.00308.S_uid___A002_X9ee74a_X26f0.asdm.sdm.tar
911+
if 'asdm' in entry['file_name']:
912+
uid = entry['de_name'][5:].replace("/","_").replace(":","_")
913+
url = os.path.join(base_url,
914+
uid,
915+
entry['file_name'],
916+
)
917+
else:
918+
url = os.path.join(base_url,
919+
entry['file_name'],
920+
entry['file_name'],
921+
)
904922
columns['URL'].append(url)
905923

906924
columns['size'] = u.Quantity(columns['size'], u.Gbyte)

0 commit comments

Comments
 (0)