program obs_format !********************************************************************** ! * . . . ! * PROGRAM: obs_format ! * PRGMMR: M. ZUPANSKI ORG: CIRA/CSU DATE: 2003-09-09 ! * ! * ABSTRACT: Prepare formated x1d file, suitable for plotting ! * ! * PROGRAM LOG: ! * ! * 09/09/2003 ..... M. ZUPANSKI: Original 'transform.F' ! * 10/17/2003 ..... M. ZUPANSKI: Innovation normalization ! * 10/22/2003 ..... M. ZUPANSKI: Innovation histogram ! * 10/22/2003 ..... M. ZUPANSKI: plotting ! * 12/05/2003 ..... M. ZUPANSKI: observation plotting ! * ! ********************************************************************** !----- integer,parameter::idim=20 ! model dimensions integer,parameter::in_file=21 ! unformatted x1d file # integer,parameter::iaddress=22 ! address file integer,parameter::out_file=51 ! formatted x1d file # !----- integer :: N_model,N_obs real,dimension(:),allocatable::x1d,x1d_plot integer,dimension(:),allocatable::y_loc !----- integer, dimension(1) :: NNXP,NNYP,NNZP,NNSOIL,NNSNOW character(len=30) :: filename character(len=9) :: fgname !----- NAMELIST /MODEL_DIMENSION/ NNXP,NNYP,NNZP,NNSOIL,NNSNOW !==============start calculation=================== !==============start calculation=================== !--- get model dimensions write(filename,200) 200 format('model_dimension.name') CLOSE(500) OPEN(UNIT=500,FILE=filename,FORM='FORMATTED',IOSTAT=IER) IF(IER.NE.0) WRITE(*,*)' 500 OPEN UNIT ERROR IER=',IER READ(500,MODEL_DIMENSION) CLOSE(500,STATUS='KEEP') write(*,*) "NNXP=",NNXP(1)," NNYP=",NNYP(1)," NNZP=",NNZP(1) !----------------------------------------- N_model=NNXP(1) !-- read in unformatted obs file rewind in_file read(in_file) N_obs allocate(x1d(1:N_obs)) read(in_file) x1d do i=1,N_obs write(*,*) i," input obs=",x1d(i) end do !-- read in address file rewind iaddress read(iaddress) fgname read(iaddress) icount write(*,*) "icount=",icount if(icount.ne.N_obs) then write(*,*) "obs_plot: DIMENSIONS PROBLEM! icount,N_obs=",icount,N_obs stop end if allocate(y_loc(1:N_obs)) read(iaddress) y_loc do i=1,N_obs write(*,*) i," input address=",y_loc(i) end do !---- get obs at model points ----- allocate(x1d_plot(1:N_model)) do i=1,N_obs x1d_plot(y_loc(i))=x1d(i) end do deallocate(x1d) ; deallocate(y_loc) !---------------------------------- do i=1,N_model write(*,*) i," obs=",x1d_plot(i) end do !-- write formatted file rewind out_file do i=1,N_model write(out_file,100) x1d_plot(i) end do 100 format(E20.10) stop end