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

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

corrections of some headers and parameters and keywords case. change of pro2href to replace proidl

  • 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; IDL> tablename='ectab_128'
35;
36; @history
37; Dominik Brunner, Apr 2000
38;
39; @version
40; $Id$
41;-
42;
43PRO read_gribtable, tablename, PARMTABL=parmtabl, CENTER=center,$
44                   SUBCENTER=subcenter, TABLNUM=tablnum
45;
46  compile_opt idl2, strictarrsubs
47;
48 
49ON_ERROR,2
50
51parmtabl=StrArr(3,256)
52center=-1
53subcenter=-1
54tablnum=-1
55; First Subscript (3) is [name,description,units]
56; Second  (256) is defined size of a parameter table
57
58IF n_elements(tablename) EQ 0 THEN return
59
60openr,lun,tablename,/get
61
62line=''
63; read first line which (eventually) contains information
64; about center, subcenter and table number
65readf,lun,line
66parts=STR_SEP(line,':')
67IF n_elements(parts) GT 3 THEN BEGIN
68  center=fix(parts[1])
69  subcenter=fix(parts[2])
70  tablnum=fix(parts[3])
71ENDIF ELSE BEGIN
72  IF n_elements(parts) GE 3 THEN parmtabl[0:1,fix(parts[0])]=parts[1:2] $
73  ELSE IF n_elements(parts) EQ 2 THEN parmtabl[0,fix(parts[0])]=parts[1]
74ENDELSE
75
76; loop over remaining lines
77REPEAT BEGIN
78  readf,lun,line
79  parts=STR_SEP(line,':')
80  IF n_elements(parts) GE 3 THEN parmtabl[0:1,fix(parts[0])]=parts[1:2] $
81  ELSE IF n_elements(parts) EQ 2 THEN parmtabl[0,fix(parts[0])]=parts[1]
82END UNTIL EOF(lun)
83
84free_lun,lun
85
86; fill up missing variable names
87index=WHERE(parmtabl[0,*] EQ '',count)
88IF count GT 0 THEN parmtabl[0,index]='var'+strcompress(index,/rem)
89
90END
Note: See TracBrowser for help on using the repository browser.