program inflation_factor !********************************************************************** ! * . . . ! * PROGRAM: INFLATION_FACTOR ! * PRGMMR: D. ZUPANSKI ORG: CIRA/CSU DATE: 2004-07-02 ! * ! * ABSTRACT: CALCULATE INFLATION FACTOR ALPHA TO SATISFY CHI-SQUARE TEST ! * ! * PROGRAM LOG: ! * ! * 10/21/2003 ..... M. ZUPANSKI: ! * ! ********************************************************************** !---------------------------------- ! INPUT: ! x_innov - Innovations ! ! OUTPUT: ! alpha=sqrt((2.*J_obs-N_obs)/traceA) ! !---------------------------------- !----- integer,parameter::icost=20 ! input file # integer,parameter::ifile1=21 ! input file # integer,parameter::ifile2=22 ! input file # integer,parameter::infl_factor=51 ! output file # !----- integer :: N_obs real :: alpha,obsinf_cont real,dimension(:),allocatable:: x_innov real :: COST_obs,COST_pen,COST_b,COST_total !----- !==============start calculation=================== !-- read control residuals (innovations) rewind ifile1 read(ifile1) N_obs allocate(x_innov(1:N_obs)) read(ifile1) x_innov write(*,*) "N_obs=",N_obs CLOSE(icost) OPEN(UNIT=icost,FILE='outcostc',FORM='FORMATTED',IOSTAT=IER) READ(icost,200) ii,COST_obs,COST_pen,COST_b,COST_total CLOSE(icost,STATUS='KEEP') 200 FORMAT(I5,4E20.10) !-- read traceA--------------- rewind ifile2 read(ifile2,*) obsinf_cont !----alpha-------------------- alpha=sqrt((2.*COST_total/N_obs)/obsinf_cont) alpha=10.*alpha rewind infl_factor write(infl_factor,*) alpha write(*,*) " Inflation factor alpha=",alpha end program inflation_factor