Commit 86047eb9 authored by Robert Butora's avatar Robert Butora
Browse files

adds all ObsCore columns to search-query result (and keeps VLKB extensions)

parent 820f7bc5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@ import java.util.Iterator;

class Dataset
{

   FormatResponseFilter.ObsDataset obsDataset;

   class Access
   {
      String accessFileUrl;
+2 −1
Original line number Diff line number Diff line
@@ -59,7 +59,8 @@ class SearchOutputData
            prevSubsurveyId = dataset.subsurvey_id;
         }

         if( Dataset.areDatasetsMergeable(datasetList) )
         if( false )
         //if( Dataset.areDatasetsMergeable(datasetList) )
         {
            Dataset mergedDataset = new Dataset(datasetList, inputs, mergeUrlRoot);
            datasetList.add(mergedDataset);
+104 −32
Original line number Diff line number Diff line
@@ -47,28 +47,66 @@ public final class XmlSerializer
      out.flush();
   }


   private static StarTable makeSearchResultsTable(Subsurvey[] ssurv)
   {
      ColumnInfo[] colInfos = new ColumnInfo[ 6 + 2*4 ];

      int ix=0;

      colInfos[ ix++ ] = new ColumnInfo( "overlap",     Integer.class, "Overlap Code" );
      colInfos[ ix++ ] = new ColumnInfo( "overlapSky",  Integer.class, "Overlap Code for Sky axes" );
      colInfos[ ix++ ] = new ColumnInfo( "overlapSpec", Integer.class, "Overlap Code for Spectral axis" );

      colInfos[ ix++ ] = new ColumnInfo( "dataType",    String.class,  "Data Type (image|cube)" );
      colInfos[ ix++ ] = new ColumnInfo( "pubdid",      String.class,  "PublisherDid" );
      colInfos[ ix++ ] = new ColumnInfo( "access_url",  String.class,  "Access URL" );

      colInfos[ ix++ ] = new ColumnInfo( "P1lon", Double.class, "longitude" );
      colInfos[ ix++ ] = new ColumnInfo( "P1lat", Double.class, "latitude" );
      colInfos[ ix++ ] = new ColumnInfo( "P2lon", Double.class, "longitude" );
      colInfos[ ix++ ] = new ColumnInfo( "P2lat", Double.class, "latitude" );
      colInfos[ ix++ ] = new ColumnInfo( "P3lon", Double.class, "longitude" );
      colInfos[ ix++ ] = new ColumnInfo( "P3lat", Double.class, "latitude" );
      colInfos[ ix++ ] = new ColumnInfo( "P4lon", Double.class, "longitude" );
      colInfos[ ix++ ] = new ColumnInfo( "P4lat", Double.class, "latitude" );
      // FIXME make static final
      ColumnInfo[] colInfos =
      {
         new ColumnInfo( "dataproduct_type",  String.class,  "Dataproduct Type (image|cube)" ),
         new ColumnInfo( "calib_level",       Integer.class, "Calibration level" ),
         new ColumnInfo( "obs_collection",    String.class,  "Collection" ),
         new ColumnInfo( "obs_id",            String.class,  "Observation Id" ),
         new ColumnInfo( "obs_publisher_did", String.class,  "Publisher Did" ),

         new ColumnInfo( "access_url",     String.class, "Access URL" ),
         new ColumnInfo( "access_format",  String.class, "Format (MIME type)" ),
         new ColumnInfo( "access_estsize", Long.class,   "Extimated size (KB)" ),

         new ColumnInfo( "target_name", String.class,  "Target" ),

         new ColumnInfo( "s_ra",         Double.class, "Right Ascention" ),
         new ColumnInfo( "s_dec",        Double.class, "Declination" ),
         new ColumnInfo( "s_fov",        Double.class, "Field of view" ),
         new ColumnInfo( "s_region",     String.class, "Region" ),
         new ColumnInfo( "s_xel1",       Long.class,   "Pixels axis1" ),
         new ColumnInfo( "s_xel2",       Long.class,   "Pixels axis2" ),
         new ColumnInfo( "s_resolution", Double.class, "Spatial resolution" ),

         new ColumnInfo( "t_min",        Double.class, "Time min" ),
         new ColumnInfo( "t_max",        Double.class, "Time max" ),
         new ColumnInfo( "t_exptime",    Double.class, "Exposure time" ),
         new ColumnInfo( "t_resolution", Double.class, "Time resolution" ),
         new ColumnInfo( "t_xel",        Long.class,   "Time pixels" ),

         new ColumnInfo( "em_min",       Double.class, "Spectrum min" ),
         new ColumnInfo( "em_max",       Double.class, "Spectrum max" ),
         new ColumnInfo( "em_res_power", Double.class, "Spectrum resolution power" ),
         new ColumnInfo( "em_xel",       Long.class,   "Spectrum pixels" ),

         new ColumnInfo( "o_ucd", String.class, "Observable UCD" ),

         new ColumnInfo( "pol_states", String.class, "Polarization states" ),
         new ColumnInfo( "pol_xel",    Long.class,   "Polarization pixels" ),

         new ColumnInfo( "facility_name", String.class, "Facility" ),
         new ColumnInfo( "instrument_name", String.class, "Instrument" ),


         // VLKB extensions
         new ColumnInfo( "overlap",     Integer.class, "Overlap Code" ),
         new ColumnInfo( "overlapSky",  Integer.class, "Overlap Code for Sky axes" ),
         new ColumnInfo( "overlapSpec", Integer.class, "Overlap Code for Spectral axis" ),

         new ColumnInfo( "P1lon", Double.class, "P1 longitude" ),
         new ColumnInfo( "P1lat", Double.class, "P1 latitude" ),
         new ColumnInfo( "P2lon", Double.class, "P2 longitude" ),
         new ColumnInfo( "P2lat", Double.class, "P2 latitude" ),
         new ColumnInfo( "P3lon", Double.class, "P3 longitude" ),
         new ColumnInfo( "P3lat", Double.class, "P3 latitude" ),
         new ColumnInfo( "P4lon", Double.class, "P4 longitude" ),
         new ColumnInfo( "P4lat", Double.class, "P4 latitude" )
      };

      RowListStarTable astro = new RowListStarTable( colInfos );

@@ -76,16 +114,50 @@ public final class XmlSerializer
      {
         for(Dataset dataset : subsurvey.datasetArr)
         {
            if(dataset.obsDataset == null) continue; // skip mergeable datasets

            astro.addRow( new Object[] 
                  {
                     // ObsCore
                     dataset.obsDataset.dataproduct_type,//dataset.dataType, 
                        new Integer( dataset.obsDataset.calib_level ),
                        dataset.obsDataset.obs_collection,
                        dataset.obsDataset.obs_id,
                        dataset.obsDataset.obs_publisher_did,

                        dataset.obsDataset.access_url,//dataset.access.accessCutoutUrl,
                        dataset.obsDataset.access_format,
                        new Long( dataset.obsDataset.access_estsize ),

                        dataset.obsDataset.target_name,

                        new Double(dataset.obsDataset.s_ra),new Double(dataset.obsDataset.s_dec),new Double(dataset.obsDataset.s_fov),
                        dataset.obsDataset.s_region,
                        new Long( dataset.obsDataset.s_xel1 ), new Long( dataset.obsDataset.s_xel2 ),
                        new Double(dataset.obsDataset.s_resolution),

                        new Double(dataset.obsDataset.t_min), new Double(dataset.obsDataset.t_max),
                        new Double(dataset.obsDataset.t_exptime), new Double(dataset.obsDataset.t_resolution),
                        new Long( dataset.obsDataset.t_xel ),

                        new Double(dataset.obsDataset.em_min), new Double(dataset.obsDataset.em_max),
                        new Double(dataset.obsDataset.em_res_power),
                        new Long( dataset.obsDataset.em_xel ),

                        dataset.obsDataset.o_ucd,

                        dataset.obsDataset.pol_states,
                        new Long( dataset.obsDataset.pol_xel ),

                        dataset.obsDataset.facility_name,
                        dataset.obsDataset.instrument_name,


                        // VLKB extensions
                        new Integer( dataset.overlapCode ),
                        new Integer( dataset.overlapCodeSky ),
                        new Integer( dataset.overlapCodeVel ),

                     dataset.dataType, 
                     dataset.publisherDid,
                     dataset.access.accessCutoutUrl,

                        new Double(dataset.vertices_deg.lon[0]), new Double(dataset.vertices_deg.lat[0]),
                        new Double(dataset.vertices_deg.lon[1]), new Double(dataset.vertices_deg.lat[1]),
                        new Double(dataset.vertices_deg.lon[2]), new Double(dataset.vertices_deg.lat[2]),
+36 −7
Original line number Diff line number Diff line
@@ -225,15 +225,44 @@ public class DbPSearch
			   FormatResponseFilter.ObsDataset obsDataset = new FormatResponseFilter.ObsDataset();

			   obsDataset.dataproduct_type  = res.getString("dataproduct_type");
			   obsDataset.obs_publisher_did = res.getString("obs_publisher_did");
			   obsDataset.calib_level       = res.getInt("calib_level");
			   obsDataset.obs_collection    = res.getString("obs_collection");
			   obsDataset.access_url        = res.getString("access_url");
			   obsDataset.obs_id            = res.getString("obs_id");
			   obsDataset.obs_publisher_did = res.getString("obs_publisher_did");

			   obsDataset.em_min = res.getDouble("em_min");
			   boolean em_min_valid = !res.wasNull();
			   obsDataset.em_max = res.getDouble("em_max");
			   boolean em_max_valid = !res.wasNull();
			   obsDataset.access_url     = res.getString("access_url");
			   obsDataset.access_format  = res.getString("access_format");
			   obsDataset.access_estsize = res.getLong("access_estsize");
			   
            obsDataset.target_name = res.getString("target_name");

			   obsDataset.s_ra         = res.getDouble("s_ra");
			   obsDataset.s_dec        = res.getDouble("s_dec");
			   obsDataset.s_fov        = res.getDouble("s_fov");
			   obsDataset.s_region     = res.getString("s_region");
			   obsDataset.s_xel1       = res.getLong("s_xel1");
			   obsDataset.s_xel2       = res.getLong("s_xel2");
			   obsDataset.s_resolution = res.getDouble("s_resolution");

			   obsDataset.t_min         = res.getDouble("t_min");
			   obsDataset.t_max         = res.getDouble("t_max");
			   obsDataset.t_exptime     = res.getDouble("t_exptime");
			   obsDataset.t_resolution  = res.getDouble("t_resolution");
			   obsDataset.t_xel         = res.getLong("t_xel");

			   obsDataset.em_min       = res.getDouble("em_min"); boolean em_min_valid = !res.wasNull();
			   obsDataset.em_max       = res.getDouble("em_max"); boolean em_max_valid = !res.wasNull();
			   obsDataset.em_valid     = em_min_valid && em_max_valid;;
			   obsDataset.em_res_power = res.getDouble("em_res_power");
			   obsDataset.em_xel       = res.getLong("em_xel");

			   obsDataset.o_ucd = res.getString("o_ucd");
			   
            obsDataset.pol_states = res.getString("pol_states");
            obsDataset.pol_xel    = res.getLong("pol_xel");

            obsDataset.facility_name = res.getString("facility_name");
            obsDataset.instrument_name = res.getString("instrument_name");

			   obsDataset.vertices_str  = res.getString("polygon_region_galactic");
			   obsDataset.inputInsideDb = res.getBoolean("inputInsideDb");
+30 −3
Original line number Diff line number Diff line
@@ -155,14 +155,37 @@ public class FormatResponseFilter implements Filter
   static class ObsDataset
   {
      String dataproduct_type;
      String obs_publisher_did;
      Integer calib_level;
      String obs_collection;
      String obs_id;
      String obs_publisher_did;

      String access_url;
      String access_format;
      Long access_estsize;

      String target_name;

      Double s_ra, s_dec, s_fov;
      String s_region;
      Long s_xel1, s_xel2;
      Double s_resolution;

      Double t_min, t_max, t_exptime, t_resolution;
      Long t_xel;

      double em_min;
      double em_max;
      Double em_min,  em_max, em_res_power;
      Long em_xel;
      boolean em_valid;

      String o_ucd;
   
      String pol_states;
      Long   pol_xel;

      String facility_name;
      String instrument_name;

      String vertices_str;
      boolean inputInsideDb;
      boolean dbInsideInput;
@@ -193,10 +216,13 @@ public class FormatResponseFilter implements Filter
   private Dataset[] convert(FormatResponseFilter.ObsDataset[] obsDatasetArr, Coord coord, String queryString, String fitsRemotePath)
   {
      List<Dataset> datasetList  = new ArrayList<Dataset>();

      for(FormatResponseFilter.ObsDataset obsDataset : obsDatasetArr)
      {
         Dataset dataset = new Dataset();

         dataset.obsDataset = obsDataset;

         dataset.subsurvey_id   = obsDataset.obs_collection;
         dataset.overlapCodeSky = convertToOverlapCodeSky(obsDataset.inputInsideDb, obsDataset.dbInsideInput);
         dataset.overlapCodeVel = convertToOverlapCodeVel(coord, obsDataset.em_valid, obsDataset.em_min, obsDataset.em_max);
@@ -213,6 +239,7 @@ public class FormatResponseFilter implements Filter

         datasetList.add(dataset);
      }

      return datasetList.toArray(new Dataset[0]);
   }