Close

Service Interruption

Sample FORTRAN Program

This sample FORTRAN program reads the Arctic Water Vapor Characteristics from Rawinsondes data set into memory and outputs precipitable water for the surface to 300 mb layer in June.


C     ********************
C     *** cwvread.for ***
C     ******************************************************
C     *** THIS CODE READS A MONTHLY CWV FILE AND OUTPUTS ***
C     *** A FILE CONTAINING LATITUDE, LONGITUDE, AND     ***
C     *** PRECIPITABLE WATER (SURF TO 300 MB).           ***
C     ******************************************************
      program cwvread

C     *************************
C     *** DECLARE VARIABLES ***
C     *************************
      implicit none
      integer i,j,k,r,c,rows,cols,nlevels,nbins
      parameter (cols=17,rows=17,nlevels=15,nbins=5)
      real lat(rows,cols),lon(rows,cols),prwv(rows,cols),
     *geop(rows,cols,nlevels),temp(rows,cols,nlevels),
     *q(rows,cols,nlevels),qu(rows,cols,nlevels),
     *qv(rows,cols,nlevels),u(rows,cols,nlevels),
     *v(rows,cols,nlevels),press(rows,cols,nlevels),
     *qint(rows,cols,nbins),quint(rows,cols,nbins),
     *qvint(rows,cols,nbins)

C     *******************************
C     *** OPEN FILES:             ***
C     *** INPUT  - 'cwv_jun.dat'  ***
C     *** OUTPUT - 'jun.out'      ***
C     *******************************
      open (unit=1,file='cwv_jun.dat',status='old')
      open (unit=2,file='jun.out',status='unknown')

C     ********************************************************
C     *** INPUT CWV FILE AND SUMMATE VERTICALLY INTEGRATED ***
C     *** BINS OF PRECITABLE WATER TO 300 MB.              ***
C     ********************************************************
      do i=1,rows
        do j=1,cols
          read (1,101) r,c,lat(i,j),lon(i,j)
          do k=1,nlevels
            read (1,102) press(i,j,k),temp(i,j,k),
     *      q(i,j,k),qu(i,j,k),qv(i,j,k),
     *      u(i,j,k),v(i,j,k),geop(i,j,k)
          end do
          prwv(i,j)=0.0
          do k=1,nbins
            read (1,103) qint(i,j,k),quint(i,j,k),qvint(i,j,k)
            if (qint(i,j,k) .ne. -999) prwv(i,j)=prwv(i,j)+qint(i,j,k)
          end do
          if (prwv(i,j) .eq. 0.0) prwv(i,j)=-999.0
        end do
      end do

C     ****************************************************
C     *** WRITE PRECIPITABLE WATER (SURFACE TO 300 mb) ***
C     *** TO THE OUTPUT FILE.                          ***
C     ****************************************************
      do i=1,rows
        do j=1,cols
          write (2,104) lat(i,j),lon(i,j),prwv(i,j)
        end do
      end do
        
C     ********************
C     *** FORMAT SPECS ***
C     ********************
      close (unit=1)
      close (unit=2)
101   format (2(i2,1x),2(f8.3,1x))
102   format (8(f8.3,1x))
103   format (3(f8.3,1x))
104   format (2(f8.3,1x),f9.4)

      end