Re: [GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-27 Thread Vaclav Petras
On Tue, Jan 27, 2015 at 12:00 PM, Thomas Adams tea...@gmail.com wrote:

 Running as (1) is where I get the r.mask errors I have been seeing; I get
 the errors both when I simply remove any existing MASKs (r.mask -r) or
 where I attempt to set the MASK.


Can you please post again what are the errors. It is not clear from the
previous posts. Also, if you are posting script it is best to post a file,
not a screenshot, or just copy and paste the script to the email if it is
short enough.

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

Re: [GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-27 Thread Thomas Adams
Vaclav,

That was not a screen shot, just fg  bg colors of the text (I copied 
pasted from my Mac term window — sorry for the embellishments). The errors
I have been getting is this:

Traceback (most recent call last):
  File /usr/local/grass-7.0.0beta3/scripts/r.mask, line 71, in module
import grass.script as grass
ImportError: No module named grass.script

same result for RC1. My script is attached…

Tom


On Tue, Jan 27, 2015 at 12:57 PM, Vaclav Petras wenzesl...@gmail.com
wrote:


 On Tue, Jan 27, 2015 at 12:00 PM, Thomas Adams tea...@gmail.com wrote:

 Running as (1) is where I get the r.mask errors I have been seeing; I get
 the errors both when I simply remove any existing MASKs (r.mask -r) or
 where I attempt to set the MASK.


 Can you please post again what are the errors. It is not clear from the
 previous posts. Also, if you are posting script it is best to post a file,
 not a screenshot, or just copy and paste the script to the email if it is
 short enough.

 Thanks,
 Vaclav




-- 
Thomas E Adams, III
718 McBurney Drive
Lebanon, OH 45036

1 (513) 739-9512 (cell)


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

Re: [GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-27 Thread Markus Neteler
Tom,

On Tue, Jan 27, 2015 at 8:38 AM, Hermann Peifer pei...@gmx.eu wrote:
 On 2015-01-26 23:57, Thomas Adams wrote:

 All:

 I have a GRASS bash shell script where all my GRASS commands
 (7.0.0beta3) execute just fine except for my call to set a MASK:

 r.mask --overwrite input=$basin_mask@$MAPSET

 I get this error...

 Traceback (most recent call last):
File /usr/local/grass-7.0.0beta3/scripts/r.mask, line 71, in module

Please consider to update to RC1, we have fixed all these errors.

  import grass.script as grass
 ImportError: No module named grass.script


 There is no input parameter in G7:r.mask [1]. This info is however missing
 in [2], as I just noted. I am not sure of the behaviour of 7.0.0beta3, but
 my GRASS 7.1.svn comes up with:

 ERROR: Sorry, input is not a valid parameter

 Hermann

 [1] http://grass.osgeo.org/grass70/manuals/r.mask.html
 [2] http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures#Rastermodulechanges

The lookup mechanism should now work fine (otherwise please report),
just beta3 didn't have it yet.

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


Re: [GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-27 Thread Thomas Adams
Vaclav,

Fantastic; that did the trick! I figured the issue had to be something like
that, but I just had not been able to find it and, until now, this had not
been an issue.

Thank you very much…

Best regards,
Tom

On Tue, Jan 27, 2015 at 1:30 PM, Vaclav Petras wenzesl...@gmail.com wrote:



 On Tue, Jan 27, 2015 at 3:04 PM, Thomas Adams tea...@gmail.com wrote:

 Vaclav,

 That was not a screen shot, just fg  bg colors of the text (I copied 
 pasted from my Mac term window — sorry for the embellishments).


 I see it now. I was confused because it looks really bad at my end.


 The errors I have been getting is this:

 Traceback (most recent call last):
   File /usr/local/grass-7.0.0beta3/scripts/r.mask, line 71, in module
 import grass.script as grass
 ImportError: No module named grass.script


 ImportError: No module named grass.script means that Python does not
 see package (grass.script or also grass). You miss the PYTHONPATH variable
 which says where Python packages are:

 export PYTHONPATH=$GISBASE/etc/python:$PYTHONPATH

 See the following in case you are missing some other variable which would
 be important for you (probably none now):


 http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Bash_examples_.28GNU.2FLinux.29

 If you would have a lot of problems with setting the environment, use
 GRASS_BATCH_JOB variable with the grass command (see grass70 --help).

 I hope this helps,
 Vaclav

 same result for RC1. My script is attached…

 Tom


 On Tue, Jan 27, 2015 at 12:57 PM, Vaclav Petras wenzesl...@gmail.com
 wrote:


 On Tue, Jan 27, 2015 at 12:00 PM, Thomas Adams tea...@gmail.com wrote:

 Running as (1) is where I get the r.mask errors I have been seeing; I
 get the errors both when I simply remove any existing MASKs (r.mask -r) or
 where I attempt to set the MASK.


 Can you please post again what are the errors. It is not clear from the
 previous posts. Also, if you are posting script it is best to post a file,
 not a screenshot, or just copy and paste the script to the email if it is
 short enough.

 Thanks,
 Vaclav






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

Re: [GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-27 Thread Vaclav Petras
On Tue, Jan 27, 2015 at 3:04 PM, Thomas Adams tea...@gmail.com wrote:

 Vaclav,

 That was not a screen shot, just fg  bg colors of the text (I copied 
 pasted from my Mac term window — sorry for the embellishments).


I see it now. I was confused because it looks really bad at my end.


 The errors I have been getting is this:

 Traceback (most recent call last):
   File /usr/local/grass-7.0.0beta3/scripts/r.mask, line 71, in module
 import grass.script as grass
 ImportError: No module named grass.script


ImportError: No module named grass.script means that Python does not see
package (grass.script or also grass). You miss the PYTHONPATH variable
which says where Python packages are:

export PYTHONPATH=$GISBASE/etc/python:$PYTHONPATH

See the following in case you are missing some other variable which would
be important for you (probably none now):

http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Bash_examples_.28GNU.2FLinux.29

If you would have a lot of problems with setting the environment, use
GRASS_BATCH_JOB variable with the grass command (see grass70 --help).

I hope this helps,
Vaclav

same result for RC1. My script is attached…

 Tom


 On Tue, Jan 27, 2015 at 12:57 PM, Vaclav Petras wenzesl...@gmail.com
 wrote:


 On Tue, Jan 27, 2015 at 12:00 PM, Thomas Adams tea...@gmail.com wrote:

 Running as (1) is where I get the r.mask errors I have been seeing; I
 get the errors both when I simply remove any existing MASKs (r.mask -r) or
 where I attempt to set the MASK.


 Can you please post again what are the errors. It is not clear from the
 previous posts. Also, if you are posting script it is best to post a file,
 not a screenshot, or just copy and paste the script to the email if it is
 short enough.

 Thanks,
 Vaclav




 --
 Thomas E Adams, III
 718 McBurney Drive
 Lebanon, OH 45036

 1 (513) 739-9512 (cell)


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

Re: [GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-27 Thread Thomas Adams
Anna,

Below is my script. I am running on Ubuntu 10.10, GRASS 7 RC1 (built
today). I have tried running my script two ways:

(1) external from GRASS, where I set the GRASS environment (the attached
script) — this is how I have done almost all my GRASS scripting for years

(2) I remove the section where I set the GRASS environment and run from the
GRASS prompt — this works perfectly fine (I had not tried this
previously when I first reported this problem)

Running as (1) is where I get the r.mask errors I have been seeing; I get
the errors both when I simply remove any existing MASKs (r.mask -r) or
where I attempt to set the MASK.

Cheers!
Tom

#!/bin/bash


# Read the GRASS LOCATION and BASIN MASK as command line arguments

location=$1

basin_mask=$2


###

# Set GRASS Environment

###

GISDBASE=/home/tadams/grass/data

MAPSET=$USER

LOCATION_NAME=$location


export USER=$USER

export GISBASE=/usr/local/grass-7.0.0RC1

export GISDBASE=$GISDBASE

export MAPSET=$USER

export LOCATION_NAME=$location

export GISRC=$HOME/.grass7/rc

export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib



###

# High resolution DEM analysis

###

echo Starting GRASS processing...

r.mask -r

echo Set GRASS region...

g.region rast=dem_filled@$MAPSET


g.region -dp e=509808.1892 w=170352.36895319 n=-504196.824054
s=-739405.268029


echo Running r.watershed...

r.watershed --overwrite elevation=dem_filled@$MAPSET threshold=75000
max_slope_length=1000 accumulation=basin_accum tci=basin_atanb
drainage=basin_dir basin=basin_basins stream=basin_streamsegs
length_slope=basin_slopelen slope_steepness=basin_steep convergence=5
memory=300


r.slope.aspect --overwrite elevation=dem_filled@$MAPSET
slope=basin_slope_pct format=percent


r.mapcalc expression=basin_slope=basin_slope_pct/100. --overwrite




###

# 250 meter resolution DEM analysis

###


g.region res=250


echo Running r.resamp.stats...

r.resamp.stats --overwrite input=basin_accum@$MAPSET output=basin_accum_250
method=maximum

r.resamp.stats --overwrite input=basin_slope@$MAPSET output=basin_slope_250
method=average


echo Set GRASS raster mask...

r.mask raster=$basin_mask@$MAPSET maskcats=* --overwrite


echo Calculate Drainage Area (in sq mi)...

r.mapcalc  expression=da_mi=basin_accum_250*900/2589988. --overwrite


echo Calculate TOPWIDTH (in meters)...

r.mapcalc expression=topwidth=(11.33*exp(da_mi,0.476))*0.3048  --overwrite


r.mapcalc
expression=nc=exp(basin_slope_250,0.272)*exp(basin_accum_250*900,-0.00011)*0.05
--overwrite


echo Calculate alpha...

r.mapcalc
expression=alpha=exp(basin_slope_250,0.5)/(nc*exp(topwidth,0.7))
--overwrite


rm rutpix_Q0CHN


r.out.gdal input=alpha@$MAPSET output=rutpix_Q0CHN format=GTiff



# Cleanup -- Remove temporary GRASS files

$GISBASE/etc/clean_temp



On Tue, Jan 27, 2015 at 8:45 AM, Anna Petrášová kratocha...@gmail.com
wrote:



 On Tue, Jan 27, 2015 at 10:41 AM, Thomas Adams tea...@gmail.com wrote:

 Anna,

 I'm building RC1 on a different Linux box (where I had beta3); I'll try
 again and  if I get the same error, I'll offer up an example — how would I
 do that? tar things up and put it on GoogleDrive?


 I was thinking ideally about a short .sh file which can be attached. I
 don't know how complicated that would be for you.


 Tom

 On Tue, Jan 27, 2015 at 8:34 AM, Anna Petrášová kratocha...@gmail.com
 wrote:



 On Tue, Jan 27, 2015 at 8:31 AM, Thomas Adams tea...@gmail.com wrote:

 Markus,

 Thank you for your help; I did try using RC1 (which I built shortly
 after it's release) and got the same error -- but I'll try again. I can't
 do that right now because I just kicked-off something else in a different
 GRASS LOCATION that's taking a while to process. So, I won't be able to try
 again until later.


 Maybe a short but complete example would help us to test?

 Anna


 Thank you,
 Tom

 On Tue, Jan 27, 2015 at 1:39 AM, Markus Neteler nete...@osgeo.org
 wrote:

 Tom,

 On Tue, Jan 27, 2015 at 8:38 AM, Hermann Peifer pei...@gmx.eu wrote:
  On 2015-01-26 23:57, Thomas Adams wrote:
 
  All:
 
  I have a GRASS bash shell script where all my GRASS commands
  (7.0.0beta3) execute just fine except for my call to set a MASK:
 
  r.mask --overwrite input=$basin_mask@$MAPSET
 
  I get this error...
 
  Traceback (most recent call last):
 File /usr/local/grass-7.0.0beta3/scripts/r.mask, line 71, in
 module

 Please consider to update to RC1, we have fixed all these errors.

   import grass.script as grass
  ImportError: No module named 

Re: [GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-27 Thread Thomas Adams
Markus,

Thank you for your help; I did try using RC1 (which I built shortly after
it's release) and got the same error -- but I'll try again. I can't do that
right now because I just kicked-off something else in a different GRASS
LOCATION that's taking a while to process. So, I won't be able to try again
until later.

Thank you,
Tom

On Tue, Jan 27, 2015 at 1:39 AM, Markus Neteler nete...@osgeo.org wrote:

 Tom,

 On Tue, Jan 27, 2015 at 8:38 AM, Hermann Peifer pei...@gmx.eu wrote:
  On 2015-01-26 23:57, Thomas Adams wrote:
 
  All:
 
  I have a GRASS bash shell script where all my GRASS commands
  (7.0.0beta3) execute just fine except for my call to set a MASK:
 
  r.mask --overwrite input=$basin_mask@$MAPSET
 
  I get this error...
 
  Traceback (most recent call last):
 File /usr/local/grass-7.0.0beta3/scripts/r.mask, line 71, in
 module

 Please consider to update to RC1, we have fixed all these errors.

   import grass.script as grass
  ImportError: No module named grass.script
 
 
  There is no input parameter in G7:r.mask [1]. This info is however
 missing
  in [2], as I just noted. I am not sure of the behaviour of 7.0.0beta3,
 but
  my GRASS 7.1.svn comes up with:
 
  ERROR: Sorry, input is not a valid parameter
 
  Hermann
 
  [1] http://grass.osgeo.org/grass70/manuals/r.mask.html
  [2]
 http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures#Rastermodulechanges

 The lookup mechanism should now work fine (otherwise please report),
 just beta3 didn't have it yet.

 Markus

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

Re: [GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-27 Thread Anna Petrášová
On Tue, Jan 27, 2015 at 8:31 AM, Thomas Adams tea...@gmail.com wrote:

 Markus,

 Thank you for your help; I did try using RC1 (which I built shortly after
 it's release) and got the same error -- but I'll try again. I can't do that
 right now because I just kicked-off something else in a different GRASS
 LOCATION that's taking a while to process. So, I won't be able to try again
 until later.


Maybe a short but complete example would help us to test?

Anna


 Thank you,
 Tom

 On Tue, Jan 27, 2015 at 1:39 AM, Markus Neteler nete...@osgeo.org wrote:

 Tom,

 On Tue, Jan 27, 2015 at 8:38 AM, Hermann Peifer pei...@gmx.eu wrote:
  On 2015-01-26 23:57, Thomas Adams wrote:
 
  All:
 
  I have a GRASS bash shell script where all my GRASS commands
  (7.0.0beta3) execute just fine except for my call to set a MASK:
 
  r.mask --overwrite input=$basin_mask@$MAPSET
 
  I get this error...
 
  Traceback (most recent call last):
 File /usr/local/grass-7.0.0beta3/scripts/r.mask, line 71, in
 module

 Please consider to update to RC1, we have fixed all these errors.

   import grass.script as grass
  ImportError: No module named grass.script
 
 
  There is no input parameter in G7:r.mask [1]. This info is however
 missing
  in [2], as I just noted. I am not sure of the behaviour of 7.0.0beta3,
 but
  my GRASS 7.1.svn comes up with:
 
  ERROR: Sorry, input is not a valid parameter
 
  Hermann
 
  [1] http://grass.osgeo.org/grass70/manuals/r.mask.html
  [2]
 http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures#Rastermodulechanges

 The lookup mechanism should now work fine (otherwise please report),
 just beta3 didn't have it yet.

 Markus






 ___
 grass-user mailing list
 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

Re: [GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-27 Thread Thomas Adams
Anna,

I'm building RC1 on a different Linux box (where I had beta3); I'll try
again and  if I get the same error, I'll offer up an example — how would I
do that? tar things up and put it on GoogleDrive?

Tom

On Tue, Jan 27, 2015 at 8:34 AM, Anna Petrášová kratocha...@gmail.com
wrote:



 On Tue, Jan 27, 2015 at 8:31 AM, Thomas Adams tea...@gmail.com wrote:

 Markus,

 Thank you for your help; I did try using RC1 (which I built shortly after
 it's release) and got the same error -- but I'll try again. I can't do that
 right now because I just kicked-off something else in a different GRASS
 LOCATION that's taking a while to process. So, I won't be able to try again
 until later.


 Maybe a short but complete example would help us to test?

 Anna


 Thank you,
 Tom

 On Tue, Jan 27, 2015 at 1:39 AM, Markus Neteler nete...@osgeo.org
 wrote:

 Tom,

 On Tue, Jan 27, 2015 at 8:38 AM, Hermann Peifer pei...@gmx.eu wrote:
  On 2015-01-26 23:57, Thomas Adams wrote:
 
  All:
 
  I have a GRASS bash shell script where all my GRASS commands
  (7.0.0beta3) execute just fine except for my call to set a MASK:
 
  r.mask --overwrite input=$basin_mask@$MAPSET
 
  I get this error...
 
  Traceback (most recent call last):
 File /usr/local/grass-7.0.0beta3/scripts/r.mask, line 71, in
 module

 Please consider to update to RC1, we have fixed all these errors.

   import grass.script as grass
  ImportError: No module named grass.script
 
 
  There is no input parameter in G7:r.mask [1]. This info is however
 missing
  in [2], as I just noted. I am not sure of the behaviour of 7.0.0beta3,
 but
  my GRASS 7.1.svn comes up with:
 
  ERROR: Sorry, input is not a valid parameter
 
  Hermann
 
  [1] http://grass.osgeo.org/grass70/manuals/r.mask.html
  [2]
 http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures#Rastermodulechanges

 The lookup mechanism should now work fine (otherwise please report),
 just beta3 didn't have it yet.

 Markus






 ___
 grass-user mailing list
 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

Re: [GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-27 Thread Anna Petrášová
On Tue, Jan 27, 2015 at 10:41 AM, Thomas Adams tea...@gmail.com wrote:

 Anna,

 I'm building RC1 on a different Linux box (where I had beta3); I'll try
 again and  if I get the same error, I'll offer up an example — how would I
 do that? tar things up and put it on GoogleDrive?


I was thinking ideally about a short .sh file which can be attached. I
don't know how complicated that would be for you.


 Tom

 On Tue, Jan 27, 2015 at 8:34 AM, Anna Petrášová kratocha...@gmail.com
 wrote:



 On Tue, Jan 27, 2015 at 8:31 AM, Thomas Adams tea...@gmail.com wrote:

 Markus,

 Thank you for your help; I did try using RC1 (which I built shortly
 after it's release) and got the same error -- but I'll try again. I can't
 do that right now because I just kicked-off something else in a different
 GRASS LOCATION that's taking a while to process. So, I won't be able to try
 again until later.


 Maybe a short but complete example would help us to test?

 Anna


 Thank you,
 Tom

 On Tue, Jan 27, 2015 at 1:39 AM, Markus Neteler nete...@osgeo.org
 wrote:

 Tom,

 On Tue, Jan 27, 2015 at 8:38 AM, Hermann Peifer pei...@gmx.eu wrote:
  On 2015-01-26 23:57, Thomas Adams wrote:
 
  All:
 
  I have a GRASS bash shell script where all my GRASS commands
  (7.0.0beta3) execute just fine except for my call to set a MASK:
 
  r.mask --overwrite input=$basin_mask@$MAPSET
 
  I get this error...
 
  Traceback (most recent call last):
 File /usr/local/grass-7.0.0beta3/scripts/r.mask, line 71, in
 module

 Please consider to update to RC1, we have fixed all these errors.

   import grass.script as grass
  ImportError: No module named grass.script
 
 
  There is no input parameter in G7:r.mask [1]. This info is however
 missing
  in [2], as I just noted. I am not sure of the behaviour of
 7.0.0beta3, but
  my GRASS 7.1.svn comes up with:
 
  ERROR: Sorry, input is not a valid parameter
 
  Hermann
 
  [1] http://grass.osgeo.org/grass70/manuals/r.mask.html
  [2]
 http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures#Rastermodulechanges

 The lookup mechanism should now work fine (otherwise please report),
 just beta3 didn't have it yet.

 Markus






 ___
 grass-user mailing list
 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

Re: [GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-26 Thread Hermann Peifer

On 2015-01-26 23:57, Thomas Adams wrote:

All:

I have a GRASS bash shell script where all my GRASS commands
(7.0.0beta3) execute just fine except for my call to set a MASK:

r.mask --overwrite input=$basin_mask@$MAPSET

I get this error...

Traceback (most recent call last):
   File /usr/local/grass-7.0.0beta3/scripts/r.mask, line 71, in module
 import grass.script as grass
ImportError: No module named grass.script



There is no input parameter in G7:r.mask [1]. This info is however 
missing in [2], as I just noted. I am not sure of the behaviour of 
7.0.0beta3, but my GRASS 7.1.svn comes up with:


ERROR: Sorry, input is not a valid parameter

Hermann

[1] http://grass.osgeo.org/grass70/manuals/r.mask.html
[2] http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures#Rastermodulechanges

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


[GRASS-user] Getting an error using r.mask in a GRASS shell script

2015-01-26 Thread Thomas Adams
All:

I have a GRASS bash shell script where all my GRASS commands (7.0.0beta3)
execute just fine except for my call to set a MASK:

r.mask --overwrite input=$basin_mask@$MAPSET

I get this error...

Traceback (most recent call last):
  File /usr/local/grass-7.0.0beta3/scripts/r.mask, line 71, in module
import grass.script as grass
ImportError: No module named grass.script


I have never previously encountered this kind of thing calling r.mask in
any of my GRASS scripts.

Any thoughts??

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