[GRASSLIST:675] Re: raster categories and floating point attribute values

Steven Stoddard sstoddar at uiuc.edu
Wed Jul 9 17:03:49 EDT 2003


If I use the sed line you suggest, I receive the following:
ERROR: 1 = 0.00000000000000000E+00
        - invalid reclass rule
My first inclination is that r.reclass (or v.reclass) doesn't like the 
floating point variable.  Is there a way I might change the floating 
point number to integer within the file and then do a reclass?
Thanks

On Wednesday, July 9, 2003, at 03:01  PM, Michel Wurtz wrote:

> Steven Stoddard wrote:
>> I am currently in the process of learning grass and trying to 
>> assemble a database to work off of for my research.  I am importing 
>> many files and trying to get them into a raster format that is 
>> amenable to analysis--floating point or integer maps.  I have maps 
>> though that were imported from .e00 that are in raster format, but 
>> are categorized sequentially (e.g. 1-120) and their labels are a 
>> floating point value.  How do I get rid of the category number and 
>> instead have only the fp value so I can do manipulations with mapcalc 
>> etc?
>> Just for background, the imported map was first in vector format and 
>> all polygons were assigned a unique id with a floating point value as 
>> the attribute.  I reclassified this map so that the categories at 
>> least corresponded to same floating point values and were sorted in 
>> increasing fashion.
>
> You can use r.reclass the same way as v.reclass on the file imported 
> with
> m.in.e00 : just transform the cat file in soething usable as input for
> r.reclass.  What I don't know is how to force the resulting file to be
> a floating value raster...  Maybe it is easier to start from the vector
> file and use v.to.rast (with the appropriate dig_cats file) to produce
> the raster file...
>
> Here follows a copy a message I posted some days ago :
>
> As a reminder : If there is only one attribute (other than the 
> standard ESRI
> attributes for lines or areas), ther is only one dig_cats file 
> created, and
> its name is like the dig file name.  If there is many attributes, 
> there is
> as many dig_cats files, named <vector_file_name>.<attribute_name>.  In 
> this case
> the first thing to do is to go in the dig_cats directory and set a 
> symbolic
> link to the dig_cats file you want as the new dig_att values.
>
> After that, you need only a two line command to change the att values. 
>  The
> best is to take an example :
>
> dig file name is brucom,
> dig_att/brucom looks like :
>
> # 48 categories
> brucom
>
> 0.00 0.00 0.00 0.00
> 1:67482
> 2:67492
> 3:67354
> 4:67240
> etc.
>
> What you have to type :
>
> export LOCATION=<your mpaset location>
> sed -e '1,4d' -e 's/:/ = /' $LOCATION/dig_cats/brucom | v.reclass 
> input=brucom output=brucom1 type=area
> v.support brucom1
>
> The first line was added since $LOCATION is no longer set at grass 
> startup...
> The second one do the job : sed convert the dig_att file in a form 
> usable by
> v.reclass. You have to change
>  - the file names and the location (obviously)
>  - the type=area in type=line if you have lines instead of areas
>
> The third line is mandatory for some other programs to work (v.digit, 
> d.what.vect,
> etc.)
>
> -- 
> Michel Wurtz - Auzeville-Tolosane
>
>
Steven T. Stoddard

Program in Ecology and Evolutionary Biology
University of Illinois at Urbana-Champaign
202b Shelford Vivarium
606 E. Healy Ave
Champaign, IL  61820

CERL-CNN
P.O. BOX 9005
Champaign, IL 61826
(217) 352-6511 x7411

sstoddar at uiuc.edu




More information about the grass-user mailing list