POST
|
Thanks fro that Dan, Still no joy though. I'm getting the same error: Executing (Calculate Value): CalculateValue Raster "import arcpy\n\narcpy.env.workspace = "folder for 1992"\nlistOfRastersByWeek = arcpy.ListRasters()\n\n# repeat this inside a loop for all 12 months\nweek1 = arcpy.RasterToNumPyArray(listOfRastersByWeek[0])\nweek2 = arcpy.RasterToNumPyArray(listOfRastersByWeek[1])\nweek3 = arcpy.RasterToNumPyArray(listOfRastersByWeek[2])\nweek4 = arcpy.RasterToNumPyArray(listOfRastersByWeek[3])\n\nmonth1 = (week1 + week2 + week3 + week4) / 4\nraster_month1 = arcpy.NumPyArraryToRaster(month1)\n\nraster_month1.save("unique name of the month")" Variant Start Time: Thu Aug 09 22:20:31 2012 ERROR 000539: Runtime error <type 'exceptions.IndexError'>: list index out of range Failed to execute (Calculate Value). Any other suggestions would be extremely welcome!! Apologies for my obvious lack of Python programming!
... View more
08-09-2012
01:21 PM
|
0
|
0
|
380
|
POST
|
Thanks very much for your reply Thomas. Unfortunately it didn't work 😞 I'm using ArcMap 10, would this make a difference? When I ran it, I got the following error: Executing (Calculate Value): CalculateValue Raster "arcpy.env.workspace = "1998"\nlistOfRastersByWeek = arcpy.ListRasters()\n\n# repeat this inside a loop for all 12 months\nweek1 = arcpy.RasterToNumPyArray(listOfRastersByWeek[0])\nweek2 = arcpy.RasterToNumPyArray(listOfRastersByWeek[1])\nweek3 = arcpy.RasterToNumPyArray(listOfRastersByWeek[2])\nweek4 = arcpy.RasterToNumPyArray(listOfRastersByWeek[3])\n\nmonth1 = (week1 + week2 + week3 + week4) / 4\nraster_month1 = arcpy.NumPyArraryToRaster(month1)\n\nraster_month1.save("Jan")" Variant Start Time: Thu Aug 09 21:16:46 2012 ERROR 000539: Runtime error <type 'exceptions.IndexError'>: list index out of range Failed to execute (Calculate Value). Am I making a blatant, Python amateur, mistake? Cheers Dee
... View more
08-09-2012
12:33 PM
|
0
|
0
|
380
|
POST
|
Hi there, Basically I have a folder with ten subfolders (one for each year of data...1992-2012), within each of these subfolders are 52 satellite images, one for each week of the corresponding year. I want to convert the weekly data into monthly data, thereby resulting in a single output for each month and twelve for each year. So I want to run a script that picks every four images consecutively, i.e tell it: the first four images = Jan, second four = Feb ............and so on, and get the average of these four images. I can get the average by running the tool 'Cell Statistic' in Model builder and use 'Calculate Value' to allow me to enter the Python script to tell 'Cell Statistic' which four images to average. I'm afraid my Python scripting capabilities are rather limited. Does anyone know a Python code to enable me to do this? I hope it makes sense! Thanks Dee
... View more
08-09-2012
09:29 AM
|
0
|
5
|
977
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|