source: lmdz_wrf/WRFV3/external/io_grib1/test_grib1_routines.F @ 1

Last change on this file since 1 was 1, checked in by lfita, 10 years ago
  • -- --- Opening of the WRF+LMDZ coupling repository --- -- -

WRF: version v3.3
LMDZ: version v1818

More details in:

File size: 2.2 KB
Line 
1
2PROGRAM test_grib1_routines
3  IMPLICIT NONE
4
5  CHARACTER, DIMENSION(:), POINTER :: fileindex
6  REAL     , DIMENSION(:), POINTER :: data
7  INTEGER :: fid
8  INTEGER :: err
9  INTEGER :: ret
10  INTEGER :: size
11  INTEGER :: index
12  INTEGER :: istat
13
14  INTEGER :: parmid
15  CHARACTER(40) :: datestr
16  INTEGER :: leveltype
17  INTEGER :: level1
18  INTEGER :: level2
19  INTEGER :: fcsttime1
20  INTEGER :: fcsttime2
21  character(200) :: value
22  character(20) :: strval
23  integer :: test
24  character(50) :: form
25  integer :: NumberTimes
26  character (19) :: Time
27  character (19), pointer  :: Times(:)
28  integer :: ierr
29  integer :: numcols, numrows
30  integer :: center, subcenter, parmtbl
31 
32
33  parmid=33
34  datestr = '2005041412'
35  leveltype = 119
36  level1 = 9965
37  level2 = -HUGE(1)
38  fcsttime1 = 0
39  fcsttime2 = -HUGE(1)
40  center = 250
41  subcenter = 2
42  parmtbl = 200
43
44  print *,'about to call GET_FILEINDEX_SIZE'
45  CALL GET_FILEINDEX_SIZE(size)
46  ALLOCATE(fileindex(1:size), STAT=istat)
47
48  print *,'about to call ALLOC_INDEX_FILE'
49  CALL ALLOC_INDEX_FILE(fileindex)
50  print *,'about to call OPEN_FILE'
51  CALL OPEN_FILE('test.grb','r',fid,err)
52  print *,'about to call INDEX_FILE'
53  CALL INDEX_FILE(fid,fileindex)
54
55  print *,'about to call GET_GRIB_INDEX'
56  CALL GET_GRIB_INDEX(fileindex, center, subcenter, parmtbl, &
57       parmid,trim(datestr),leveltype,level1,level2, &
58       fcsttime1,fcsttime2,index)
59  print *,'got grib index: ',index
60
61  print *,'about to call GET_METADATA_VALUE'
62  CALL GET_METADATA_VALUE(fileindex, 'GRIB_GRID_ID', "none", "none", &
63       Value, istat)
64
65  print *,'about to call GET_NUM_TIMES'
66  CALL GET_NUM_TIMES(fileindex, NumberTimes)
67  print *,'found ',NumberTimes,' times'
68
69  ALLOCATE(Times(1:NumberTimes), STAT=ierr)
70  print *,'about to call GET_TIME'
71  CALL GET_TIME(fileindex,1,Time)
72  print *,'Time: ',Time
73
74  print *,'about to call GET_SIZEOF_GRID'
75  CALL GET_SIZEOF_GRID(fileindex,index,numcols,numrows)
76  allocate(data(1:numcols*numrows))
77
78  print *,'about to call READ_GRIB'
79  CALL READ_GRIB(fileindex,fid,index,data)
80  print *,'data(20): ',data(20)
81
82  deallocate(data)
83
84  print *,'about to call FREE_INDEX_FILE'
85  CALL FREE_INDEX_FILE(fileindex)
86
87  print *,'program completed'
88
89END PROGRAM
Note: See TracBrowser for help on using the repository browser.