@@ -116,15 +116,15 @@ def query_sia(self, *, pos=None, band=None, time=None, pol=None,
116
116
117
117
query_sia .__doc__ = query_sia .__doc__ .replace ('_SIA2_PARAMETERS' , SIA2_PARAMETERS_DESC )
118
118
119
- def list_collections (self , servicetype = 'sia' ):
119
+ def list_collections (self , servicetype = None ):
120
120
"""
121
121
Return information of available IRSA SIAv2 collections to be used in ``query_sia`` queries.
122
122
123
123
Parameters
124
124
----------
125
125
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 '.
128
128
129
129
Returns
130
130
-------
@@ -134,10 +134,20 @@ def list_collections(self, servicetype='sia'):
134
134
135
135
servicetype = servicetype .upper ()
136
136
137
- if servicetype == 'SIA' :
137
+ if not servicetype :
138
138
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" )
139
149
else :
140
- raise ValueError ("servicetype should be 'sia '" )
150
+ raise ValueError ("if specified, servicetype should be 'SIA' or 'SSA '" )
141
151
142
152
collections = self .query_tap (query = query )
143
153
return collections .to_table ()
0 commit comments