IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27262 for trunk/Ohana


Ignore:
Timestamp:
Mar 12, 2010, 9:26:52 AM (16 years ago)
Author:
eugene
Message:

more flexible def of skycoverage map (not much of an improvement)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/skycoverage.c

    r25757 r27262  
    88  int i, N, Nimage, status, TimeSelect, ByName, xs, ys;
    99  time_t tzero, tend;
    10   double pixscale, dX, dY, Npts, r, d, Xi, Yi, Xs, Ys, x[2], y[2], trange, RaCenter;
     10  double pixscale, dX, dY, Npts, r, d, Xi, Yi, Xs, Ys, x[2], y[2], trange, RaCenter, DecCenter;
    1111  Image *image;
    12   char name[256];
     12  char name[256], projection[16];
    1313  float *V;
    1414  int Nx, Ny;
     
    3333
    3434  RaCenter = 0.0;
    35   if ((N = get_argument (argc, argv, "-ra-center"))) {
     35  DecCenter = 0.0;
     36  if ((N = get_argument (argc, argv, "-center"))) {
    3637    remove_argument (N, &argc, argv);
    3738    RaCenter = atof (argv[N]);
     39    remove_argument (N, &argc, argv);
     40    DecCenter = atof (argv[N]);
     41    remove_argument (N, &argc, argv);
     42  }
     43
     44  Nx = 0;
     45  Ny = 0;
     46  if ((N = get_argument (argc, argv, "-size"))) {
     47    remove_argument (N, &argc, argv);
     48    Nx = atof (argv[N]);
     49    remove_argument (N, &argc, argv);
     50    Ny = atof (argv[N]);
     51    remove_argument (N, &argc, argv);
     52  }
     53
     54  pixscale = 1.0;
     55  if ((N = get_argument (argc, argv, "-scale"))) {
     56    remove_argument (N, &argc, argv);
     57    pixscale = atof (argv[N]);
    3858    remove_argument (N, &argc, argv);
    3959  }
     
    4565    remove_argument (N, &argc, argv);
    4666    ByName = TRUE;
     67  }
     68
     69  strcpy (projection, "DEC--AIT");
     70  if ((N = get_argument (argc, argv, "-proj"))) {
     71    remove_argument (N, &argc, argv);
     72    if (!strcasecmp(argv[N], "TAN")) {
     73        strcpy (projection, "DEC--TAN");
     74    }   
     75    if (!strcasecmp(argv[N], "SIN")) {
     76        strcpy (projection, "DEC--SIN");
     77    }   
     78    if (!strcasecmp(argv[N], "GLS")) {
     79        strcpy (projection, "DEC--GLS");
     80    }   
     81    if (!strcasecmp(argv[N], "PAR")) {
     82        strcpy (projection, "DEC--PAR");
     83    }   
     84    remove_argument (N, &argc, argv);
    4785  }
    4886
     
    100138  }
    101139 
    102   if (argc != 4) {
    103     gprint (GP_ERR, "USAGE: skycoverage (buffer) (pixscale) (Npts)\n");
    104     gprint (GP_ERR, "  options: [-time start range] [-trange start stop] [-name name] [-photcode name] [+mosaic] [-mosaic] [-ra-center RA]\n");
    105     gprint (GP_ERR, "       (buffer) saves bitmapped AIT plot\n");
    106     gprint (GP_ERR, "       (pixscale) specifies the pixel size in degrees\n");
     140  if (argc != 3) {
     141    gprint (GP_ERR, "USAGE: skycoverage (buffer) (Npts)\n");
     142    gprint (GP_ERR, "  options: [-scale pixscale] [-center ra dec] [-size Nx Nx] [-proj projection] [-time start range] [-trange start stop] [-name name] [-photcode name] [+mosaic] [-mosaic]\n");
     143    gprint (GP_ERR, "       (buffer) saves bitmapped image\n");
    107144    gprint (GP_ERR, "       (Npts) gives the number of test points per image in each dimension\n");
     145    gprint (GP_ERR, "       -scale (pixscale)  : specifies the pixel size in degrees [1.0]\n");
     146    gprint (GP_ERR, "       -center (ra) (dec) : specifies the center of the field [0.0, 0.0]\n");
     147    gprint (GP_ERR, "       -size (Nx) (Ny)    : specifies the size of the image [360/scale, 180/scale]\n");
     148    gprint (GP_ERR, "       -proj (projection) : specifies the projection choice [AIT]\n");
    108149    gprint (GP_ERR, "       note: we need 64800 / (pixscale)^2 pixels to represent the sky\n");
    109150    return (FALSE);
     
    111152 
    112153  if ((buf = SelectBuffer (argv[1], ANYBUFFER, TRUE)) == NULL) return (FALSE);
    113   pixscale = atof(argv[2]);
    114   Npts     = atof(argv[3]);
    115 
    116   Nx = 360/pixscale;
    117   Ny = 180/pixscale;
     154  Npts = atof(argv[2]);
     155
     156  if (!Nx || !Ny) {
     157    Nx = 360/pixscale;
     158    Ny = 180/pixscale;
     159  }
    118160
    119161  gfits_free_matrix (&buf[0].matrix);
     
    123165
    124166  coords.crval1 = RaCenter;
    125   coords.crval2 = 0;
     167  coords.crval2 = DecCenter;
    126168  coords.crpix1 = 0.5*Nx;
    127169  coords.crpix2 = 0.5*Ny;
    128   strcpy (coords.ctype, "DEC--AIT");
     170  strcpy (coords.ctype, projection);
    129171  coords.pc1_1 = -1.0;
    130172  coords.pc2_2 = +1.0;
Note: See TracChangeset for help on using the changeset viewer.