PROGRAM SAMPLE


#include "TKHEADERS.h"
#include "TK_3GPROF.h"
#include "tkiofortdeclare.h"


RECORD /TKINFO/ granuleHandle3GPROF

RECORD /L3GPROF_GRID/ L3GPROF

	INTEGER status
!	INTEGER iscan, iangle, irange
	INTEGER nlat, nlon 
	CHARACTER*255 jobname, file

        REAL*4 surfacePrecipitation(720,1440)

	call getarg( 1, jobname )
	call getarg( 2, file )

! 	Open the file for reading.
        !status = TKopen( file, '3GPROF', TKREAD, 'HDF5', jobname, granuleHandle3GPROF, 0 )
        status = TKopen( file, '3GPROF', TKREAD, 'NETCDF4', jobname, granuleHandle3GPROF, 0 )
        IF ( status .NE. TK_SUCCESS ) THEN 
		status = TKmessage( granuleHandle3GPROF.jobname, TKERROR,'message to print' )
	ENDIF

!       Grid data read
	status = TKreadGrid( granuleHandle3GPROF, L3GPROF )

        do nlat=1, 720 
            do nlon=1, 1440 
                ! surfacePrecipitation Read
                surfacePrecipitation(nlat, nlon) = L3GPROF.surfacePrecipitation(nlat,nlon)

                ! print the value
                IF(nlat .eq. 410 .and. nlon .eq. 1110 ) THEN
                    write(*,*) "nlat=",nlat-1,"nlon=",nlon-1
                    write(*,*) "surfacePrecipitation=",surfacePrecipitation(nlat, nlon), "(mm/h)" 
                ENDIF
            enddo
        enddo

!       HDF file close
	status = TKclose( granuleHandle3GPROF )
	STOP
END
	
