/* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* imlist.c List image blocks needed to extract an image at a given * RA,Dec from a specified plate. This can be used if the * CDROM cannot be directly accessed as a file-structured * device. The procedure would be: * (1) Copy the header for the plate to be used to a directory * on disk (plate.hhh). * (2) Run imlist to get a list of the files which will be * required. * (3) Copy the needed files from CD to disk using whatever * procedures are available for reading the CD. * (4) Run imextrct to extract the image from the copied * files. * * Inputs from terminal (stdin): * plate name of plate (e.g. s840) * RA, Dec position of source in J2000 or B1950 coordinates * equinox equinox of position * nx,ny size of section to extract * * Inputs from command line: * plate_root partial name of directory where plates are located * header_dir directory where headers are located * compression compression factor ("low", "medium", or "high") * * Programmer: R. White Date: 6 August 1991 * * */ #include #include #include #include "header.h" extern void pltlist(); extern int gethdr(); extern void condmsrd(); extern void conrddms(); extern void b1950_j2000(); extern int listradec(); main (argc, argv) int argc; char *argv[]; { Header header; int nx, ny; int equinox,rah,ram,decd,decm; float ras,decs; char decsign; double in_ra, in_dec, ra, dec; /* * set plate directory, header directory, compression factor, and * plate name in header structure using command line parameters */ if (argc != 4) { fprintf(stderr, "Usage: %s plate-directory header-directory compression-factor\n", argv[0]); exit(0); } strcpy(header.plate_root, argv[1]); strcpy(header.header_dir, argv[2]); strcpy(header.compression, argv[3]); /* * list plates that are available */ pltlist(); fprintf(stderr, "Enter plate name: "); fscanf(stdin, " %s", header.plate_name); /* * read header file for this plate */ if (gethdr(&header)) { fprintf(stderr, "Could not read header for plate %s\n", header.plate_name); exit(0); } /* * get RA, Dec and convert to radians */ fprintf(stderr, "Enter target RA & Dec (hh mm ss.sss +dd mm ss.sss): "); fscanf(stdin, " %d %d %f %c%d %d %f", &rah,&ram,&ras, &decsign,&decd,&decm,&decs); if (decsign != '-') decsign = '+'; condmsrd(rah,ram,ras,decsign,decd,decm,decs, &in_ra, &in_dec); /* * precess position to 2000 if necessary */ fprintf(stderr, "Enter equinox for coordinates (1950 or 2000): "); fscanf(stdin, " %d", &equinox); if (equinox == 1950) { b1950_j2000(in_ra,in_dec,&ra,&dec); conrddms(ra,dec, &rah,&ram,&ras, &decsign,&decd,&decm,&decs); fprintf(stderr, "J2000: %2.2d %2.2d %6.3f %c%2.2d %2.2d %5.2f\n", rah,ram,ras, decsign,decd,decm,decs); } else if (equinox == 2000) { ra = in_ra; dec = in_dec; } else { fprintf(stderr, "Equinox must be 1950 or 2000\n"); exit(0); } /* * get section size */ fprintf(stderr, "Enter desired image size (nx ny): "); fscanf(stdin, " %d %d", &nx, &ny); /* * list files needed for this image section */ if (listradec(&header,ra,dec,nx,ny)) { fprintf(stderr, "Image files not listed\n"); exit(0); } exit(1); }