OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
rdgrid.f
Go to the documentation of this file.
1  subroutine rdgrid(filename, type, ozone, julval, year,
2  . start, end, acntime, rval)
3 c ********************************************************************
4 c Routine reads the daily gridded data from real-time
5 c Meteor-3/TOMS, TOVS, EPTOMS or ADTOMS.
6 c
7 c Program derived from TOMS project program RDGRID.FOR
8 c filename character I text file with ozone values
9 c type integer I type 0 = TOMS, 1 = TOVS, and 2 = EPTOMS
10 c 3 = ADTOMS
11 c ozone integer*2 O ozone array/ozone
12 
13 c
14 c Brian Schieber, SAIC/GSC 3/93
15 c Mods:
16 c BDS, 4/23/93 - ozone array set at integer*2
17 c BDS, 9/29/95 - support reading start/end times from file.
18 c TOVS files have 1 extra header line for Start/End times:
19 c Start_Time: 1995123010101001 End_Time: 1995321010101001
20 c *** Therefore TOMS format not currently supported *****
21 c BDS, 9/3/96 - support reading new EPTOMS file
22 c - add "TYPE" (integer) argument for "TOMS" or "TOVS"
23 c BDS, 9/12/96 - support three types: TOMS, TOVS, and EPTOMS
24 c - add Ascention time Metadata for EPTOMS data type.
25 c Example header for each of the types:
26 c TOMS:
27 c [ Day: 100 April 10, 1993 Real Time Nimbus-7 TOMS]
28 c TOVS:
29 c [ Day: 274 October 1, 1995 Real Time NOAA TOVS]
30 c [ Start_Time: 1995273183828000 End_Time: 1995275071153000]
31 c EPTOMS:
32 c [ Day: 247 Sep 3, 1996 Near Realtime EP/TOMS OZONE Asc LECT: 11:16 AM]
33 c ADTOMS:
34 c [ Day: 255 Sep 11, 1996 Near Realtime ADEOS/TOMS OZONE Asc LECT: 10:41 PM]
35 c ********************************************************************
36 
37 c incoming args and local variables
38 
39  character filename*(*)
40  character header*80
41  integer type
42  integer*2 ozone
43  integer rval
44  integer julval
45  integer year
46  character month*8
47  character acntime*8
48  character day*2
49  character start*(*)
50  character end*(*)
51  dimension ozone(360,180)
52 c
53 c open the input file
54 c
55  open(1,file=filename,status='old', err=998)
56 c
57 c read 3 header lines, skipping last 2
58 c
59 c type = 0, TOMS type = 1, TOVS, type = 2, EPTOMS, type = 3,ADTOMS
60  if (type .EQ. 0) then ! TOMS
61  read(1, 10) julval, month, day, year
62  10 format(6x, i3, 1x, a3, 1x, a2, 2x, i4)
63  acntime = ""
64  else if (type .EQ. 1) then ! TOVS
65  read(1, 15) julval, month, day, year
66 15 format(6x, i3, 6x, a8, 1x, a2, 2x, i4)
67  read(1, 20) start, end
68 20 format(13x, a16, 12x, a16)
69  acntime = ""
70  else if ((type .EQ. 2) .OR. (type .EQ. 3)) then ! EPTOMS or ADTOMS
71  read(1, 40) julval, month, day, year, acntime
72 40 format(6x, i3, 1x, a3, 1x, a2, 2x, i4, 49x, a8)
73  else
74  print *,
75  1'Error in rdgrid.f, TYPE not "TOMS", "TOVS", "EPTOMS" or "ADTOMS"'
76  rval = 1
77  return
78  end if
79 
80 c print *, 'julian ', julval
81 c print *, 'month [', month,']'
82 c print *, 'day [', day,']'
83 c print *, 'year ', year
84 
85 c if (type .EQ. 1) then
86 c print *, 'start ', start
87 c print *, 'end ', end
88 c endif
89 
90  if ((type .EQ. 2) .OR. (type .EQ. 3)) then
91 c print *,'acntime [',acntime,']'
92  if( ( acntime(8:8) .NE. 'M' ) .AND. ( acntime(8:8) .NE. 'm' ) ) then
93  rval = 1
94  close(1)
95  return
96  endif
97  endif
98 
99  read(1,'(a80)') header
100  read(1,'(a80)') header
101 c
102 c read in the data into the array ozone
103 c store in West to East, North to South order
104 c (ASCII files in South to North so swap)
105 c
106  do 30 i=180,1,-1
107  read(1,'(1x,25i3)') (ozone(j,i),j=1,360)
108 30 continue
109 
110  close(1)
111  goto 999
112  998 continue
113 
114  print *,'Error reading file ',filename
115  rval = 1
116  return
117 
118  999 continue
119  rval = 0
120  return
121  end
subroutine rdgrid(filename, type, ozone, julval, year, start, end, acntime, rval)
Definition: rdgrid.f:3