Re: [GRASS-dev] Re: [GRASS-user] Get current location projection in a Python Script

2010-07-21 Thread Glynn Clements

Nikos Alexandris wrote:

> Nikos Alexandris wrote:
> > > > > >> rows = int(grass.region()['rows'])
> > > > > >> cols = int(grass.region()['cols'])

> Is  python's "int()" truncating or rounding up values? The question came to 
> me 
> while thinking of r.mapcalc's respective functions ( i.e. "int() != round()" )

In this case, neither; it's just converting strings to integers. The
rows and cols values in the g.region output will always be integers.

If you pass a floating-point value to int(), it will be truncated
(i.e. rounded towards zero):

> int(1.9)
1
> int(-1.9)
-1

If you pass a string containing a decimal point to int(), it will
raise an exception:

> int("1.9")
Traceback (most recent call last):
  File "", line 1, in 
ValueError: invalid literal for int() with base 10: '1.9'

-- 
Glynn Clements 
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Precision error in r.mapcalc

2010-07-21 Thread Glynn Clements

Jenny Turner wrote:

> I have a raster (FCELL ) that has a minimum value of 0.1312103122

The data is stored in binary floating point, and 0.1312103122 isn't
exactly representable in that format. The closest representable value
is 0.0010cb7fe (hex) = 0.13121031224727630615234375 (decimal).

FCELL (single-precision "float") has just under 7 significant digits
of precision. More precisely, it has 24 binary digits, resulting in an
"epsilon" of ~1.2e-7.

The next representable value below the above value is 0.0010cb7fc
(hex) = 0.1312102973461151123046875 (decimal), while the next value
above it is 0.0010cb800 (hex) = 0.1312103271484375 (decimal)

IOW, any value whose decimal expansion begins with 0.13121031 will
have the same binary representation, and thus all such values will be
indistinguishable.

> and If I
> try to have an image with just those values
> r.mapcalc "minim= if(image==0.1312103122,10,0)" I get an all Zero image.

This is to be expected. The decimal constant will be parsed as double
precision then converted to single precision. The result may not be
exactly equal to the value stored in the map.

In general, you shouldn't perform equality comparisions between
floating-point values unless you are certain that no rounding errors
can be introduced.

> Then I opened the minim metadata and i see that in comments I have:
> if(clustered.1 == 0.13121031, 10, 0)
> r.mapcalc has eliminated the last 2 digits.

Floating-point constants are printed with "%.8g", which exceeds the
precision of FCELL. Printing more digits would typically be pointless,
as it's highly unlikely that the data will actually accurate to a
relative error of 1e-7 in the first place.

> How can I avoid this to happen?

Replace the equality check with a range check, e.g.:

if(abs(image-0.13121031) <= 1e-8,...

-- 
Glynn Clements 
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Supervised Remote Sensing

2010-07-21 Thread Etienne DELAY (deust 2010)
Le 21/07/10 21:20, Micha Silver a écrit :
> On 07/21/2010 10:09 PM, Etienne DELAY (deust 2010) wrote:
>> Hi Antonio
>> Thank you for your réponce, I reread the link you sent me. But I think I
>> always pass a side of something because it still doen't work ...
>> after having completed the digitalization with
>>
>> i.class group=1325_13 sub=supervised map=1325_13.red outsig=outsig1
>>
> Here you have "outsig1", but...
>> An erreur
>> i.maxlik group=1325...@teledetection subgroup=supervised sigfile=outsig
>> class=testSupervised
>> ERREUR :Unable to open signature file
>>
> Here is "outsig"
> Is this the problem?
>> if you have other idee :-)
>> thank you
>>

Hi Micha
it's un copie/paste problem ;-)
i.maxlik group=1325...@teledetection subgroup=supervised sigfile=outsig1
class=testSupervised
ERREUR :Unable to read signature file 

but thank you ;-)


-- 
Cordialement

Etienne DELAY
Deust "Webmaster et gest. d'intranet" (IDSkype : etienne.delay.tic)
Master IUP "valorisation du patrimoine et aménagement du territoire"
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Supervised Remote Sensing

2010-07-21 Thread Micha Silver

On 07/21/2010 10:09 PM, Etienne DELAY (deust 2010) wrote:

