[GRASS-dev] possible bug on r.mapcalc round() G7

Margherita Di Leo dileomargherita at gmail.com
Fri Mar 15 12:38:32 PDT 2013


Hi all,

trying to rescale a map to 0:255 range, I run:

r.univar -g map
n=9599576
null_cells=0
cells=9599576
min=-1.55537462234497
max=274.231811523438
range=275.787186145782
mean=96.915776629461
mean_of_abs=96.915791505254
stddev=37.6540983935747
variance=1417.831125833
coeff_var=38.8523929778099
sum=930350363.3535346985

taking the max, i run:

r.mapcalc "map.invscaled = round((1.0 - map / 274.231811523438) * 255.0)"

But then:

r.info map.invscaled
 +----------------------------------------------------------------------------+
 | Layer:    map.invscaled                  Date: Fri Mar 15 20:36:38 2013
   |
 | Mapset:   PERMANENT                      Login of Creator: madi
   |
 | Location: massimozia
  |
 | DataBase: /home/madi/grassdata
  |
 | Title:     ( map.invscaled )
  |
 | Timestamp: none
   |
 |----------------------------------------------------------------------------|
 |
   |
 |   Type of Map:  raster               Number of Categories: 0
  |
 |   Data Type:    CELL
  |
 |   Rows:         4181
  |
 |   Columns:      2296
  |
 |   Total Cells:  9599576
   |
 |        Projection: x,y
  |
 |            N: 5170841.60115    S: 5045411.60115   Res:    30
  |
 |            E: 359567.587692    W: 290687.587692   Res:    30
  |
 |   Range of data:    min = 0  max = 256
  |
 |
   |
 |   Data Description:
   |
 |    generated by r.mapcalc
   |
 |
   |
 |   Comments:
   |
 |    round((1 - map / 274.23181) * 255)
   |
 |
   |
 +----------------------------------------------------------------------------+

max = 256 must be an error in round() IMHO. Please let me know if I can't
see the obvious.

Thanks,


-- 
Best regards,

Margherita DI LEO
Postdoctoral Researcher

European Commission - DG JRC
Institute for Environment and Sustainability (IES)
Via Fermi, 2749
I-21027 Ispra (VA) - Italy - TP 261

Tel. +39 0332 78 3600
margherita.di-leo at jrc.ec.europa.eu

Disclaimer: The views expressed are purely those of the writer and may not
in any circumstance be regarded as stating an official position of the
European Commission.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20130315/f33fc1e9/attachment.html>


More information about the grass-dev mailing list