Re: [GRASS-user] execGRASS("r.diversity"): [Error 3] Cannot find path specified \\.grass7\\r.li

2014-05-21 Thread Sandra MacFadyen
Hi Glynn,

Thank you so much for your response.
I thought the easiest thing (since my python skills are limited) would be to
copy the contents of "%APPDATA%\GRASS7" to
"D:/Bands_processed1/.grass7/r.li", which I have done. I then created a
configuration file using r.li.setup in this directory as follows:

"conf_diversity_5.0"
SAMPLINGFRAME 0|0|1|1
SAMPLEAREA -1|-1|0.010526315789473684|0.009487666034155597
MOVINGWINDOW

Now when running the code, I get the following error:

> execGRASS("r.diversity",flags="overwrite",
parameters=list(input="s1993_tm5_rad.1", prefix="s1993_tm5_rad_divers.1",
alpha=0.5, size=5))
ERROR: Illegal areas disposition
ERROR: Illegal areas disposition
ERROR: Illegal areas disposition
ERROR: Illegal areas disposition
All works are terminated

The sample area didn't look right to me as my bounding area is, Top: 7389715
| Left: 272685 | Right: 506715 | Bottom: 7179985 in UTM Zone 36S. So, I
change the conf_diversity_5.0 file manually but I still get the same error
:( Any suggestions would be appreciated.

Thanks again
Sandra

-Original Message-
From: Glynn Clements [mailto:gl...@gclements.plus.com] 
Sent: 21 May 2014 07:39 PM
To: Sandra MacFadyen
Cc: grass-user@lists.osgeo.org; grass-...@lists.osgeo.org
Subject: Re: [GRASS-user] execGRASS("r.diversity"): [Error 3] Cannot find
path specified \\.grass7\\r.li


[CC to grass-dev]

Sandra MacFadyen wrote:

>   File "C:/Program Files (x86)/GRASS GIS 
> 7.0.0beta2/scripts/r.diversity.py",
> line 116, in main
> os.mkdir(rlidir)
> WindowsError: [Error 3] The system cannot find the path specified:
> 'D:/Bands_processed1\\.grass7\\r.li'

r.diversity.py is broken on Windows:

home = os.path.expanduser('~')
rlidir = os.path.join(home, '.grass7', 'r.li')

The script tries to create an r.li subdirectory, but fails because the
parent directory doesn't exist.

$HOME/.grass7 is correct for Unix, but on Windows it's %APPDATA%\GRASS7.
>From lib/init/grass.py:

# configuration directory
grass_env_file = None  # see check_shell()
if sys.platform == 'win32':
grass_config_dirname = "GRASS7"
grass_config_dir = os.path.join(os.getenv('APPDATA'),
grass_config_dirname)
else:
grass_config_dirname = ".grass7"
grass_config_dir = os.path.join(os.getenv('HOME'),
grass_config_dirname)

--
Glynn Clements 

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


Re: [GRASS-user] execGRASS("r.diversity"): [Error 3] Cannot find path specified \\.grass7\\r.li

2014-05-21 Thread Glynn Clements

[CC to grass-dev]

Sandra MacFadyen wrote:

>   File "C:/Program Files (x86)/GRASS GIS 7.0.0beta2/scripts/r.diversity.py",
> line 116, in main
> os.mkdir(rlidir)
> WindowsError: [Error 3] The system cannot find the path specified:
> 'D:/Bands_processed1\\.grass7\\r.li'

r.diversity.py is broken on Windows:

home = os.path.expanduser('~')
rlidir = os.path.join(home, '.grass7', 'r.li')

The script tries to create an r.li subdirectory, but fails because the
parent directory doesn't exist.

$HOME/.grass7 is correct for Unix, but on Windows it's
%APPDATA%\GRASS7. From lib/init/grass.py:

# configuration directory
grass_env_file = None  # see check_shell()
if sys.platform == 'win32':
grass_config_dirname = "GRASS7"
grass_config_dir = os.path.join(os.getenv('APPDATA'), 
grass_config_dirname)
else:
grass_config_dirname = ".grass7"
grass_config_dir = os.path.join(os.getenv('HOME'), grass_config_dirname)

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


[GRASS-user] execGRASS("r.diversity"): [Error 3] Cannot find path specified \\.grass7\\r.li

2014-05-21 Thread Sandra MacFadyen
Hi All,

I am new to GRASS and have a problem executing the r.diversity function via
R 3.1.0 and GRASS 7beta2:

When running the code:

# Calculate spectral diversity per band with windows size 5x5
execGRASS("r.diversity",flags="overwrite", parameters=list(input="name.1",
prefix="name_divers.1", alpha=0.5, size=5))

I get the following error:

Traceback (most recent call last):
  File "C:/Program Files (x86)/GRASS GIS 7.0.0beta2/scripts/r.diversity.py",
line 272, in 
sys.exit(main())
  File "C:/Program Files (x86)/GRASS GIS 7.0.0beta2/scripts/r.diversity.py",
line 116, in main
os.mkdir(rlidir)
WindowsError: [Error 3] The system cannot find the path specified:
'D:/Bands_processed1\\.grass7\\r.li'
Warning message:
running command '"C:/Program Files (x86)/GRASS GIS
7.0.0beta2/extrabin/python.exe" "C:/Program Files (x86)/GRASS GIS
7.0.0beta2/scripts/"r.diversity.py --overwrite input=s1993_tm5_rad.1
prefix=s1993_tm5_rad_divers.1 alpha=0.5 size=5' had status 1 

I have loaded all the correct libraries and my GRASS environment variables
etc are set ok since I can successfully run other GRASS functions like
r.neighbors:

# Calculate spectral variance per band with windows size 5x5: WORKS FINE
execGRASS("r.neighbors",flags="overwrite", parameters=list(input="name.1",
output="name_var.1", method="variance", size=5))

Might it have something to do with the location of python.exe since I also
running ArcGIS so my environmental settings are PATH: C:\Python27\ArcGIS10.1
or maybe the r.li problems in GRASS 7
(http://osdir.com/ml/grass-user-gis/2014-02/msg00166.html) 

FYI I am running the following:
GRASS GIS 7.0.0beta2 (code revision: 59858) 
R 3.1.0 (+ Revolution R Enterprise 7.0)
Python 2.7.6 (+ IDLE 2.7.2)
ArcGIS 10.1
Windows 7 Enterprise (Service Pack 1) 64-bit (* but I'm running all above
software as 32-bit)

I would very much appreciate your help.

Thank you
Sandra

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