Hi Lispers,
after playing around with a model, I need to read in data files. these
files have a structure like this:
***SOIL FILE*** - CL-HY-65.SL-
1. Soil site: Clay - heavy (65 cm)
2. Local soil name:
3. A soil taxonomy name:
4. Brief description: Very sticky. Gleying common.
5. Name of file-author: Tim Stop
6. Date created: 0456
7. Data-provider's name: self
8. Printed source(s) of data: nil
9. Special reasons for interest: wert
10. Remarks (no commas): This file is an example only.
11. Remarks (no commas):
12. Remarks (no commas):
***DATA SECTION*** (Edit data-items RIGHTwards from Column 60 as printed)
SOIL 1. Aer'n (class,1-6,nil to good): 4 (poor)
SOIL 2. Base saturation (% CEC): 70 (high)
SOIL 3. CEC (meq/100 g): 35 (high)
....
and so on.
There are a lot of different types of data files which are somewhat as
above. Some files even contain tables like:
*** DATA
WEEKS - ACTUAL
23 24 25 26 27 28 29 30 31 32 33 34
\(period name or no.) <- this line is a continuation of the last line
CLIM 1. Rainfall (mm)
23 34 45 56 67 78 89 90 0 10 20 30
CLIM 2. Evaporation (mm)
65 54 43 32 21 10 0 20 40 60 70 80
I am looking for advice on how to read such files in Lisp.
thank you very much,
Marc
--
------------------------------------------------------------------------------
email: marc dot hoffmann at users dot whh dot wau dot nl
------------------------------------------------------------------------------
see.signature wrote:
> I am looking for advice on how to read such files in Lisp.
There seem to be a diverse set of line formats in the file, none of which
seem to be easily parsed by the Lisp reader. Unless the format can be
regularized to something more Lisp-like, you'll still have to use the
equivalent of a standard parser, only written in Lisp (which will still
make it much smaller and easier to write). I'd check out
http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/parsing/zebu/
for one of the better Lisp parsers, and the directory above that has some
additional items that might be useful. Also look in CLOCC
(http://clocc.sourceforge.net/) for other possibilities.
faa