Hi Antonio
Thank you for your réponce, I reread the link you sent me. But I think I
always pass a side of something because it still doen't work ...
after having completed the digitalization with

i.class group=1325_13 sub=supervised map=1325_13.red outsig=outsig1
   

Here you have "outsig1", but...

An erreur
i.maxlik group=1325...@teledetection subgroup=supervised sigfile=outsig
class=testSupervised
ERREUR :Unable to open signature file
   

Here is "outsig"
Is this the problem?

if you have other idee :-)
thank you


   


___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Supervised Remote Sensing

2010-07-21 Thread Etienne DELAY (deust 2010)
Hi Antonio
Thank you for your réponce, I reread the link you sent me. But I think I
always pass a side of something because it still doen't work ...
after having completed the digitalization with

i.class group=1325_13 sub=supervised map=1325_13.red outsig=outsig1

An erreur
i.maxlik group=1325...@teledetection subgroup=supervised sigfile=outsig
class=testSupervised
ERREUR :Unable to open signature file 

if you have other idee :-)
thank you



Le 21/07/10 16:20, António Rocha a écrit :
> Hello  Etienne DELAY
> 
> YOu have skipped the part where the signatures are produced.
> Take a look at:
> http://grass.osgeo.org/gdp/html_grass64/imageryintro.html in  Image
> classification
> 
> Hope it helps
> Antonio
> 
> 
> __ Information from ESET NOD32 Antivirus, version of virus
> signature database 5297 (20100721) __
> 
> The message was checked by ESET NOD32 Antivirus.
> 
> http://www.eset.com
> 
> 
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user


-- 
Cordialement

Etienne DELAY
Deust "Webmaster et gest. d'intranet" (IDSkype : etienne.delay.tic)
Master IUP "valorisation du patrimoine et aménagement du territoire"
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Stack Dumpfile in WinGRASS installation with OSGEO4w

2010-07-21 Thread Monica Buescu
Hi

Since I saw today a message from Helmut, stating that 19-07 Snapshot is to
be updated, I decided to install an earlier version (from June).
While I was installing GRASS i got a lot of :
0 [main] sh 3880 open_stackdumpfile: Dumping stack trace to
sh.exe.stackdump
  0 [main] sh 960 open_stackdumpfile: Dumping stack trace to
sh.exe.stackdump
  0 [main] sh 2256 open_stackdumpfile: Dumping stack trace to
sh.exe.stackdump
  0 [main] sh 3724 open_stackdumpfile: Dumping stack trace to
sh.exe.stackdump
  0 [main] sh 772 open_stackdumpfile: Dumping stack trace to
sh.exe.stackdump
  0 [main] sh 2632 open_stackdumpfile: Dumping stack trace to
sh.exe.stackdump
  0 [main] sh 3464 open_stackdumpfile: Dumping stack trace to
sh.exe.stackdump
  0 [main] sh 2056 open_stackdumpfile: Dumping stack trace to
sh.exe.stackdump

But I got a text stating that it was built without any errors.

What is happening? Is this a problem? (because in my first attempt nothing
was written in C:\osgeo4w\apps\grass and in second, without any change, it
wrote there)

Thanks
Monica
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Error while installing winGRASS in Osgeo4w

2010-07-21 Thread Helmut Kudrnovsky
hi,

>grass-6.4.svn_src_snapshot_2010_07_18
[...]
>Any idea of what might be wrong? or be missing?
>
>Thanks
>Antonio

see 

http://lists.osgeo.org/pipermail/grass-commit/2010-July/013788.html

from July 19, so one day later as your downloaded snapshot.

please try a later snapshot or a fresh-svn-checkout.  

now compiling wingrass according to 
http://trac.osgeo.org/grass/wiki/CompileOnWindows
is working again.

best regards
Helmut
___
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02


smime.p7s
Description: S/MIME Cryptographic Signature
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Error while installing winGRASS in Osgeo4w

2010-07-21 Thread António Rocha

Greetings

I have successfully installed winGRASS following this instructions: 
http://trac.osgeo.org/grass/wiki/CompileOnWindows


