Closed blordcastillo closed 10 years ago
When I bring the geodatabase into my mxd, I get this ArcMap error message:
Unable to save. Check to make sure you have write access to the specified file and that there is enough space on the storage device to hold your document.
Sounds like you have the geodatabase Assignment5.gdb inside a folder named Assignment5.gdb. Change the name of the outer folder to Assignment5 (removing the .gdb).
Arcmap sees this and thinks that the first Assignment5.gdb is the geodatbase and the second one is a feature dataset, which leads to the unable to save error for some reason.
Correction: On line 18 (inside the getBands function) replace u'faustRed' with u'faustIR'.
Done. Missed that one on the copy-paste of those two sections.
Another correction? Should lines 50-51 pass getBands() instead of getbands (and numpy?) to the two functions? Or better yet, add a variable for getBands() and pass that variable, like this: myBands = getBands() mNDVI = mapalgebraNDVI(myBands) nNDVI = numpyNDVI(myBands)
Yes, I modified that on the posted assignment. Your method would work as well.
To make it clear, the numphNDVI function definition should have only bands
as an argument, not redBand, irband
. bands
is a tuple of two Raster objects (representing single band rasters).
meanwhile, by supplying getBands() as the argument to your calls of mapalgebraNDVI and numpyNDVI, you get the results of the getBands function, which is a tuple of two Raster objects.
In other words, those lines ultimately become:
mNDVI = mapalgebraNDVI(arcpy.Raster(u'faustRed'), arcpy.Raster(u'faustIR'))
and
nNDVI = numpyNDVI(arcpy.Raster(u'faustRed'), arcpy.Raster(u'faustIR'))
Wrapping up office hours for tonight. If anyone needs help in the next two days, please post your on github.
Geodatabase with sample data is now available at: https://www.dropbox.com/s/lo91vpjlh7c0a5i/Assignment5.gdb.zip I separated out the bands into red and new infrared, and clipped the size down so that is should not cause a memory error on 32-bit python. The image is Faust Park in Chesterfield.
I added several comments to the assignment. The most important is that you want to make sure to convert the integer rasters or numpy arrays to float before doing your math operations on them!