@@ -233,16 +233,40 @@ public IbeQueryParam makeQueryParam(Map<String, String> queryInfo) {
233233
234234 String refSourceId = queryInfo .get ("refSourceId" );
235235 String sourceId = queryInfo .get ("sourceId" );
236- String dataproductlevel = queryInfo .get ("dataproductlevel" );
237- String sourceidTable = getSchemaFromSourceId (sourceId );
238-
236+
237+ if (sourceId != null ) {
238+ String sourceProductLevel = getProductLevelFromSourceId (sourceId );
239+ if (sourceProductLevel == null ) {
240+ throw new IllegalArgumentException ("Invalid Source ID: " + sourceId );
241+ }
242+ if ( sourceProductLevel == "1b" ) {
243+ String sourceSpec = WISE + "." + wds .getSourceTable () + "(\" source_id\" :\" " + sourceId + "\" )" ;
244+ queryParam .setPos (sourceSpec );
245+ }
246+ else if (sourceProductLevel == "3a" ) {
247+ String sourceSchema = getSchemaFromSourceId (sourceId );
248+ String ss = sourceSchema .toUpperCase ();
249+ String tt = sourceProductLevel .toUpperCase ();
250+ DataProduct sourcedt = DataProduct .valueOf (ss + "_" + tt );
251+ String sourceTable = sourcedt .getSourceTable ();
252+ String sourceSpec = WISE + "." + sourceTable + "(\" source_id\" :\" " + sourceId + "\" )" ;
253+ queryParam .setPos (sourceSpec );
254+ }
255+ }
239256 if (refSourceId != null ) {
240- String sourceSpec = WISE + "." + wds .getSourceTable () + "(\" source_id\" :\" " + refSourceId + "\" )" ;
241- queryParam .setRefBy (sourceSpec );
242- } else if (sourceId != null ) {
243- String sourceTable = wds .getSourceTable ();
244- String sourceSpec = WISE + "." + sourceTable + "(\" source_id\" :\" " + sourceId + "\" )" ;
245- queryParam .setPos (sourceSpec );
257+ String sourceProductLevel = getProductLevelFromSourceId (refSourceId );
258+ if (sourceProductLevel == null ) {
259+ throw new IllegalArgumentException ("Invalid Source ID: " + refSourceId );
260+ }
261+ if (sourceProductLevel == "1b" ) {
262+ String sourceSpec = WISE + "." + wds .getSourceTable () + "(\" source_id\" :\" " + refSourceId + "\" )" ;
263+ queryParam .setRefBy (sourceSpec );
264+ } else if (sourceProductLevel == "3a" ) {
265+ DataProduct sourcedt = DataProduct .ALLSKY_4BAND_3A ;
266+ String sourceTable = sourcedt .getSourceTable ();
267+ String sourceSpec = WISE + "." + sourceTable + "(\" source_id\" :\" " + refSourceId + "\" )" ;
268+ queryParam .setPos (sourceSpec );
269+ }
246270 }
247271
248272 // process constraints
@@ -343,6 +367,7 @@ private void setupDS(String ibeHost, String baseFsPath, DataProduct ds) {
343367 setDataset (wds .getDataset ());
344368 setTableName (wds .getImageTable ());
345369
370+ // following code was commented out to force url file retrieval
346371// File dir= (baseFsPath!=null) ? new File(baseFsPath) : null;
347372//
348373// if (baseFsPath != null && dir.canRead()) {
@@ -407,11 +432,13 @@ private String processConstraints(Map<String, String> queryInfo) {
407432 // process DATE RANGE
408433 String timeStart = queryInfo .get ("timeStart" );
409434 if (!StringUtils .isEmpty (timeStart )) {
410- constraints .add ("mjd_obs>='" + IBE .convertUnixToMJD (timeStart ) + "'" );
435+ //constraints.add("mjd_obs>='" + IBE.convertUnixToMJD(timeStart) + "'");
436+ constraints .add ("date_obs>='" + timeStart + "'" );
411437 }
412438 String timeEnd = queryInfo .get ("timeEnd" );
413439 if (!StringUtils .isEmpty (timeEnd )) {
414- constraints .add ("mjd_obs<='" + IBE .convertUnixToMJD (timeEnd ) + "'" );
440+ //constraints.add("mjd_obs<='" + IBE.convertUnixToMJD(timeEnd) + "'");
441+ constraints .add ("date_obs<='" + timeEnd + "'" );
415442 }
416443
417444 // process Scan IDs (support multiple IDs)
@@ -589,17 +616,17 @@ public enum DataProduct {
589616 PRELIM_POSTCRYO_1B ("prelim_postcryo" ,"p1bm_frm" , "prelim_2band_p1bs_psd" , "links-postcryo-prelim/l1b-2band/" ),
590617 ALLWISE_MULTIBAND_3A ("allwise" ,"p3am_cdd" , "allsky_4band_p1bs_psd" , "links-allwise/l3a/" ), // TODO: change for production, changed XW
591618 ALLSKY_4BAND_1B ("allsky" , "4band_p1bm_frm" , "allsky_4band_p1bs_psd" , "links-allsky/l1b-4band/" ),
592- ALLSKY_4BAND_3A ("allsky" , "4band_p3am_cdd" , "allsky_4band_p1bs_psd " , "links-allsky/l3a-4band/" ),
593- CRYO_3BAND_1B ("cryo_3band" , "3band_p1bm_frm" , "allsky_4band_p1bs_psd " , "links-3band/l1b-3band/" ),
594- CRYO_3BAND_3A ("cryo_3band" , "3band_p3am_cdd" , "allsky_4band_p1bs_psd " , "links-3band/l3a-3band/" ), // currently they are different: p1bm_frm and p3am_cdd
595- POSTCRYO_1B ("postcryo" , "2band_p1bm_frm" , "allsky_4band_p1bs_psd " , "links-postcryo/l1b-2band/" ),
619+ ALLSKY_4BAND_3A ("allsky" , "4band_p3am_cdd" , "allsky_4band_p3as_psd " , "links-allsky/l3a-4band/" ),
620+ CRYO_3BAND_1B ("cryo_3band" , "3band_p1bm_frm" , "allsky_3band_p1bs_psd " , "links-3band/l1b-3band/" ),
621+ CRYO_3BAND_3A ("cryo_3band" , "3band_p3am_cdd" , "allsky_3band_p3as_psd " , "links-3band/l3a-3band/" ), // currently they are different: p1bm_frm and p3am_cdd
622+ POSTCRYO_1B ("postcryo" , "2band_p1bm_frm" , "allsky_2band_p1bs_psd " , "links-postcryo/l1b-2band/" ),
596623 MERGE_1B ("merge" , "merge_p1bm_frm" , "allsky_4band_p1bs_psd" , "links-allsky/l1b-merge/" ), // exists under links-allsky
597624 MERGE_INT_1B ("merge_int" , "merge_i1bm_frm" , "merge_i1bs_psd" , "links-merge/l1b/" ),
598625 MERGE_3A ("merge" , "merge_p3am_cdd" , "allsky_4band_p1bs_psd" , "links-allwise/l3a-merge/" ), // exists under links-allwise
599626 MERGE_INT_3A ("merge_int" , "merge_p3am_cdd" , "allsky_4band_p3as_psd" , "links-merge/l3a/" ),
600627 NEOWISER_PROV_1B ("neowiser_prov" , "i1bm_frm" , "i1bs_psd" , "links-nprov/l1b/" ),
601628 NEOWISER_YR1_1B ("neowiser_yr1" , "yr1_p1bm_frm" , "yr1_p1bs_psd" , "links-neowiser/l1b-yr1/" ),
602- NEOWISER_1B ("neowiser" , "p1bm_frm" , "allsky_4band_p1bs_psd " , "links-neowiser/l1b/" ),
629+ NEOWISER_1B ("neowiser" , "p1bm_frm" , "neowiser_p1bs_psd " , "links-neowiser/l1b/" ),
603630
604631 PASS1_1B ("pass1" , "i1bm_frm" , "i1bs_psd" , "links-pass1/l1b/" ),
605632 PASS1_3A ("pass1" , "i3am_cdd" , "i3as_psd" , "links-pass1/l3a/" ),
0 commit comments