I had a few problems with my current grass installation so I decided to 
Download grass-6.4.svn_src_snapshot_2010_07_18 version (from here: 
http://grass.osgeo.org/grass64/source/snapshot/)

I have done this:
cd /C/osgeo4w/usr/src/grass-6.4.svn_src_snapshot_2010_07_18

then:
./mswindows/osgeo4w/package.sh

But I get this error:
Wed Jul 21 15:57:40 GMTDT 2010: STARTING make distclean
makefile:22: include/Make/Platform.make: No such file or directory
makefile:23: include/Make/Grass.make: No such file or directory
make: *** No rule to make target `include/Make/Grass.make'.  Stop.

But at 
C:\osgeo4w\usr\src\grass-6.4.svn_src_snapshot_2010_07_18\include\Make I 
realized that the files were with a different name

Platform.make.in
Grass.make.in
So I renamed them

Then I rerun package.sh and I obtained this:
Wed Jul 21 16:05:42 GMTDT 2010: STARTING configure
 0 [main] sh 2948 open_stackdumpfile: Dumping stack trace to 
sh.exe.stackdump
 0 [main] sh 3140 open_stackdumpfile: Dumping stack trace to 
sh.exe.stackdump

configure: error: can not find sources in  or ..


Any idea of what might be wrong? or be missing?

Thanks
Antonio


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5298 (20100721) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-dev] Re: [GRASS-user] Get current location projection in a Python Script

2010-07-21 Thread Nikos Alexandris
Nikos Alexandris wrote:
> > > > >> rows = int(grass.region()['rows'])
> > > > >> cols = int(grass.region()['cols'])

Glynn:
> > > > > In 7.0, these fields are already integers; r40555 should be
> > > > > backported.

Markus: 
> > > > AFAIK it has been backported some time ago.
> > > > http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/
> > > > lib/ python/core.py#L503

Glynn:
> > > Okay; change that to "I should 'svn update' the other branches more
> > > often", then ;)

Nikos:
> > This means it should be like:
> > 
> > rows = grass.region()['rows']
> > cols = grass.region()['cols']
> > 
> > Right?

Glynn Clements wrote: 
> Right; although you should store the result of grass.region() to avoid
> redundant g.region commands, i.e.:
> 
>   rgn = grass.region()
>   rows = rgn['rows']
>   cols = rgn['cols']

Is  python's "int()" truncating or rounding up values? The question came to me 
while thinking of r.mapcalc's respective functions ( i.e. "int() != round()" )

Nikos
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] List of existing values

2010-07-21 Thread Nikos Alexandris

Nikos Dumakis:
> > In my case I have not more than 1200 different cell values. If I do :
> > r.stats -1 input=data
> > I obtained a list of all pixel values but what I am lookinf is for the
> > unique values (not repeated).

Martin Landa wrote: 
> as mentioned in Hamish's response, use combination of `sort` and `uniq`
> 
> r.starts -1 input=data | sort | uniq

shorter:

r.starts -1 input=data | sort -u

Nikos
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Supervised Remote Sensing

2010-07-21 Thread António Rocha

Hello  Etienne DELAY

YOu have skipped the part where the signatures are produced.
Take a look at: 
http://grass.osgeo.org/gdp/html_grass64/imageryintro.html in  Image 
classification


Hope it helps
Antonio


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5297 (20100721) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Precision error in r.mapcalc

2010-07-21 Thread Jenny Turner
Greetings
I have a raster (FCELL ) that has a minimum value of 0.1312103122 and If I
try to have an image with just those values
r.mapcalc "minim= if(image==0.1312103122,10,0)" I get an all Zero image.
Then I opened the minim metadata and i see that in comments I have:
if(clustered.1 == 0.13121031, 10, 0)
r.mapcalc has eliminated the last 2 digits.How can I avoid this to happen?
Thanks
Jenny
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Supervised Remote Sensing

2010-07-21 Thread Etienne DELAY (deust 2010)
hello
I am starting remote sensing based on ecw file.
I built a sub Goup, "Supervised" and I run i.class

i.class group=1325_13 sub=supervised map=1325_13.red outsig=outsig1

I am interested digitizes areas, I save them, and I go out of module. He
said that the data are recorded.

As I want to use the module i.maxlik, an error message
ERREUR :Unable to read signature file 

where do I forget something?
thank you :-)

-- 
Cordialement

Etienne DELAY
Deust "Webmaster et gest. d'intranet" (IDSkype : etienne.delay.tic)
Master IUP "valorisation du patrimoine et aménagement du territoire"
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Converting raster to Vector (areas)- Question

2010-07-21 Thread Markus Metz
Luis Lisboa wrote:
> Greetings
> I have a labeled/classified image like this (hoje this displayed correctly
> ):
> 1 1 1 1 1 1 3
> 2 2 2 1 1 1 3
> 2 2 1 1 1 1 3
> 2 1 4 4 4 4 4
> 4 4 4 4 4 4 4
> When I convert this to vector (areas) the pixel with value 1 in row 4 is
> considered a different "area" from the one with all ones but it shouldn't
> because it's connected with the 1 big area by pixel corner.
> My question is: how can I convert tyhis to vector and still consider that 1
> as being part of the big clusters of 1?

By definition (GRASS vector model and GC simple features), these two
are different areas and can not be combined because they do not share
a common boundary. But these two areas can have the same category,
here 1, and you can add more info for each category to the attribute
table.

Markus M
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] List of existing values

2010-07-21 Thread Nikos Dumakis
hELLO all
Regarding the use of r.stats -1 input=image | sort | uniq
I have sent a message saying that this works just fine but...

I have only tested in WinGRASS 6.4.RC6). When I tried in Linux
(GRASS6.4.0RC6) I got this error:
Sorry <|> is not a valid option
Sorry  is not a valid option
Sorry <|> is not a valid option
Sorry  is not a valid option

Why do I obtain different results in Win and in Linux? and How can I do this
in Linux?

Thanks
Nikos


On Tue, Jul 20, 2010 at 4:17 PM, Martin Landa wrote:

> Hi,
>
> 2010/7/20 Nikos Dumakis :
> > In my case I have not more than 1200 different cell values. If I do :
> > r.stats -1 input=data
> > I obtained a list of all pixel values but what I am lookinf is for the
> > unique values (not repeated).
>
> as mentioned in Hamish's response, use combination of `sort` and `uniq`
>
> r.starts -1 input=data | sort | uniq
>
> Martin
>
> --
> Martin Landa  * http://gama.fsv.cvut.cz/~landa
>
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Converting raster to Vector (areas)- Question

2010-07-21 Thread Luis Lisboa
Greetings
I have a labeled/classified image like this (hoje this displayed correctly
):

1 1 1 1 1 1 3
2 2 2 1 1 1 3
2 2 1 1 1 1 3
2 1 4 4 4 4 4
4 4 4 4 4 4 4

When I convert this to vector (areas) the pixel with value 1 in row 4 is
considered a different "area" from the one with all ones but it shouldn't
because it's connected with the 1 big area by pixel corner.
My question is: how can I convert tyhis to vector and still consider that 1
as being part of the big clusters of 1?

Thanks

Luis
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] How to convert multi-bands clusters in a vectorial

2010-07-21 Thread Monica Buescu
Hi there


>
>
> > I have used an external tool to produce clusters from Landsat images. For
> > each input bands, I obtain clusters with a desginated value (mean of the
> > values in that cluster). So, if I use 4 bands, I obtained 4 outputs with
> > clusters. in each image I obtain the same clusters but with different
> values
> > (depends on pixel values).
>
> How did you do this? (which commands)?
>
> I have used an external tool based on Segmentation paper. (coded in C++).


> > What I want to obtain is a single map (raster or
> > vectorial) with all clusters. in GRASS, how can I "merge" this 4 bands in
> > order to obtain a labeled product? it can be a single raster or vectorial
> > but it has to be a single band/layer...
>
>
> Yes please :)
>
>
Eheheeh here goes :)
I have 4 bands and in each one pixel values are calculated based on band
cluster mean. I mean, pixels included in a certain cluster, are all with the
same value that correspond with average of pixels included in the same
cluster. This happens in all 4 bands. What I want is to merge 4 bands in a
single one in which I will have labeled clusters with an integer
(1,2,3,4,5...) isntead of pixel mean.

How can I do this merge?

Thanks Monica
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user