pro nsx_listing, listfile, imgfile, imgfile2 print, 'nsx_Listing not implemented' end ;void nsx_listing( char listfile[], char imgfile[], char imgfile2[] ) ;{ ;/**/ ;FILE *infu; ;FILE *infu2; ;FILE *outfu; ;/**/ ;char wrd[200]; ;char wrd1[80]; ;char wrd2[80]; ;char wrd3[80]; ;char wrd4[80]; ;char wrd5[80]; ;char wrd6[80]; ;char line[200]; ;char infile[200]; ;char ffile[200]; ;char datafile[100]; ;char object[100]; ;char obstype[100]; ;char targname[100]; ;char zulu[100]; ;/**/ ;double ra,dec,mjd,jd,hourang,airmass,exptime; ;/**/ ;fitsfile *fptr; ;/**/ ;int count,ii,hdutype,nc,nr; ;int status = 0; ;/**/ ; ;/* Set input file. */ ;if (cindex(imgfile,".ls") > 0) { ; strcpy(infile,imgfile); ;} else { ; strcpy(infile,"nsx_temp.ls"); ; outfu = fopen_write("nsx_temp.ls"); ; if (cindex(imgfile,".fits") > 0) { ; if (FileExist(imgfile)) { fprintf(outfu,"%s\n",imgfile); } ; } ; if (cindex(imgfile2,".fits") > 0) { ; if (FileExist(imgfile2)) { fprintf(outfu,"%s\n",imgfile2); } ; } ; fclose(outfu); ;} ;printf("Reading '%s'.\n\n",infile); ;/* Set output file unit. */ ;if (strcmp(listfile,"") == 0) { ; outfu = NULL; ;} else { ;if (strcmp(listfile,"stdout") == 0) { ; outfu = stdout; ;} else { ; outfu = fopen_write(listfile); ; printf("Writing listing file '%s'.\n",listfile); ;}} ; ;/* Read input file(s). */ ;count=0; ;infu = fopen_read(infile); ;while (fgetline(ffile,infu) == 1) { ;if (FileExist(ffile)&&(cindex(ffile,".fits") > 0)) { ;printf("ffile='%s'\n",ffile); ; fits_open_file( &fptr, ffile, READONLY, &status ); ; if (status != 0) { printf("***error: problem reading '%s'.\n",ffile); exit(1); } ; fits_movabs_hdu( fptr, 1, &hdutype, &status ); ; nc = cfua_inhead(fptr,"NAXIS1"); ; nr = cfua_inhead(fptr,"NAXIS2"); ; if ((nc != nc_Nominal)||(nr != nr_Nominal)) { printf("***error: unknown image size (%d x %d).\n",nc,nr); exit(1); } ; cfua_chead(fptr,"DATAFILE",datafile); misc_pad_blanks(datafile ,15,wrd1); ; cfua_chead(fptr,"OBJECT" ,object ); misc_pad_blanks(object ,20,wrd2); ; cfua_chead(fptr,"TARGNAME",targname); misc_pad_blanks(targname ,16,wrd3); ; cfua_chead(fptr,"OBSTYPE" ,obstype ); misc_pad_blanks(obstype ,12,wrd6); ; mjd = cfua_fhead(fptr,"MJD-OBS"); ; if (mjd > 0.) { ; jd = cfua_fhead(fptr,"MJD-OBS") + 2400000.5; ; } else { jd = 2086303.; } /* 1000-01-01T12:00:00.000 */ ; misc_julian_to_zulu(jd,zulu); ; ; cfua_chead(fptr,"RA" ,wrd); ; ra = -99.; ; if ((clc(wrd) > 3)&&(cindex(wrd,":") > 0)) { ra =misc_hmss2deci(wrd,1); } else { ; if ( clc(wrd) > 2) { ra =GLV(wrd,1); } } ; ; cfua_chead(fptr,"DEC" ,wrd); ; dec= -99.; ; if ((clc(wrd) > 3)&&(cindex(wrd,":") > 0)) { dec=misc_hmss2deci(wrd,0); } else { ; if ( clc(wrd) > 2) { dec=GLV(wrd,1); } } ; ; airmass = cfua_fhead(fptr,"AIRMASS"); if (airmass < -9.0) airmass=-9.; ; exptime = cfua_fhead(fptr,"ITIME"); if (exptime < -9.0) exptime=-9.; ; hourang = cfua_fhead(fptr,"HA"); if (hourang < -99.) hourang=-99.; ; fits_close_file( fptr, &status ); cfua_error(status); ; misc_pad_blanks(ffile,30,wrd4); ; ;/* comments? */ ; strcpy(wrd5,"..."); ; if (FileExist("comments")) { ; infu2 = fopen_read("comments"); ; while (fgetline(line,infu2)) { ; if (cindex(line,datafile) > -1) { ; ii = cindex(line,"#"); ; substrcpy_terminate(line,ii+1,clc(line),wrd5,0); ; } ; } ; fclose(infu2); ; } ; ;/* header? */ ; if (count%30 == 0) { ; if (outfu != NULL) { ;fprintf(outfu,"| UT | ra | dec |exptime |airmass| HA | datafile | object | targname | obstype | fits_file |\n"); ;/* 2016-07-19T15:03:44.467 123456789 123456789 12345678 1234567 1234567 123456789012345 12345678901234567890 1234567890123456 123456789012 123456789012345678901234567890 */ ; } ; } ; ++count; ; ; if (outfu != NULL) { ; fprintf(outfu," %s %9.5f %9.5f %8.2f %7.4f %7.3f %s %s %s %s %s %s \n",zulu,ra,dec,exptime,airmass,hourang,wrd1,wrd2,wrd3,wrd6,wrd4,wrd5); ; } ; ;}} ;fclose(infu); ;if ((outfu != NULL)&&(outfu != stdout)) { fclose(outfu); } ; ;return; ;} ;