C+ C NAME: C HOSRunningMean C PURPOSE: C Subtracts a running mean from the Helios photometer data. C CATEGORY: C Data processing: Helios C CALLING SEQUENCE: program HOSRunningMean C INPUTS: C Normalized data files produced by the program CONNECT C OUTPUTS: C Filtered data file with the same name as input file, except for extension C CALLS: C iHOSInfo, HOSRead, HOSWrite, T_FILTER, Say, iGetFileSpec C INCLUDE: include 'hos_e9.h' include 'filparts.h' C RESTRICTIONS: C > If the input file contains 90 degree data, the 90 deg records should C be at the end of the file, AFTER the 15/30 degree data (if present). C If this is not the case not all records from the input file are C processed. CONNECT automatically takes care of this. C PROCEDURE: C > The input name should have a file name of the type XYrLF_doy.DAT, where C X=A/B for HELIOS A/B, Yr are two digits indicating the year of C observation, L=U,B,V depending on which color is used, F is the number C of the filter user for the 15-30 deg photom (F=9 if the file contains C only 90 deg photom data), doy is the day of year for the first data C point on the file, .DAT is the default extension for a normalized data file. C > This type file name is created automatically when using the program CONNECT.FOR C MODIFICATION HISTORY: C MAY-1989, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- parameter (MXC = 2000) ! Max # times read from input file parameter (NMAX = 32) ! Max # sectors parameter (NBUF = 1000) ! Buffer size used in T_FILTER integer NN (MXC) integer PP (MXC) integer CC (MXC) integer FF (MXC) integer SN (NMAX*NBUF) integer Lst(3,11) real TT (MXC) real RR (MXC) real LL (MXC) real ZZ (NMAX*MXC) real SF (NMAX*NBUF) real SFF(NMAX*NBUF) integer IDAY /-1/ integer NDEV /10/ real DSIG /1./ character cFileIn *80 character cFileOut*80 character cSay*14 /'HOSRunningMean'/ logical bOneCC logical bOneFF bOneCC(kC) = kC .eq. HOS__C_1 .or. kC .eq. HOS__C_2 .or. kC .eq. HOS__C_3 bOneFF(kF) = kF .eq. HOS__F_1 .or. kF .eq. HOS__F_2 .or. kF .eq. HOS__F_3 .or. kF .eq. HOS__F_4 .or. kF .eq. HOS__F_5 if (iHOSInfo(0,cFileIn,iRecl,iSc,iYr,TMin,TMax,kPCFall,Lst) .eq. 0) & call Say(cSay,'E',cFileIn,'Empty input file or read error') if (iand(kPCFall,HOS__NONORM) .ne. 0) & call Say(cSay,'W',cFileIn,'Data are not normalized') kC = iand(kPCFall,HOS__C_ALL) if (.not. bOneCC(kC)) call Say(cSay,'E',cFileIn,'Only one color allowed') NR = 0 if (iRecl .gt. 6) then ! Read the 15/30 degree data NS = iRecl-4.5 ! # sectors in file kPCF = kPCFall kPCF = kPCF-iand(kPCF,HOS__P_ALL)+HOS__P_12 ! Phot 1 & 2; single color call HOSRead(kPCF,cFileIn,MXC,NR,NN,TT,PP,CC,FF,RR,LL,NS,ZZ) if (NR .ne. 0) then kF = iand(kPCF,HOS__F_ALL) if (.not. bOneFF(kF)) call Say(cSay,'E',cFileIn,'Only one filter allowed') call T_FILTER(NR,NS,TT,ZZ,PP,IDAY,NDEV,DSIG,NBUF,SN,SF,SFF) end if end if if (NR .eq. 0 .or. kF .eq. HOS__F_CLR .or. kF .eq. HOS__F_PB) then if (NR .eq. 0) NS = 2 ! 90 deg photom 'sectors': Clr and pB NB = NR +1 NZ = NR*NS+1 kPCF = kPCFall kPCF = kPCF-iand(kPCF,HOS__P_ALL)+HOS__P_3 ! Phot 3, color ICOL call HOSRead(kPCF,cFileIn,MXC-NR,ICNT,NN(NB),TT(NB),PP(NB),CC(NB),FF(NB),RR(NB),LL(NB),NS,ZZ(NZ)) if (ICNT .ne. 0) then call T_FILTER(ICNT,NS,TT(NB),ZZ(NZ),PP(NB),IDAY,NDEV,DSIG,NBUF,SN,SF,SFF) NR = NR+ICNT end if end if if (NR .ne. 0) then ! No output file opened yet I = iGetFileSpec(0,FIL__NAME,cFileOut) write (cFileOut(I+1:I+4),'(A2,I2.2)') '.R',IDAY call HOSWrite(kPCF,cFileOut,MXC,NR,NN,TT,PP,CC,FF,RR,LL,NS,ZZ) call Say(cSay,'I',cFileOut,'averaged data written to file') end if end