[GRASS-user] mapcalc

2011-07-25 Thread Rebecca Bennett
Hello all, I would like to use r.mapcalc to fill the null cells of one raster with the value of the same cells from in a second raster (while leaving all other cells as they are in the first raster). Clearly I am having some kind of brain frizz because this should be simple but I can't get it

Re: [GRASS-user] mapcalc

2011-07-25 Thread Hendrik Hoeth
Thus spake Rebecca Bennett (rabenn...@ymail.com): > I would like to use r.mapcalc to fill the null cells of one raster > with the value of the same cells from in a second raster (while > leaving all other cells as they are in the first raster). rasterA="if(isnull(rasterA), rasterB, rasterA)" --

Re: [GRASS-user] mapcalc

2011-07-25 Thread Rebecca Bennett
just the ticket - thank you Hendrik! > >From: Hendrik Hoeth >To: Rebecca Bennett >Cc: grass-user@lists.osgeo.org >Sent: Monday, 25 July 2011, 22:24 >Subject: Re: [GRASS-user] mapcalc > >Thus spake Rebecca Bennett (rabenn...@ymail.com):

Re: [GRASS-user] mapcalc

2011-07-26 Thread Paulo van Breugel
Unless there is a specific reason to use r.mapcalc I would suggest to use r.patch On 07/25/2011 11:20 PM, Rebecca Bennett wrote: Hello all, I would like to use r.mapcalc to fill the null cells of one raster with the value of the same cells from in a second raster (while leaving all other ce

[GRASS-user] mapcalc - formula

2009-10-19 Thread Martin Schweizer
Hi I have the following problem: I have the following formula from http://grass.osgeo.org/gdp/raster/mapcalc-algebra.pdf on page 12. wasser = wasser+eval(x=elev+wasser,\ if(x>(y=elev[-1,0]+wasser[-1,0]),\ -.15*if(elev>y,wasser,x-y),\ .15*if(elev[-1,0]>x,wasser[-1,0],y-x))+\ if(x>(y=elev[1,0]+wa

[GRASS-user] mapcalc - formula

2009-10-26 Thread Martin Schweizer
Hi I (in cooperation with Ernst Lobsiger) found a working formula for my problem: water=water+eval(o=4.0, s=0.15, d=0.10, x=elev+water,\ if (x>(y=elev[-1,0]+water[-1,0]) && x>o,\ -s * min(water,x-y))+\ if (y>x && y>o,\ s * min(water[-1,0],y-x))+\ .. Thanks anyway and best regards Martin

Re: [GRASS-user] mapcalc - formula

2009-10-20 Thread Maris Nartiss
Hello, I have no time to look into this issue right now. Please add a wish ticket to trac "r.lake should support minimum water column depth" and describe how it should work. Thanks, Maris. 2009/10/19, Martin Schweizer : > Hi > > I have the following problem: I have the following formula from > h

[GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread G. Allegri
How can I control mapalgebra "if" statements on the base of the coordinates values of a cell? The base problem is to change the values of some specific cells on the base of their coordinates. I've tried using d.rast.edit but it seems a little "contorted" to me, having to specify so many parameters

[GRASS-user] mapcalc gui load/save

2014-03-29 Thread Anna Petrášová
Hi, I was wondering if anyone is using Load/Save expressions in r.mapcalc GUI. I just added there the copy button which is standard for all modules. When I need, I store multiple r.mapcalc commands in a text file and then I just copy and paste. Loading and saving expressions using the buttons seem

[GRASS-user] mapcalc combining raster and vector

2019-05-08 Thread Francois Chartier
Hi I would like to use mapcalc with types of input a DEM (raster) and xyz property (vector). basically, I would like to do a weighted average of data points located for 10 m from DEM, then 10 to 20 etc. ___ grass-user mailing list grass-user@lists.osgeo

[GRASS-user] mapcalc/mapcalculator in python script

2011-02-01 Thread Johannes Radinger
Hello, I am running GRASS GIS 6.5 and want to run a python script including a mapcaluculator-expression of a simple formula: A=if(B,C) grass.mapcalc("$upstream_shreve = if(${upstream_part},${shreve})", upstream_shreve = options['upstream_shreve'], upstream_par

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread Paul Kelly
On Mon, 14 Jul 2008, G. Allegri wrote: How can I control mapalgebra "if" statements on the base of the coordinates values of a cell? The base problem is to change the values of some specific cells on the base of their coordinates. I suspect this might not be possible with r.mapcalc, because ea

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread G. Allegri
Yer, but as mapcalc has some built-in functions like x() and y() to retrieve the x-y coordinates, I think it could be easy to trasform them in projected coordinates. I'm writing a few lines in C to solve it, but I think I'll take a look to r.mapcalc code to see if it would be possible to add someth

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread Glynn Clements
G. Allegri wrote: > How can I control mapalgebra "if" statements on the base of the > coordinates values of a cell? > The base problem is to change the values of some specific cells on the > base of their coordinates. r.mapcalc "$outmap = if(abs(x() - $x) < $eps && abs(y() - $y) < $eps,$newval,

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread Moritz Lennert
On 14/07/08 12:17, G. Allegri wrote: Yer, but as mapcalc has some built-in functions like x() and y() to retrieve the x-y coordinates, I think it could be easy to trasform them in projected coordinates. I'm writing a few lines in C to solve it, but I think I'll take a look to r.mapcalc code to se

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread G. Allegri
> r.mapcalc brol3=if(y()<=9521600 && x()<=427000,1,null()) > > but this doesn't: > > r.mapcalc brol3=if(y()==9521600 && x()==427000,1,null()) > > which raises the issue of precision of the coordinates... So, it's possible to check above a range of coordinates but not on a specific one... But I don

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread Glynn Clements
Moritz Lennert wrote: > Well, this works: > > r.mapcalc brol3=if(y()<=9521600 && x()<=427000,1,null()) > > but this doesn't: > > r.mapcalc brol3=if(y()==9521600 && x()==427000,1,null()) > > which raises the issue of precision of the coordinates... What are the region settings? Bear in mind t

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread G. Allegri
Thanks Glynn. Exaustive explanation :-) So I just need to check if the difference abs($x-x()) is lower then half the resolution... 2008/7/14 Glynn Clements <[EMAIL PROTECTED]>: > > Moritz Lennert wrote: > >> Well, this works: >> >> r.mapcalc brol3=if(y()<=9521600 && x()<=427000,1,null()) >> >> but

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread Michael Barton
On Jul 14, 2008, at 3:54 AM, <[EMAIL PROTECTED]> wrote: Date: Mon, 14 Jul 2008 12:17:54 +0200 From: "G. Allegri" <[EMAIL PROTECTED]> Subject: Re: [GRASS-user] mapcalc and cell coordinates To: "Paul Kelly" <[EMAIL PROTECTED]> Cc: grassuser Message-ID:

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread Moritz Lennert
On 14/07/08 15:14, Glynn Clements wrote: Moritz Lennert wrote: Well, this works: r.mapcalc brol3=if(y()<=9521600 && x()<=427000,1,null()) but this doesn't: r.mapcalc brol3=if(y()==9521600 && x()==427000,1,null()) which raises the issue of precision of the coordinates... What are the regio

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread Glynn Clements
Moritz Lennert wrote: > > Also note that the calculation involves multiplying by the resolution. > > You mean internally by mapcalc, or that I should include resolution into > the calculation ? Internally. The point is that if you have e.g. a 100m x 100m square, and you set rows = cols = 300

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-14 Thread Glynn Clements
G. Allegri wrote: > Thanks Glynn. Exaustive explanation :-) > So I just need to check if the difference abs($x-x()) is lower then > half the resolution... In hindsight: If you want to test for the specific cell in which the given coordinates lie, you may be better off converting the coordinates

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-15 Thread G. Allegri
> If you want to test for the specific cell in which the given > coordinates lie, you may be better off converting the coordinates to a > row/col based upon the region settings, then testing against the > results of row() and col() (but note: row() and col() are 1-based, not > 0-based). > > Testing

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-15 Thread Glynn Clements
G. Allegri wrote: > > If you want to test for the specific cell in which the given > > coordinates lie, you may be better off converting the coordinates to a > > row/col based upon the region settings, then testing against the > > results of row() and col() (but note: row() and col() are 1-based,

Re: [GRASS-user] mapcalc and cell coordinates

2008-07-15 Thread G. Allegri
Ok, Glynn. I'll adopt this way. > bash doesn't do floating-point, so you need to use bc or awk, e.g.: Yes, ok, I know it. It was just a "pseduo-code" :-) ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gras

Re: [GRASS-user] mapcalc gui load/save

2014-03-30 Thread Johannes Radinger
Hi Anna, that is great, I was just about to request for a "copy" button for r.mapcalc similar to all other modules. Thanks, just what I needed. I'll try it out in near future. best regards, Johannes On Sun, Mar 30, 2014 at 12:04 AM, Anna Petrášová wrote: > Hi, > > I was wondering if anyone is

Re: [GRASS-user] mapcalc combining raster and vector

2019-05-08 Thread Micha Silver
You will most likely have to convert the points to raster. But before that, can you explain what you mean by "located for 10 m from DEM", "10 to 20".  On 08/05/2019 13:31, Francois Chartier wrote: Hi I

Re: [GRASS-user] mapcalc combining raster and vector

2019-05-08 Thread Moritz Lennert
On 8/05/19 14:00, Micha Silver wrote: You will most likely have to convert the points to raster. But before that, can you explain what you mean by "located for 10 m from DEM", "10 to 20". Or, if you mean zones of equal height, you can transform them to vector polygons and use v.vect.stats on

Re: [GRASS-user] mapcalc combining raster and vector

2019-05-08 Thread Francois Chartier
Hi Micha, I have soil samples from boreholes where i have data points at every meter interval and where soil type changes. i would like to create a weighted average of soil property for lets say the first 1 m below the DEM, so that i can evaluate potential for infiltration across a watershed. On

Re: [GRASS-user] mapcalc combining raster and vector

2019-05-08 Thread Moritz Lennert
On 8/05/19 15:03, Francois Chartier wrote: Hi Micha, I have soil samples from boreholes where i have data points at every meter interval and where soil type changes.  i would like to create a weighted average of soil property for lets say the first 1 m below the DEM, so that i can evaluate po

Re: [GRASS-user] mapcalc combining raster and vector

2019-05-09 Thread Micha Silver
On 08/05/2019 16:10, Moritz Lennert wrote: On 8/05/19 15:03, Francois Chartier wrote: Hi Micha, I have soil samples from boreholes where i have data points at every meter interval and where soil type changes.  i wou

Re: [GRASS-user] mapcalc combining raster and vector

2019-05-09 Thread Francois Chartier
sure i will send that later. thks On Thu., May 9, 2019, 04:00 Micha Silver, wrote: > > On 08/05/2019 16:10, Moritz Lennert wrote: > > On 8/05/19 15:03, Francois Chartier wrote: > > Hi Micha, > > I have soil samples from boreholes where i have data points at every meter > interval and where soil

Re: [GRASS-user] mapcalc combining raster and vector

2019-05-09 Thread Francois Chartier
Location:Toronto | | Database:C:\Users\hello\Documents\grassdata | | Title: | | Map scale: 1:1 | | Name of creator: hello | | Organization: | | Source date: Thu May 09 19:17:57 2019 | | Timestamp (firs

Re: [GRASS-user] mapcalc combining raster and vector

2019-05-09 Thread Micha Silver
OK, please clarify what each column reprepsents. On 10/05/2019 5:25, Francois Chartier wrote: V.DB.SELECT c

Re: [GRASS-user] mapcalc combining raster and vector

2019-05-10 Thread Francois Chartier
Sorry i realised later that in my current table i didnt rename the columns. here are the extract from excel (300 K pts). i am using the TopDepthRasterDEM_MASL as the Z elevation, and the attribute i am interested in are Texture in mm and K in m/sec BHID Zone EAST83 NORTH83 GTADEM MAT1 BOTDepthRast

Re: [GRASS-user] mapcalc combining raster and vector

2019-05-11 Thread Micha Silver
On 11/05/2019 3:16, Francois Chartier wrote: Sorry i realised later that in my current table i didnt rename the columns. here are the extract from excel (300 K pts). i am using the TopDepthRasterDEM_MASL as the Z elevation,

Re: [GRASS-user] mapcalc/mapcalculator in python script

2011-02-01 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/01/2011 03:28 PM, Johannes Radinger wrote: > Hello, > > I am running GRASS GIS 6.5 and want to run a python script > including a mapcaluculator-expression of a simple formula: > > A=if(B,C) > > grass.mapcalc("$upstream_shreve = if(${upstream_p

Re: [GRASS-user] mapcalc/mapcalculator in python script

2011-02-02 Thread Glynn Clements
Johannes Radinger wrote: > I am running GRASS GIS 6.5 and want to run a python script > including a mapcaluculator-expression of a simple formula: > > A=if(B,C) > > grass.mapcalc("$upstream_shreve = if(${upstream_part},${shreve})", > upstream_shreve = options['upstream_shreve'

Re: [GRASS-user] mapcalc problem in python script!!

2011-02-03 Thread Johannes Radinger
Hello again, just to give you some more information on my problem: I am running exactly following script: --- import sys import os import atexit import grass.script as grass import grass.script.setup as gsetup # set mapset/location/dba

Re: [GRASS-user] mapcalc problem in python script!!

2011-02-03 Thread Glynn Clements
Johannes Radinger wrote: > Somehow I didn't your answer via email, I just found it at > http://permalink.gmane.org/gmane.comp.gis.grass.user/38530 For whatever reason, GMX doesn't like my IP address, and bounces my emails. The problem is compounded by a "feature" of the mailing list software whi

Re: [GRASS-user] mapcalc problem in python script!!

2011-02-06 Thread Glynn Clements
Glynn Clements wrote: > > Somehow I didn't your answer via email, I just found it at > > http://permalink.gmane.org/gmane.comp.gis.grass.user/38530 > > For whatever reason, GMX doesn't like my IP address, and bounces my > emails. ... so there's not much point in emailing me off-list, as I canno

Re: [GRASS-user] mapcalc problem in python script!!

2011-02-07 Thread Johannes Radinger
Hey, Original-Nachricht > Datum: Fri, 4 Feb 2011 00:10:16 + > Von: Glynn Clements > An: grass-user@lists.osgeo.org > Betreff: Re: [GRASS-user] mapcalc problem in python script!! > > Johannes Radinger wrote: > > > Somehow I didn't your answ

Re: [GRASS-user] mapcalc problem in python script!!

2011-02-08 Thread Glynn Clements
Johannes Radinger wrote: > > > Somehow I didn't your answer via email, I just found it at > > > http://permalink.gmane.org/gmane.comp.gis.grass.user/38530 > > > > For whatever reason, GMX doesn't like my IP address, and bounces my > > emails. The problem is compounded by a "feature" of the maili

Re: [GRASS-user] mapcalc problem in python script!!

2011-02-17 Thread Johannes Radinger
Original-Nachricht > Datum: Wed, 9 Feb 2011 01:37:43 + > Von: Glynn Clements > An: > CC: grass-user@lists.osgeo.org > Betreff: Re: [GRASS-user] mapcalc problem in python script!! > > Johannes Radinger wrote: > > > > > Somehow I didn&#

Re: [GRASS-user] mapcalc problem in python script!!

2011-02-17 Thread Glynn Clements
Johannes Radinger wrote: > how should I proceed, how can I test if the variables are set correctly? Add some "print" statements to the script. -- Glynn Clements ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/li

Re: [GRASS-user] Mapcalc for rounding float values

2013-02-14 Thread Rebecca Bennett
Dear GRASS-Users, I have a map of local elevation that I would like to alter the values of and re-class as a experiment to aid visualisation & interpretation. 1) Currently the cells are floating point with z-values like 0.0151666768416021 - I would like to do is round the elevation values to 2

Re: [GRASS-user] Mapcalc for rounding float values

2013-02-14 Thread Hamish
Rebecca wrote: > I have a map of local elevation that I would like to alter the > values of and re-class as a experiment to aid visualisation & > interpretation. firstly, the r.reclass module might help, as may r.contour. > 1) Currently the cells are floating point with z-values like > 0.01516667

Re: [GRASS-user] Mapcalc for rounding float values

2013-02-14 Thread Hamish
Hamish wrote: > there are a couple ways to do it, here's one: >   r.mapcalc "map.2dp = int(0.5 + (map.15g * 100))/100.0" > > the 0.5 is added because int() truncates instead of > rounding. mind that if your values go negative, int() and floor() are not the same.. > another common way is with log

Re: [GRASS-user] Mapcalc for rounding float values

2013-02-15 Thread Glynn Clements
Hamish wrote: > there are a couple ways to do it, here's one: > r.mapcalc "map.2dp = int(0.5 + (map.15g * 100))/100.0" > > the 0.5 is added because int() truncates instead of rounding. Note that r.mapcalc has a round() function. -- Glynn Clements ___

Re: [GRASS-user] Mapcalc for rounding float values

2013-02-15 Thread Margherita Di Leo
Hi, On Fri, Feb 15, 2013 at 2:09 PM, Glynn Clements wrote: > > Hamish wrote: > > > there are a couple ways to do it, here's one: > > r.mapcalc "map.2dp = int(0.5 + (map.15g * 100))/100.0" > > > > the 0.5 is added because int() truncates instead of rounding. > > Note that r.mapcalc has a round()

Fwd: Re: [GRASS-user] mapcalc/mapcalculator in python script

2011-02-02 Thread Johannes Radinger
> > On 02/01/2011 03:28 PM, Johannes Radinger wrote: > > Hello, > > > > I am running GRASS GIS 6.5 and want to run a python script > > including a mapcaluculator-expression of a simple formula: > > > > A=if(B,C) > > > > grass.mapcalc("$upstream_shreve = if(${upstream_part},${shreve})", > >

[GRASS-user] Mapcalc to replace a range of values

2011-07-13 Thread Rebecca Bennett
Hello Grass users, I have a (hopefully) quick question - I would like to replace all values in a raster that fall in the range -0.01 to 0.01 (i.e. 0.01><-0.01) with 0 but can't quite work out how to express this in mapcalc. Can anyone set me on the right track? Thanks for reading, Rebecca __

Re: [GRASS-user] Mapcalc to replace a range of values

2011-07-13 Thread Marcello Gorini
r.mapcalc "new_raster=if(old_raster>-0.01 && old_raster<0.01,0,old_raster)" Cheers, Marcello. On Wed, Jul 13, 2011 at 10:10 AM, Rebecca Bennett wrote: > Hello Grass users, > > I have a (hopefully) quick question - I would like to replace all values in > a raster that fall in the range -0.01 to

Re: [GRASS-user] Mapcalc to replace a range of values

2011-07-13 Thread Saber Razmjooei
Or maybe you can use r.null: r.null map=YourRASTER setnull=-0.1-0.1 null=0 On Wed, 2011-07-13 at 14:10 +0100, Rebecca Bennett wrote: > Hello Grass users, > > I have a (hopefully) quick question - I would like to replace all > values in a raster that fall in the range -0.01 to 0.01 (i.e. > 0.01>

Re: [GRASS-user] Mapcalc to replace a range of values

2011-07-13 Thread Michael Barton
.@lists.osgeo.org wrote: > Date: Wed, 13 Jul 2011 14:10:38 +0100 (BST) > From: Rebecca Bennett > Subject: [GRASS-user] Mapcalc to replace a range of values > To: grass-user@lists.osgeo.org > Message-ID: <1310562638.15878.yahoomai...@web28412.mail.ukl.yahoo.com> > Content-Typ

Re: [GRASS-user] Mapcalc to replace a range of values

2011-07-14 Thread Rebecca Bennett
Thank you to Marcello, Saber and Michael - both the r.mapcalc and r.null methods proposed worked a treat :) best, Rebecca ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user