Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am trying to produce a set of monthly solar radiation maps based on a monthly parameterization of the diffuse proportion and transmissivity (i.e. new values for both parameters each month). The PointsSolarRadiation function in arcpy produces a full year of monthly radiation values for each function call (i.e. 12 months all based on the same diffuse proportion and transmissivity values). I am trying to extract only the specific month from each of the twelve output files (i.e. extract the "April" data from the file run using the "April" parameters).

To do this I have a subsequent for loop which calls the individual files, identifies the appropriate data column in the file, extracts the data (using SearchCursor) then appends it to the placeholder. The append method fails on the second iteration, which does not happen if I run this with a simpler example of appending defined lists.

My code is as follows:

tableMonthHolder = []
for (j, value) in enumerate(diffuse):
    b = str(j)
    outFeatures = "c:/.../output" + b + ".shp"
    outTableFinder = "T"+b
    tableMonth = [row[0] for row in arcpy.da.SearchCursor(outFeatures,(outTableFinder))]
    tableMonthHolder = tableMonthHolder.append(tableMonth)

Any advice is greatly appreciated.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You are redundantly redefining your variable tableMonthHolder in the last line of code. Try changing this line to:

tableMonthHolder.append(tableMonth)
share|improve this answer
    
Correct. And list.append returns None, so redefining tableMonthHolder is what blows it up as it lacks a .append method. –  Jason Scheirer Jul 2 '13 at 19:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.