How to run batch process to get Zonal statistics from multiple layer data set
By wasantha in ERDAS Software Forum
I have a raster data set with 168 data layers. I am trying to write mean values of each layer to a vector attribute table (it defines my zones of interests). I have done this using "zonal statistics", but need to run the process 168 times!!!
Can any one please help me to run this in a batch process. Even a different approach would help.
Thanks in advance
----------------------------------
You were sent this email because you opted to receive email notifications when someone created a new thread, or replied to a topic within this forum, ERDAS Software Forum.
To unsubscribe:
Re: How to run batch process to get Zonal statistics from multiple layer data set
By Donn Rodekohr in ERDAS Software Forum
Are you sure this is what you want to do? 168 layers seems to be a bit extreme. To my recollection satellite remote sensing has not been around that long, so it can't be satellite images...
Probably the quickest way to get the mean and other stats from your vector polygons would be to use these polygons as training fields within a classification procedure. Use your 168 band image as the source image, your infinite number of polygons as training fields, load them into the supervised classification editor and compute the statistics.
I've never dealt with 168 band image so the process may crash but maybe not. Try it an see.
----------------------------------
You were sent this email because you opted to receive email notifications when someone responded to this thread.
By wasantha in ERDAS Software Forum
Thanks for the note. Let me clarify this again.
the 168 layers represent NOAA AVHRR NDVI data for 7 years from 2000 to 2006. Each year has 24 datasets i.e. Maximum NDVI composites derived for each 15 days period. So each month has 2 data sets. Then, 2*12*7 makes 168 layers.
My vector layer has 24 ecological regions. what I need to do is to get the mean NDVI value for each ecological region using these 168 different data layers. I hope this is clear now.
Thanks
By Donn Rodekohr in ERDAS Software Forum
Perhaps the batch programming gurus will have some ideas, but the way you describe the problem and the data sets, I don't see any way to BATCH this process.
Don't you have a grad student you can dump this project onto?
I'm also getting a quiver in my liver about having a shapefile with that many attributes. I'm thinking it may exceed some limits with ESRI as well.
Interesting project.
By Rutger in ERDAS Software Forum
In the vector menu you can find a tool called 'zonal statistics'. If you try it for just 1 layer, and select the batch option you can save the command to a .bcf file. Then you somehow need to copy that line 167 times and change two arguments, the selected layer, en the name of the output column.
I cant think of a way to do it fancy in Erdas, but if you have some scripting experience it should not be to hard to generate the 168 lines you need. It could easily be done in a spreadsheet program like MS Excel or OO Calc as well. Once you have all the lines, simply open the batch command file in Erdas and run. If your shapefile is larger (boundingbox) then the raster, select the 'union' option. Otherwise it will 'intersect' the shapefile to nothing and you'll get some error.
I assumed your using a shapefile, if you do, note that the .dbf specifications only allow short column names (up to 11 characters??), and i think only up to 255 attribute columns.
The batch line looks something like this:
modeler -nq -meter -state $IMAGINE_HOME/etc/models/covzonal.pmdl Intersection "d:/vector.shp" integer "d:/raster.tif" 'float table meant attribute incov :: "name1";' 'meant = zonal mean (incov, inrast (1), ignore 0);' "None"
The "name1" is the name of the column, and the "inrast(1)" selects the first layer from your stack, so "inrast(2)" would be the second.
So your first three lines might look like this:
modeler -nq -meter -state $IMAGINE_HOME/etc/models/covzonal.pmdl Intersection "d:/vector.shp" integer "d:/raster.tif" 'float table meant attribute incov :: "mean1";' 'meant = zonal mean (incov, inrast (1), ignore 0);' "None"
modeler -nq -meter -state $IMAGINE_HOME/etc/models/covzonal.pmdl Intersection "d:/vector.shp" integer "d:/raster.tif" 'float table meant attribute incov :: "mean2";' 'meant = zonal mean (incov, inrast (2), ignore 0);' "None"
modeler -nq -meter -state $IMAGINE_HOME/etc/models/covzonal.pmdl Intersection "d:/vector.shp" integer "d:/raster.tif" 'float table meant attribute incov :: "mean3";' 'meant = zonal mean (incov, inrast (3), ignore 0);' "None"
Good luck