@@ -68,6 +68,38 @@ public class FinderChartRequestUtil {
68
68
"3a.2;w2" ,
69
69
"3a.3;w3" ,
70
70
"3a.4;w4" };
71
+
72
+
73
+ /**
74
+ * TODO For FC4, need to use config table and new image search, see IRSA-794 and IRSA-816
75
+ * Add reader to parse IRSA configuration table and return a combo depending on the imageset
76
+ * For FC3: SEIP + AKARI, we use fixed values for the combos below:
77
+ *
78
+ * SEIP metadata sent from client (or TODO read from master table)
79
+ * thru request so it can be split into schema.table and band, and title.
80
+ * THis is passed from the client
81
+ * Expected format : metadata expected to be as "schema.table-band;title"
82
+ */
83
+ private final static String seipCombo []={
84
+ "spitzer.seip_science:IRAC1;SEIP IRAC1 (2.4 microns);file_type='science' and fname like '%.mosaic.fits'" ,
85
+ "spitzer.seip_science:IRAC2;SEIP IRAC2 (2.4 microns);file_type='science' and fname like '%.mosaic.fits'" ,
86
+ "spitzer.seip_science:IRAC3;SEIP IRAC3 (2.4 microns);file_type='science' and fname like '%.mosaic.fits'" ,
87
+ "spitzer.seip_science:IRAC4;SEIP IRAC4 (2.4 microns);file_type='science' and fname like '%.mosaic.fits'" ,
88
+ "spitzer.seip_science:MIPS24;SEIP MIPS (2.4 microns);file_type='science' and fname like '%.mosaic.fits'"
89
+ };
90
+
91
+ /**
92
+ * AKARI metadata sent from client thru request so it can be split into schema.table, band on one hand, label title on another hand, all separated by ';'.
93
+ * THis is passed from the client
94
+ * Expected format : metadata expected to be as "schema.table-band;title"
95
+ */
96
+ private final static String akariCombo []={
97
+ "akari.images_tbl:N60;FIS N60 (65 micron)" ,
98
+ "akari.images_tbl:WideS;FIS WideS (90 micron)" ,
99
+ "akari.images_tbl:WideL;FIS WideL (140 micron)" ,
100
+ "akari.images_tbl:N160;FIS N160 (160 micron)"
101
+ };
102
+
71
103
private final static String sDssCombo []={
72
104
"u;u" ,"g;g" ,"r;r" ,"i;i" ,"z;z"
73
105
};
@@ -78,15 +110,26 @@ public class FinderChartRequestUtil {
78
110
put ("large" ,256 );
79
111
}
80
112
};
113
+ private static String regExAtlasKey = ":" ;
114
+ private static String regExSplitKey = ";" ;
81
115
116
+ /**
117
+ * @param pt
118
+ * @param radius
119
+ * @param width
120
+ * @param key string combination of value to be splitted for convenience
121
+ * @param expandedTitle
122
+ * @param service
123
+ * @return
124
+ */
82
125
public static WebPlotRequest makeWebPlotRequest (WorldPt pt ,
83
126
float radius ,
84
127
int width ,
85
- String band ,
128
+ String key ,
86
129
String expandedTitle ,
87
130
WebPlotRequest .ServiceType service ) {
88
131
89
- WebPlotRequest wpReq = getWebPlotRequest (service , band , pt , radius );
132
+ WebPlotRequest wpReq = getWebPlotRequest (service , key , pt , radius );
90
133
if (!StringUtils .isEmpty (expandedTitle )) wpReq .setExpandedTitle (expandedTitle );
91
134
wpReq .setExpandedTitleOptions (WebPlotRequest .ExpandedTitleOptions .PREFIX );
92
135
wpReq .setZoomType (ZoomType .TO_WIDTH );
@@ -99,48 +142,100 @@ public static WebPlotRequest makeWebPlotRequest(WorldPt pt,
99
142
wpReq .setHideTitleDetail (true );
100
143
wpReq .setPreferenceColorKey ("FcColorKey" );
101
144
wpReq .setTitleOptions (WebPlotRequest .TitleOptions .SERVICE_OBS_DATE );
102
- wpReq .setTitle (getComboTitle (band ));
145
+ wpReq .setTitle (getComboTitle (key ));
103
146
return wpReq ;
104
147
}
105
148
106
- private static WebPlotRequest getWebPlotRequest (WebPlotRequest .ServiceType service , String band , WorldPt pt , Float radius ) {
149
+ private static WebPlotRequest getWebPlotRequest (WebPlotRequest .ServiceType service , String key , WorldPt pt , Float radius ) {
107
150
WebPlotRequest wpReq =null ;
108
151
switch (service ) {
109
152
case DSS :
110
- wpReq = WebPlotRequest .makeDSSRequest (pt , getComboValue (band ),radius );
153
+ wpReq = WebPlotRequest .makeDSSRequest (pt , getComboValue (key ),radius );
111
154
break ;
112
155
case IRIS :
113
- wpReq = WebPlotRequest .makeIRISRequest (pt , getComboValue (band ), radius );
156
+ wpReq = WebPlotRequest .makeIRISRequest (pt , getComboValue (key ), radius );
114
157
break ;
115
158
case ISSA :
116
- wpReq = WebPlotRequest .makeISSARequest (pt , getComboValue (band ),radius );
159
+ wpReq = WebPlotRequest .makeISSARequest (pt , getComboValue (key ),radius );
117
160
break ;
118
161
case MSX :
119
- wpReq = WebPlotRequest .makeMSXRequest (pt , getComboValue (band ),radius );
162
+ wpReq = WebPlotRequest .makeMSXRequest (pt , getComboValue (key ),radius );
120
163
break ;
121
164
case SDSS :
122
- wpReq = WebPlotRequest .makeSloanDSSRequest (pt , getComboValue (band ), radius );
165
+ wpReq = WebPlotRequest .makeSloanDSSRequest (pt , getComboValue (key ), radius );
123
166
break ;
124
167
case TWOMASS :
125
- wpReq = WebPlotRequest .make2MASSRequest (pt , getComboValue (band ),radius );
168
+ wpReq = WebPlotRequest .make2MASSRequest (pt , getComboValue (key ),radius );
169
+ break ;
170
+ case AKARI :
171
+ case SEIP :
172
+ case ATLAS :
173
+ String surveyKey = extractSurveyKey (getComboValue (key ));
174
+ String surveyKeyBand = extractSurveyKeyBand (getComboValue (key ));
175
+ String filter = extractFilter (key );
176
+ wpReq = WebPlotRequest .makeAtlasRequest (pt , surveyKey , surveyKeyBand , filter , radius );
177
+ // if (wpReq != null)
178
+ // wpReq.setDrawingSubGroupId(surveyKey.split("\\.")[1]);// Set dataset (table) name as subgroup
126
179
break ;
127
180
case WISE :
128
- String [] pair = getComboValue (band ).split ("\\ ." );
181
+ String [] pair = getComboValue (key ).split ("\\ ." );
129
182
wpReq = WebPlotRequest .makeWiseRequest (pt , pair [0 ], pair [1 ], radius );
130
183
break ;
131
184
}
132
- if (wpReq !=null ) wpReq .setDrawingSubGroupId (ImageSet .lookup (service ).subgroup );
185
+ if (wpReq != null )
186
+ wpReq .setDrawingSubGroupId (ImageSet .lookup (service ).subgroup );
133
187
return wpReq ;
134
188
}
135
189
190
+ /**
191
+ * Get ATLAS values from schema.table-band (out of the {@link #seipCombo} for example)
192
+ *
193
+ * @param metadata expected to be as "schema.table:band;title"
194
+ * @return the surveyKey, i.e schema.table
195
+ */
196
+ public static String extractSurveyKey (String metadata ) {
197
+ String sAry [] = metadata .split (regExAtlasKey );
198
+ return sAry [0 ];
199
+ }
200
+
201
+ /**
202
+ * @param metadata key expected to be as "schema.table:band;title"
203
+ * @return the surveyKeyBand, i.e irac1 for SEIP
204
+ */
205
+ public static String extractSurveyKeyBand (String metadata ) {
206
+ String sAry [] = metadata .split (regExAtlasKey );
207
+ return sAry [1 ];
208
+ }
209
+
210
+ /**
211
+ * @param metadata expected to be as "schema.table:band;title;filter"
212
+ * @return filter value
213
+ */
214
+ public static String extractFilter (String metadata ) {
215
+ String sAry [] = metadata .split (regExSplitKey );
216
+ return sAry .length > 1 ? sAry [2 ] : "" ;
217
+ }
218
+
219
+ /**
220
+ * Value part is the left side of "datax;datay" combo
221
+ *
222
+ * @param combo string value expected to be of a form "datax;datay"
223
+ * @return the first element of the array after splitting the combo into ";" pieces
224
+ */
136
225
public static String getComboValue (String combo ) {
137
- String sAry []= combo .split (";" );
138
- return sAry .length > 0 ? sAry [0 ] : combo ;
226
+ String sAry [] = combo .split (regExSplitKey );
227
+ return sAry .length > 0 ? sAry [0 ] : combo ;
139
228
}
140
229
230
+ /**
231
+ * Title part is the right side of "datax;datay" combo
232
+ *
233
+ * @param combo string value expected to be of the form "datax;datay"
234
+ * @return the second element of the array after splitting the combo into ";" pieces
235
+ */
141
236
public static String getComboTitle (String combo ) {
142
- String sAry []= combo .split (";" );
143
- return sAry .length > 1 ? sAry [1 ] : combo ;
237
+ String sAry [] = combo .split (regExSplitKey );
238
+ return sAry .length > 1 ? sAry [1 ] : combo ;
144
239
}
145
240
146
241
public static int getPlotWidth (String sizeKey ) {
@@ -155,23 +250,26 @@ public static int getPlotWidth(String sizeKey) {
155
250
156
251
157
252
158
- public static enum ImageSet {DSS (DEF , "dss" , "dss_bands" , dssCombo , null , DEF ),
159
- IRIS ("IRAS (IRIS)" , "iris" , "iras_bands" , irisCombo , "iraspsc" , "IRAS" ),
160
- ISSA (DEF , "issa" , null , issaCombo , null , DEF ),
161
- MSX (DEF , "msx" , null , msxCombo , null , DEF ),
162
- TWOMASS ("2MASS" , "2mass" ,"twomass_bands" , twoMassCombo , "fp_psc" , DEF ),
163
- WISE ("WISE (AllWISE)" , "wise" , "wise_bands" , wiseCombo , "allwise_p3as_psd" , DEF ),
164
- SDSS ("SDSS (DR7)" , "sdss" , "sdss_bands" ,sDssCombo , null , "SDSS (DR10)" );
253
+ public static enum ImageSet {DSS (WebPlotRequest .ServiceType .DSS , DEF , "dss" , "dss_bands" , dssCombo , null , DEF ),
254
+ IRIS (WebPlotRequest .ServiceType .IRIS ,"IRAS (IRIS)" , "iris" , "iras_bands" , irisCombo , "iraspsc" , "IRAS" ),
255
+ ISSA (WebPlotRequest .ServiceType .ISSA , DEF , "issa" , null , issaCombo , null , DEF ),
256
+ MSX (WebPlotRequest .ServiceType .MSX , DEF , "msx" , null , msxCombo , null , DEF ),
257
+ TWOMASS (WebPlotRequest .ServiceType .TWOMASS ,"2MASS" , "2mass" ,"twomass_bands" , twoMassCombo , "fp_psc" , DEF ),
258
+ WISE (WebPlotRequest .ServiceType .WISE , "WISE (AllWISE)" , "wise" , "wise_bands" , wiseCombo , "allwise_p3as_psd" , DEF ),
259
+ SEIP (WebPlotRequest .ServiceType .ATLAS , "Spitzer SEIP" ,"seip" ,"seip_bands" ,seipCombo ,"slphotdr4" ,DEF ),
260
+ AKARI (WebPlotRequest .ServiceType .ATLAS , "AKARI" ,"akari" ,"akari_bands" ,akariCombo ,"slphotdr4" ,DEF ),
261
+ SDSS (WebPlotRequest .ServiceType .SDSS , "SDSS (DR7)" , "sdss" , "sdss_bands" ,sDssCombo , null , "SDSS (DR10)" );
165
262
166
- public WebPlotRequest .ServiceType srvType = WebPlotRequest . ServiceType . valueOf ( this . name ()) ;
263
+ public WebPlotRequest .ServiceType srvType ;
167
264
public String title ;
168
265
public String subgroup ;
169
266
public String band ;
170
267
public String [] comboAry ;
171
268
public String catalog ;
172
269
public String catalogTitle ;
173
270
174
- ImageSet (String title , String subgroup , String band , String [] comboAry , String catalog , String catalogTitle ) {
271
+ ImageSet (WebPlotRequest .ServiceType serviceType , String title , String subgroup , String band , String [] comboAry , String catalog , String catalogTitle ) {
272
+ srvType = serviceType ;
175
273
this .title = title .equals (DEF ) ? srvType .toString () : title ;
176
274
this .subgroup = subgroup ;
177
275
this .band = band ;
@@ -183,8 +281,23 @@ public static enum ImageSet {DSS(DEF, "dss", "dss_bands", dssCombo, null, DEF),
183
281
public static ImageSet lookup (WebPlotRequest .ServiceType srvType ) {
184
282
return valueOf (srvType .name ());
185
283
}
284
+ public static ImageSet match (String word ) {
285
+ for (ImageSet s : values ()){
286
+ if (word .toLowerCase ().contains (s .name ().toLowerCase ())){
287
+ return s ;
288
+ }
289
+ }
290
+ return null ;
291
+ }
186
292
}
187
293
294
+ public static void main (String [] args ) {
295
+ String [] split = new String ("schema.table" ).split ("\\ ." );
296
+
297
+ for (String s :split ){
298
+ System .out .println (s );
299
+ }
300
+ }
188
301
189
302
public static enum Artifact {
190
303
diff_spikes_3 ("WISE Diffraction Spikes (dots)" , "Wise.Artifact.Spikes.level3.Selected" ),
@@ -212,9 +325,20 @@ public static boolean isArtifacts(String desc) {
212
325
}
213
326
}
214
327
215
- public static enum Source {DSS , IRIS , twomass , WISE , SDSS }
216
- public static enum Band {dss_bands , iras_bands , twomass_bands , wise_bands , SDSS_bands }
217
-
328
+ /**
329
+ * TODO remove that if not needed, i couldn't find any reference but please double check before rmeoving it!
330
+ * @deprecated
331
+ */
332
+ public static enum Source {DSS , IRIS , twomass , WISE , ATLAS , SDSS }
333
+ /**
334
+ * TODO remove that if not needed, i couldn't find any reference but please double check before rmeoving it!
335
+ * @deprecated
336
+ */
337
+ public static enum Band {dss_bands , iras_bands , twomass_bands , wise_bands , spitzer_bands , SDSS_bands }
338
+ /**
339
+ * TODO remove that if not needed, i couldn't find any reference but please double check before rmeoving it!
340
+ * @deprecated
341
+ */
218
342
public static enum Radius {iras_radius , twomass_radius , wise_radius , sdss_radius }
219
343
220
344
}
0 commit comments