Subject: Marine Geospatial Ecology Tools (MGET) help
Text archives
From: | Jason Roberts <> |
---|---|
To: | "Van Lier, Olivier" <> |
Cc: | |
Subject: | Re: [mget-help] Calculate Species Diversity Index for Polygons |
Date: | Tue, 30 Jul 2013 20:08:04 -0400 |
I was able to diagnose the problem. The bug occurs when there is only one polygon. I never tested that scenario; sorry about that.
I haven't had time to prepare a fix, but you can work around it by defining a second zone. It shouldn't matter where the zone is, how big it is, or if any points are in it.
I'll get back to you when I have a fix ready.
Best,
Jason
Jason Roberts <> wrote:
Oliver,
Thanks for your interest in MGET. Sorry about this problem. I am travelling and cannot diagnose it immediately but should be able get back to you in a couple of days.
My first guess is that the R vegan package changed its return types. As a work around, you could try temporarily downgrading to R 2.15.x or R 2.14.x.
Best,
Jason
"Van Lier, Olivier" <> wrote:
Greetings,
What a wonderful contribution! I have just recently come across your toolset and began exploring it this morning. I was hoping to quickly implement the "Calculate
Species Diversity Index for Polygons" but for some reason I get the following error when the script attempts to write the result back into the polygon shapefile: AttributeError: 'float' object has no attribute 'has_key'. The full message from ArcGIS dialogue
box is pasted below.
Please find attached the sample data I was using: any insight would be gratefully appreciated.
Running environment: Windows 7 Professional, ArcGIS 10.1 SP1, Python 2.7, R win-library 2.14
Kind Regards,
Olivier
Olivier van Lier
Geospatial Research Assistant / Adjoint de Recherche Géospatiale
Natural Resources Canada / Ressources naturelles Canada
Canadian Wood Fibre Centre / Centre canadien sur la fibre de bois
Canadian Forest Service / Service canadien des forêts
Tel/Tél: +1 709-637-4944 | Fax/Fac: +1 709-637-4910
Executing: SpeciesDiversityCalculateDiversityIndexForArcGISPolygons
P "
Start Time: Mon Jul 29 14:34:14 2013
Running script SpeciesDiversityCalculateDiversityIndexForArcGISPolygons...
Intersecting the points with the polygons.
Summing species counts per polygon.
Reading species counts into memory.
Query complete: 0:00:00 elapsed, 1 rows retrieved, 0:00:00.220000 per row.
Writing species diversity index values to the polygons.
Update complete: 0:00:00 elapsed, 0 rows updated, 0 deleted, 1 unchanged,
0:00:00.006000 per row.
AttributeError: 'float' object has no attribute 'has_key'
Traceback (most recent call last):
File "C:\Program Files\GeoEco\ArcGISToolbox\Scripts\SpeciesDiversityCalculateDiversityIndexForArcGISPolygons.py",
line 5, in <module>
ExecuteMethodFromCommandLineAsArcGISTool('GeoEco.SpatialAnalysis.Diversity',
'SpeciesDiversity', 'CalculateDiversityIndexForArcGISPolygons')
File "C:\Python27\ArcGIS10.1\lib\site-packages\GeoEco\ArcGISScripts.py",
line 210, in ExecuteMethodFromCommandLineAsArcGISTool
exec sourceCode in globals(), locals()
File "<string>", line 1, in <module>
File "C:\Python27\ArcGIS10.1\lib\site-packages\GeoEco\SpatialAnalysis\Diversity.py",
line 158, in CalculateDiversityIndexForArcGISPolygons
if indexValues.has_key(fidStr):
AttributeError: 'float' object has no attribute 'has_key'
Failed to execute (SpeciesDiversityCalculateDiversityIndexForArcGISPolygons).
Failed at Mon Jul 29 14:34:22 2013 (Elapsed Time: 8.00 seconds)