reading WPS intermediate file format

Dataset specific topics involving WPS.

reading WPS intermediate file format

Postby joegrim » Tue Apr 23, 2013 11:36 am

Hi,

Does anyone have a simple example of code that reads in data in the WPS intermediate format? I tried to follow the FORTRAN write example shown here:
http://www.mmm.ucar.edu/wrf/OnLineTutor ... index.html
However, I don't get "5" for the file version, like I should. I also get an end of file error reading in the second line of the header.

Thank you in advance for your help.

In case my problem is something obvious (to others), here is my code so far, compiled using pgf90:

program sample_read
! Fortran 90 version.

! This is a simple program to read data in the WPS intermediate
! format.

IMPLICIT NONE

! Declarations:

INTEGER, PARAMETER :: IUNIT = 10
INTEGER :: ierr
INTEGER :: IFV
CHARACTER(LEN=128) :: fname
CHARACTER(LEN=24) :: HDATE
REAL :: XFCST
CHARACTER(LEN=9) :: FIELD
CHARACTER(LEN=25) :: UNITS
CHARACTER(LEN=46) :: DESC
CHARACTER(LEN=32) :: MAP_SOURCE
REAL :: XLVL
INTEGER :: NX
INTEGER :: NY
INTEGER :: IPROJ

fname = '/d2/ATEC/GSL_SST_stuff/SST:2013-04-21_00'
OPEN(IUNIT,FILE=TRIM(fname),FORM="UNFORMATTED")

READ (IUNIT) IFV
PRINT *,IFV

READ (IUNIT) HDATE, XFCST, MAP_SOURCE, FIELD, UNITS, DESC, XLVL, NX, NY, IPROJ
PRINT *,HDATE, XFCST, MAP_SOURCE, FIELD, UNITS, DESC, XLVL, NX, NY, IPROJ

CLOSE(IUNIT)
end program sample_read
joegrim
 
Posts: 6
Joined: Wed May 20, 2009 5:27 pm

Re: reading WPS intermediate file format

Postby joegrim » Tue Apr 23, 2013 11:44 am

Someone told me my error: I needed to add "-byteswapio" to my compile statement, like this:
pgf90 -byteswapio readWPS.f90
joegrim
 
Posts: 6
Joined: Wed May 20, 2009 5:27 pm


Return to Working with Various Datasets

Who is online

Users browsing this forum: No registered users and 4 guests