IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13645


Ignore:
Timestamp:
Jun 5, 2007, 10:19:11 AM (19 years ago)
Author:
eugene
Message:

fixed error with non-unique skycell names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/sky_tessalation.c

    r13186 r13645  
    2525int sky_tessalation_triangles (FITS_DB *db, int level, int Nmax) {
    2626
    27   int i, j, Ndigit, Ntriangles, Nbase, Ntotal, Ltop, Nimages;
     27  int i, j, Ndigit, Ntriangles, Nbase, Ntotal, Ltop, Nout, Nimages;
    2828  double Ntop, fLtop;
    2929  SkyTriangle *base, *tri, *new;
     
    6060
    6161  // for each base triangle, subdivide the rest of the way and save
     62  Nout = 0;
    6263  for (i = 0; i < Nbase; i++) {
    6364    ALLOCATE (tri, SkyTriangle, 1);
     
    7475    for (j = 0; j < Ntriangles; j++) {
    7576      sky_triangle_to_image (&image[j], &tri[j]);
    76       snprintf (image[j].name, 32, format, j);
     77      snprintf (image[j].name, 32, format, Nout);
     78      Nout++;
    7779    } 
    7880    Nimages = Ntriangles;
     
    9395int sky_tessalation_squares (FITS_DB *db, int level, int Nmax) {
    9496
    95   int i, j, Ndigit, Ntriangles, Nbase, Ntotal, Ntop, Ltop, Nout, Nx, Ny;
     97  int i, j, Nname, Ndigit, Ntriangles, Nbase, Ntotal, Ntop, Ltop, Nout, Nx, Ny;
    9698  double fLtop;
    9799  SkyTriangle *base, *tri, *new;
     
    131133
    132134  // for each base triangle, subdivide the rest of the way and save
     135  Nname = 0;
    133136  for (i = 0; i < Nbase; i++) {
    134137    ALLOCATE (tri, SkyTriangle, 1);
     
    152155      if (!strcmp(image[j].coords.ctype, "DROP")) continue;
    153156      memcpy (&out[Nout], &image[j], sizeof(Image));
    154       snprintf (out[Nout].name, 32, format, j);
     157      snprintf (out[Nout].name, 32, format, Nname);
     158      Nname++;
    155159      Nout++;
    156160    } 
     
    249253int sky_subdivide_image (Image *output, Image *input, int Nx, int Ny) {
    250254
    251   int i, j, N, NX, NY;
     255  int i, j, N, NX, NY, Ndigit;
     256  char format[24];
    252257
    253258  NX = input[0].NX/(double)Nx + 0.5;
    254259  NY = input[0].NY/(double)Ny + 0.5;
     260
     261  Ndigit = (int)(log10(Nx*Ny)) + 1 ;
     262  snprintf (format, 24, "%s.%%0%dd", input[0].name, Ndigit);
    255263
    256264  N = 0;
     
    259267
    260268      memcpy (&output[N], &input[0], sizeof(Image));
     269      snprintf (output[N].name, 32, format, N);
    261270
    262271      // output[0].coords = input[0].coords;
Note: See TracChangeset for help on using the changeset viewer.