source: trunk/SRC/ToBeReviewed/LECTURE/GRIB/read_gribtable.pro @ 226

Last change on this file since 226 was 226, checked in by pinsard, 17 years ago

corrections of some misspellings in some *.pro

  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1;+
2; @file_comments
3; Read contents of a gribtable. Gribtables are located
4; in the gribtables subdirectory of HIPHOP
5;
6; @categories
7;
8;
9; @param TABLENAME {in}{required}
10; The full path name of a gribtable file
11;
12; @keyword PARMTABL
13;
14;
15; @keyword CENTER
16;
17;
18; @keyword SUBCENTER
19;
20;
21; @keyword TABLNUM
22;
23;
24; @returns
25;
26;
27; @uses
28;
29;
30; @restrictions
31;
32;
33; @examples
34; tablename='ectab_128'
35;
36; @history
37; Dominik Brunner, Apr 2000
38;
39; @version
40; $Id$
41;-
42PRO read_gribtable,tablename,parmtabl=parmtabl,center=center,$
43                   subcenter=subcenter,tablnum=tablnum
44;
45  compile_opt idl2, strictarrsubs
46;
47 
48ON_ERROR,2
49
50parmtabl=StrArr(3,256)
51center=-1
52subcenter=-1
53tablnum=-1
54; First Subscript (3) is [name,description,units]
55; Second  (256) is defined size of a parameter table
56
57IF n_elements(tablename) EQ 0 THEN return
58
59openr,lun,tablename,/get
60
61line=''
62; read first line which (eventually) contains information
63; about center, subcenter and table number
64readf,lun,line
65parts=STR_SEP(line,':')
66IF n_elements(parts) GT 3 THEN BEGIN
67  center=fix(parts[1])
68  subcenter=fix(parts[2])
69  tablnum=fix(parts[3])
70ENDIF ELSE BEGIN
71  IF n_elements(parts) GE 3 THEN parmtabl[0:1,fix(parts[0])]=parts[1:2] $
72  ELSE IF n_elements(parts) EQ 2 THEN parmtabl[0,fix(parts[0])]=parts[1]
73ENDELSE
74
75; loop over remaining lines
76REPEAT BEGIN
77  readf,lun,line
78  parts=STR_SEP(line,':')
79  IF n_elements(parts) GE 3 THEN parmtabl[0:1,fix(parts[0])]=parts[1:2] $
80  ELSE IF n_elements(parts) EQ 2 THEN parmtabl[0,fix(parts[0])]=parts[1]
81END UNTIL EOF(lun)
82
83free_lun,lun
84
85; fill up missing variable names
86index=WHERE(parmtabl[0,*] EQ '',count)
87IF count GT 0 THEN parmtabl[0,index]='var'+strcompress(index,/rem)
88
89END
Note: See TracBrowser for help on using the repository browser.