IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35246


Ignore:
Timestamp:
Mar 6, 2013, 3:12:10 PM (13 years ago)
Author:
eugene
Message:

working on remote client mextract joins against image metadata

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130306/Ohana/src/opihi/dvo/mextract.c

    r35244 r35246  
    11# include "dvoshell.h"
     2
     3int SaveImageMetadata () {
     4
     5}
    26
    37int field_needs_images (dbField *field) {
     
    1620    if (field->ID == MEAS_CENTER_OFFSET)  return TRUE; // 0.5*NX, 0.5*NY
    1721    if (field->ID == MEAS_EXPNAME_AS_INT) return TRUE; // expname (or as int)
     22    mean airmass;
    1823    return FALSE;
    1924}
     
    124129  if ((skylist = SelectRegions (selection)) == NULL) goto escape;
    125130
     131  // load image data if needed (for fields listed below)
     132  loadImages = FALSE;
     133  for (i = 0; !loadImages && (i < Nfields); i++) {
     134    loadImages = field_needs_images (&fields[i]);
     135  }
     136   
    126137  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
    127138  if (PARALLEL && !HOST_ID) {
     139
     140    // Image Metadata for remote queries:
     141    // 1) figure out if we need any image metadata
     142    // 2) load the images and generate a subset table with just the fields of interest
     143    // 3) add the input subset filename to the dvo_client command
     144
     145    if (loadImages) {
     146      Image *image;
     147      off_t Nimage;
     148      if ((image = LoadImagesDVO (&Nimage)) == NULL) goto escape;
     149
     150      char *filename = abspath("image.metadata.fits", DVO_MAX_PATH);
     151      SaveImageMetadata (filename, image, Nimage);
     152      argc += 2;
     153      argv[argc-2] = strcreate ("-image-metadata");
     154      argv[argc-1] = strcreate (filename);
     155    }
     156
    128157    int status = HostTableParallelOps (argc, argv, RESULT_FILE, TRUE, 0, VERBOSE);
    129158
     
    134163    dvo_catalog_free (&catalog);
    135164
     165    if (loadImages) {
     166      free (argv[argc-1]);
     167      free (argv[argc-2]);
     168    }
     169
    136170    return status;
    137171  }
    138172
    139   // load image data if needed (for fields listed below)
    140   loadImages = FALSE;
    141   for (i = 0; !loadImages && (i < Nfields); i++) {
    142     loadImages = field_needs_images (&fields[i]);
    143   }
    144   if (loadImages && !SetImageSelection (TRUE, selection)) goto escape;
     173  if (REMOTE_CLIENT) {
     174    if (loadImages) {
     175      ImageMetadata = *imageMetadata = LoadImageMetadata (filename, &Nimages);
     176      if (!imageMetadata) goto escape;
     177      SetImageMetadata (imageMetadata, Nimages);
     178  } else {
     179    if (loadImages && !SetImageSelection (TRUE, selection)) goto escape;
     180  }
    145181
    146182  /* create storage vector */
Note: See TracChangeset for help on using the changeset viewer.