Skip to content

Commit b01b123

Browse files
committed
ENH: adding cached SIA and SSA collection queries
1 parent 5a8b149 commit b01b123

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

astroquery/ipac/irsa/core.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ def query_sia(self, *, pos=None, band=None, time=None, pol=None,
116116

117117
query_sia.__doc__ = query_sia.__doc__.replace('_SIA2_PARAMETERS', SIA2_PARAMETERS_DESC)
118118

119-
def list_collections(self, servicetype='sia'):
119+
def list_collections(self, servicetype=None):
120120
"""
121121
Return information of available IRSA SIAv2 collections to be used in ``query_sia`` queries.
122122
123123
Parameters
124124
----------
125125
servicetype : str or None
126-
Service type to list collections for.
127-
Currently supported ones are: 'SIA'.
126+
Service type to list collections for. Returns all collections when not provided.
127+
Currently supported service types are: 'SIA', 'SSA'.
128128
129129
Returns
130130
-------
@@ -134,10 +134,20 @@ def list_collections(self, servicetype='sia'):
134134

135135
servicetype = servicetype.upper()
136136

137-
if servicetype == 'SIA':
137+
if not servicetype:
138138
query = "SELECT DISTINCT collection from caom.observation ORDER by collection"
139+
elif servicetype == 'SIA':
140+
query = ("SELECT DISTINCT o.collection FROM caom.observation o "
141+
"JOIN caom.plane p ON o.obsid = p.obsid "
142+
"WHERE (p.dataproducttype = 'image' OR p.dataproducttype = 'cube') "
143+
"order by collection")
144+
elif servicetype == 'SSA':
145+
query = ("SELECT DISTINCT o.collection FROM caom.observation o "
146+
"JOIN caom.plane p ON o.obsid = p.obsid "
147+
"WHERE (p.dataproducttype = 'spectrum' OR p.dataproducttype = 'cube') "
148+
"order by collection")
139149
else:
140-
raise ValueError("servicetype should be 'sia'")
150+
raise ValueError("if specified, servicetype should be 'SIA' or 'SSA'")
141151

142152
collections = self.query_tap(query=query)
143153
return collections.to_table()

0 commit comments

Comments
 (0)