SUBROUTINE VGTSAA ( * * inputs * : FNAMES, NFILES, NX, NY, * * outputs * : INMID, IP, STATUS) * * Module number: * * Module name: * * Keyphrase: * ---------- * read particle monitor accumulation files * * Description: * ------------ * read the following three particle monitor files: * (1) number of (accumulated) points (i.e. observations) * (2) mean count rate * (3) standard deviation * if these files do not exist, this routine will create them * * the dimensions of these files must match what are specified from the calling * program * * FORTRAN name: VGTSAA.FOR * * Keywords of accessed files and tables: * -------------------------------------- * Name I/O Description / Comments * * Subroutines Called: * ------------------- * CDBS: * None * SDAS: * UMSPUT * Others: * None * * History: * -------- * Version Date Author Description * 1 02-28-88 J.-C. HSU coding * *------------------------------------------------------------------------------- * *== input: * --name of accumulated particle monitor * --data files CHARACTER*(*) FNAMES(1) * --number of files INTEGER NFILES, * --dimension of the files : NX, NY * *== output: * --image descripters INTEGER INMID(1), * --dynamic memory pointer : IP(1), * --error status : STATUS * *== local: * INTEGER I, J, K, STATOK, * --input file data type : DTYPE, * --input file number of axis : NAXIS, * --input file dimensions : DIMEN(7) LOGICAL EXIST CHARACTER*130 CONTXT, MESS * *------------------------------------------------------------------------------ *==========================begin iraf77.inc (without INTEGER*2)================= * Include file for the iraf77 FORTRAN interface to the IRAF VOS * Get IRAF common into main program * LOGICAL MEMB(1) INTEGER MEMI(1) INTEGER MEML(1) REAL MEMR(1) DOUBLE PRECISION MEMD(1) COMPLEX MEMX(1) EQUIVALENCE (MEMB, MEMI, MEML, MEMR, MEMD, MEMX) COMMON /MEM/ MEMD * * File I/O access modes * INTEGER RDONLY PARAMETER (RDONLY = 1) INTEGER RDWRIT PARAMETER (RDWRIT = 2) INTEGER WRONLY PARAMETER (WRONLY = 3) INTEGER APPEND PARAMETER (APPEND = 4) INTEGER NEWFIL PARAMETER (NEWFIL = 5) INTEGER TMPFIL PARAMETER (TMPFIL = 6) INTEGER NEWCPY PARAMETER (NEWCPY = 7) INTEGER NEWIMG PARAMETER (NEWIMG = 5) * * codes for data types * INTEGER TYBOOL PARAMETER (TYBOOL = 1) INTEGER TYCHAR PARAMETER (TYCHAR = 2) INTEGER TYSHOR PARAMETER (TYSHOR = 3) INTEGER TYINT PARAMETER (TYINT = 4) INTEGER TYLONG PARAMETER (TYLONG = 5) INTEGER TYREAL PARAMETER (TYREAL = 6) INTEGER TYDOUB PARAMETER (TYDOUB = 7) INTEGER TYCPLX PARAMETER (TYCPLX = 8) INTEGER TYUSHT PARAMETER (TYUSHT = 11) INTEGER TYUBYT PARAMETER (TYUBYT = 12) * * TYTEXT is a special code for the iraf77 interface; it is not in the VOS * INTEGER TYTEXT PARAMETER (TYTEXT = 13) *========================end iraf77.inc========================================= *=========================begin hsp.inc========================================= * --status return code INTEGER OK, ERRNUM(20) INTEGER DEST, PRIO DATA OK /0/ DATA ERRNUM /701, 702, 703, 704, 705, 706, 707, 708, 709, 710, : 711, 712, 713, 714, 715, 716, 717, 718, 719, 720/ * --message destination and priority DATA DEST, PRIO /1, 0/ *=========================end hsp.inc=========================================== * DO 30 I = 1, NFILES * * check existence of files * CALL UUFACC (FNAMES(I), EXIST, STATOK) * * allocate dynamic memories * CALL UDMGET (NX*NY, TYREAL, IP(I), STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot allocate dynamic memory' GO TO 999 END IF * * if file does exist ... * IF (EXIST) THEN * * open file, read size info and compare with the input specification * CALL UIMOPN (FNAMES(I), RDWRIT, INMID(I), STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot open file ' // FNAMES(I) GO TO 999 END IF * CALL UIMGID (INMID(I), DTYPE, NAXIS, DIMEN, STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot get image description of file ' : // FNAMES(I) GO TO 999 END IF * * check if the dimensions are consistent with the input dimensions * IF (NAXIS .NE. 2 .OR. NX .NE. DIMEN(1) .OR. : NY .NE. DIMEN(2)) THEN CONTXT = 'dimensions in the file header are ' : // 'incorrect' GO TO 999 END IF * * read the data * DO 10 J = 1, NY K = (J - 1) * NX CALL UIGL2R (INMID(I), J, MEMR(IP(I)+K), STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'error reading data from file ' // : FNAMES(I) GO TO 999 END IF 10 CONTINUE * * if file does not exist, create one * ELSE DIMEN(1) = NX DIMEN(2) = NY CALL UIMCRE (FNAMES(I), TYREAL, 2, DIMEN, INMID(I), : STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'error creating file ' // FNAMES(I) GO TO 999 END IF * * initialize file to zeros * DO 20 J = 1, NX*NY MEMR(IP(I)+J-1) = 0. 20 CONTINUE END IF 30 CONTINUE * GO TO 1000 * 999 MESS = 'VGTSAA: ' // CONTXT CALL UMSPUT (MESS, DEST, PRIO, STATOK) * 1000 RETURN END