[GRASS-user] r.reclass probs with negative values

Hi Grass Users out there,
certainly something total easy, but is there a way to reclassify negative values with r.reclass?

fp: Data range is -0.2180119007825851440429688 to 0.1608885973691940307617188
> -0.2180119007825851440429688 thru 0.001 = 1 label
-0.718012 rounded up to 0
0.501000 rounded up to 0

Does r.reclass only work with integer or positive values? I couldn't find anything about that in the manual.

GRASS 6.0.1 (Yes, I know I am little late with updating...)

Thanks
Malte

Malte Halbey-Martin wrote:

Hi Grass Users out there,
certainly something total easy, but is there a way to reclassify
negative values with r.reclass?

fp: Data range is -0.2180119007825851440429688 to
0.1608885973691940307617188
> -0.2180119007825851440429688 thru 0.001 = 1 label
-0.718012 rounded up to 0
0.501000 rounded up to 0

Does r.reclass only work with integer or positive values? I couldn't
find anything about that in the manual.

Only integer maps can be reclassed.

--
Glynn Clements <glynn@gclements.plus.com>

Glynn Clements napisał(a):

Malte Halbey-Martin wrote:

Hi Grass Users out there,
certainly something total easy, but is there a way to reclassify negative values with r.reclass?

fp: Data range is -0.2180119007825851440429688 to 0.1608885973691940307617188
> -0.2180119007825851440429688 thru 0.001 = 1 label
-0.718012 rounded up to 0
0.501000 rounded up to 0

Does r.reclass only work with integer or positive values? I couldn't find anything about that in the manual.
    
Only integer maps can be reclassed.

yes, it is the problem, map shall be multipied by for example 1000000 then reclasified

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanx Glynn & Jarek,
I assumed that that's the problem and I already solved it that way.
After several years working with GRASS one knows some hacks :wink:

Malte

Only integer maps can be reclassed.

yes, it is the problem, map shall be multipied by for example
1000000 then reclasified

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFWXXtz6k8g9jQ0MkRAqdgAJ9BCA4K9AzIi8DWzy07Qniq2ha9OgCeL0js
JXLjNO+ajpCa1DEhbGXRpGQ=
=zE3t
-----END PGP SIGNATURE-----

Malte Halbey-Martin wrote:

> certainly something total easy, but is there a way to reclassify
> negative values with r.reclass?
>
> fp: Data range is -0.2180119007825851440429688 to
> 0.1608885973691940307617188
> > -0.2180119007825851440429688 thru 0.001 = 1 label
> -0.718012 rounded up to 0
> 0.501000 rounded up to 0
>
> Does r.reclass only work with integer or positive values? I couldn't
> find anything about that in the manual.

Glynn:

Only integer maps can be reclassed.

for FP reclassification use r.mapcalc:

r.mapcalc "newmap= if( oldmap < 0.001, 1, 2 )"

if( test, then this, otherwise this )

Hamish

R.mapcalc and r.recode both create new maps.

However, r.reclass is especially useful because it DOESN'T create a new map.
It just makes a new cats table for an existing raster map. This means that
it is sort of a 'virtual' map or map 'view'. It also means that it runs much
faster (important in interated scripts) and takes up very little space (also
good for iteration that creates multiple map 'views').

It would be nice if this could be done with FP maps too somehow, since FP
maps also have cats tables that affect how they are displayed.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Hamish <hamish_nospam@yahoo.com>
Date: Wed, 15 Nov 2006 11:45:18 +1300
To: <malte@perlomat.de>
Cc: <grassuser@grass.itc.it>
Subject: Re: [GRASS-user] r.reclass probs with negative values

Malte Halbey-Martin wrote:

certainly something total easy, but is there a way to reclassify
negative values with r.reclass?

fp: Data range is -0.2180119007825851440429688 to
0.1608885973691940307617188

-0.2180119007825851440429688 thru 0.001 = 1 label

-0.718012 rounded up to 0
0.501000 rounded up to 0

Does r.reclass only work with integer or positive values? I couldn't
find anything about that in the manual.

Glynn:

Only integer maps can be reclassed.

for FP reclassification use r.mapcalc:

r.mapcalc "newmap= if( oldmap < 0.001, 1, 2 )"

if( test, then this, otherwise this )

Hamish

Michael Barton wrote:

R.mapcalc and r.recode both create new maps.

However, r.reclass is especially useful because it DOESN'T create a
new map. It just makes a new cats table for an existing raster map.
This means that it is sort of a 'virtual' map or map 'view'. It also
means that it runs much faster (important in interated scripts) and
takes up very little space (also good for iteration that creates
multiple map 'views').

It would be nice if this could be done with FP maps too somehow,

I don't see any reason why FP maps shouldn't be able to be base maps for
a reclassification into integer categories (besides r.reclass lacks the
code to do this AFAIK).

since FP maps also have cats tables that affect how they are
displayed.

FCELL, DCELL (floating point) maps do have cats/ tables, but they are
typically empty*,**.

* you can add labels there for different values, e.g. for d.legend

** FCELL,DCELL lists number of cats as 255 (this shows up in r.info)
   why?

Hamish

Hi
I thing that in some situaltion reclass is the only solution and cannot be repaced with mapclac..
for example curvature map with values between -1 and 1 with most data like 0.0000345, when more than 10 new categories are needed (nested if () 10 times ??)

btw: there are in grass some more integer-output modules -for example d.histogram...
unfortunatly I'm not a C programmer...

Hamish napisał(a):

Michael Barton wrote:
  

R.mapcalc and r.recode both create new maps.

However, r.reclass is especially useful because it DOESN'T create a
new map. It just makes a new cats table for an existing raster map.
This means that it is sort of a 'virtual' map or map 'view'. It also
means that it runs much faster (important in interated scripts) and
takes up very little space (also good for iteration that creates
multiple map 'views').

It would be nice if this could be done with FP maps too somehow,
    
I don't see any reason why FP maps shouldn't be able to be base maps for
a reclassification into integer categories (besides r.reclass lacks the
code to do this AFAIK).

since FP maps also have cats tables that affect how they are
displayed.
    
FCELL, DCELL (floating point) maps do have cats/ tables, but they are
typically empty*,**.

* you can add labels there for different values, e.g. for d.legend

** FCELL,DCELL lists number of cats as 255 (this shows up in r.info)
   why?

Hamish

_______________________________________________
grassuser mailing list
grassuser@grass.itc.it
http://grass.itc.it/mailman/listinfo/grassuser