IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35735


Ignore:
Timestamp:
Jul 2, 2013, 9:12:29 AM (13 years ago)
Author:
eugene
Message:

get primary skycell info from boundary tree via projID/skycellID

Location:
branches/eam_branches/ipp-20130509/Ohana/src/relphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/BoundaryTreeOps.c

    r34844 r35735  
    77
    88int BoundaryTreePrimaryCell (char *primaryCellName, double ra, double dec) {
     9
     10  int zone, band;
     11
     12  if (!primaryCellName) return FALSE;
     13
     14  primaryCellName[0] = 0;
     15
     16  if (!tree) return FALSE;
     17
     18  if (!BoundaryTreeCellCoords (tree, &zone, &band, ra, dec)) {
     19    fprintf (stderr, "mismatch!\n");
     20    return FALSE;
     21  }
     22 
     23# define USE_PROJECTION_CELL 0
     24# if (USE_PROJECTION_CELL)
     25  snprintf (primaryCellName, DVO_MAX_PATH, "RINGS.V3.%s", tree->name[zone][band]);
     26# else
     27
     28  // I have ra, dec, and the primary projection cell.  In order to choose the primary skycell,
     29  // I just need to project to ra,dec to X,Y based on the center of the cell and then get the subdivision right.
     30   
     31  double x = 0.0;
     32  double y = 0.0;
     33  BoundaryTreeProjection (&x, &y, ra, dec, tree, zone, band);
     34 
     35  int xi = x / tree->dX[zone][band];
     36  int yi = y / tree->dY[zone][band];
     37  int N = xi + tree->NX_SUB * yi;
     38 
     39  // XXX short-circuit this for now (we should use this code if we make tree have more variable NX,NY values
     40  // char format[24], skycellname[128];
     41  // int Ndigit = (int)(log10(tree->NX_SUB*tree->NY_SUB)) + 1 ;
     42  // snprintf (format, 24, "%s.%%0%dd", tree->name[zone][band], Ndigit);
     43  // snprintf (skycellname, 128, format, N);
     44
     45  snprintf (primaryCellName, DVO_MAX_PATH, "RINGS.V3.%s.%03d", tree->name[zone][band], N);
     46# endif
     47
     48  return TRUE;
     49}
     50
     51int BoundaryTreePrimaryCellIDs (int *projID, int *skycellID, double ra, double dec) {
    952
    1053  int zone, band;
  • branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/ImageOps.c

    r35604 r35735  
    414414// returns image.Mcal - ff(x,y)
    415415int MatchImageName (off_t meas, int cat, char *name) {
     416
     417  off_t i;
     418
     419  if (!name) return FALSE;
     420  if (!name[0]) return FALSE;
     421
     422  if (!MeasureToImage) return FALSE;
     423
     424  i = MeasureToImage[cat][meas];
     425  if (i == -1) return FALSE;
     426
     427  // this is a bit crude: stack image names are of the form:
     428  // RINGS.V3.skycell.1495.027.sky.191211.stk.988232.cmf.
     429
     430  // the primaryCell has a name of the form RINGS.V3.skycell.1495 or RINGS.V3.skycell.1495.027
     431  // (if we use projection or skycell as the primary)
     432
     433  if (!strncmp(image[i].name, name, strlen(name))) return TRUE;
     434  return FALSE;
     435}
     436
     437// returns image.Mcal - ff(x,y)
     438int MatchImageSkycellID (off_t meas, int cat, char *name) {
    416439
    417440  off_t i;
Note: See TracChangeset for help on using the changeset viewer.