Re: [GRASS-user] looping r.mapcalc in a shell script

2014-04-04 Thread Blumentrath, Stefan
Hi Rajat,

If you send me your two files I can send you a line of code that should work.
In this case I will need to know if you work with GRASS 6 or 7 and your 
operating system...

Cheers
Stefan


From: Rajat Nayak [mailto:rajat27...@gmail.com]
Sent: 4. april 2014 04:47
To: Blumentrath, Stefan
Subject: Re: [GRASS-user] looping r.mapcalc in a shell script

Thank you Stefan for your reply.
One of the problems I'm facing with all the suggested codes is, the code is 
unable to find either of the file lists.
Both the filelists were created using g.mlist command, it it worked fine with 
other loops like reclass.
I will work again on your suggested line of thoughts, and hope will be able to 
crack it.
Regards
Rajat

Rajat Nayak

On Thu, Apr 3, 2014 at 5:38 PM, Blumentrath, Stefan 
stefan.blumentr...@nina.nomailto:stefan.blumentr...@nina.no wrote:
You could also combine your two lists using the paste command, then awk in 
order to create proper map calculator expressions, which you then can send to 
the map calculator through xargs.
That way you could process the maps in parallel (if you are on a 64bit system 
with multi cores)...

Something like (would likely require some adjustments, e.g. regarding field 
delimiters):
paste NDVIFILES VIQALIST | awk '{print \ $1 _MASK=$1 ' *  $2 \}' | xargs 
-P 4 r.mapcalc {}


Cheers
Stefan

-Original Message-
From: 
grass-user-boun...@lists.osgeo.orgmailto:grass-user-boun...@lists.osgeo.org 
[mailto:grass-user-boun...@lists.osgeo.orgmailto:grass-user-boun...@lists.osgeo.org]
 On Behalf Of rajatrn
Sent: 3. april 2014 10:31
To: grass-user@lists.osgeo.orgmailto:grass-user@lists.osgeo.org
Subject: [GRASS-user] looping r.mapcalc in a shell script

Hi,
I have two layer lists, NDVIFILES and VIQALIST, both developed using g.mlist 
command in GRASS.
Each file has 22 items in it. I would like to perform a simple raster 
calculation of the following form, Mask$NDVIFILES [i] = NDVIFILES[i] * 
VIQALIST[i] I'm unable to create a loop which can sequentially produce the 
required outputs.
I will be grateful if anyone can help me with creating a loop using bash/shell 
script.
I know it is simpler to do it in R but will be great if can be implemented on 
using grass terminal/shell.
Thank you in advance,
Sincerely,
Rajat



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/looping-r-mapcalc-in-a-shell-script-tp5132797.html
Sent from the Grass - Users mailing list archive at Nabble.com.
___
grass-user mailing list
grass-user@lists.osgeo.orgmailto:grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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

[GRASS-user] i.pca gives error

2014-04-04 Thread Martin van Brakel
Hi list,

i am processing plenty of modis subsets into a group called pca

when using WinGRASS it gives an error

GRASS 7.0.svn i.pca --overwrite input=pca output_prefix=_msub
Computing covariance matrix...
 100%
ERROR: No non-null values
GRASS 7.0.svn


can anybody help please?

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

Re: [GRASS-user] i.pca gives error

2014-04-04 Thread Martin van Brakel
that helps but it breaks there...


GRASS 7.0.svn i.pca --overwrite input=pca output_prefix=_msub
Computing covariance matrix...
 100%
Calculating principal components...
 100%
Rescaling to range 0,255...
 100%
Eigen values, (vectors), and [percent importance]:
GRASS 7.0.svn


On Fri, Apr 4, 2014 at 5:44 PM, Markus Neteler nete...@osgeo.org wrote:

 On Fri, Apr 4, 2014 at 1:47 PM, Martin van Brakel
 m.l.vanbra...@gmail.com wrote:
  Hi list,
 
  i am processing plenty of modis subsets into a group called pca
 
  when using WinGRASS it gives an error
 
  GRASS 7.0.svn i.pca --overwrite input=pca output_prefix=_msub
  Computing covariance matrix...
   100%
  ERROR: No non-null values
  GRASS 7.0.svn

 Did you set the computational region to the map beforehand?

 g.region rast=pca -p

 then
 i.pca ...

 See also:
 http://grasswiki.osgeo.org/wiki/Computational_region
 Since we currently have issues on the server (slow), see also the wiki
 mirror at:
 http://grass.fsv.cvut.cz/wiki-mirror/index.php/Computational_region

 hope this helps
 Markus

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

Re: [GRASS-user] i.pca gives error

2014-04-04 Thread Markus Neteler
On Fri, Apr 4, 2014 at 2:43 PM, Martin van Brakel
m.l.vanbra...@gmail.com wrote:
 that helps but it breaks there...


 GRASS 7.0.svn i.pca --overwrite input=pca output_prefix=_msub
 Computing covariance matrix...
  100%
 Calculating principal components...
  100%
 Rescaling to range 0,255...
  100%
 Eigen values, (vectors), and [percent importance]:
 GRASS 7.0.svn

Please try (just for fun) to not use the leading _ in the prefix parameter.

Please also post the output of

g.version -g

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


Re: [GRASS-user] calculation valley floor width in GRASS or some index indicating valley floor width?

2014-04-04 Thread jwd
On Tue, 1 Apr 2014 00:52:53 -0700 (PDT)
Helmut Kudrnovsky hel...@web.de wrote:

 hi,
 
 any hint or pointer to some grass gis procedure/literature/web
 link/etc how to caculate valley floor width in GRASS or some index
 indicating valley floor width.
 
 the idea is to get some measure how wide or narrow a valley is.
 
 thanks in advance!
 

That is a very involved question, starting with how you define the
valley floor quantitatively to begin with.  You could calculate an index
of concavity or average slope and plot the point where the measure (e.g.
concavity of slope, or average slope) drops below a certain value that
would be a valley floor boundary by definition.  There should be
several grass tools that could be applied.

JWDougherty

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


Re: [GRASS-user] calculation valley floor width in GRASS or some index indicating valley floor width?

2014-04-04 Thread Hamish
Helmut wrote:

  any hint or pointer to some grass gis procedure/literature/web
  link/etc how to caculate valley floor width in GRASS or some index
  indicating valley floor width.
 
  the idea is to get some measure how wide or narrow a valley is.

JWDougherty wrote:
 That is a very involved question, starting with how you define the
 valley floor quantitatively to begin with.  You could calculate an index
 of concavity or average slope and plot the point where the measure (e.g.
 concavity of slope, or average slope) drops below a certain value that
 would be a valley floor boundary by definition.  There should be
 several grass tools that could be applied.

e.g. run 'r.param.scale param=feature' to pull out channels, then
r.watershed to make a rivers map and r.cost to calculate distance
from the center-line (rivers) to the edge of the valley. Of course
rivers are not always in the center of the valley, perhaps take the
r.param.scale valleys and run r.cost to find the cost to the middle.
Then extract the 'ridge lines' of the distance-cost map, again with
r.param.scale, and double the peak values along the ridge.

It is very similar to the classic 'river mile' problem, to define well
a line down the center of the channel when nature isn't as simple as
a pipe and valleys merge, islands happen, etc.


Hamish

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