AnsweredAssumed Answered

Updating multiple columns at time

Question asked by Nuria40 on Feb 19, 2015
Latest reply on Feb 27, 2015 by Nuria40

I wonder if someone can advice me how to go about updating 36 columns in a shapefile in a go. The columns have numeric values (they are rainfall values) and the 36 columns are 3 year of monthly values. I want to go through each column and, based on the month they have been collected (the column name has the date of data collection), make 0 all values below the monthly average. So, for example, for my 3 columns with March data, I want to make all values below, let's say, 50 equal to 0; for the 3 columns with December data, I want to make all values below 100 equal to 0, an so on. The columns are sorted chronologically so the first one has the earliest data and the last one the newest data.

I have the monthly average (i.e. the threshold values I wan to use to update the columns) in a dictionary with the month as key and the average as value (e.g. {'April':50, 'December':100, ...}).

The column names have this format: _20100101, _20100201, ..., 20121001, etc. In order to extract the month to match it to the dictionary with the monthly average, I have made a dictionary with the column index and the month (e.g. {0:'January', 1:'February,...}). I thought I could use the key in this second dictionary to 'select' the column once I had created the cursor but I don't know how to do it. So that is in essence what I try to do however it is possible that my approach is not right. In any case, I think I need to find a way of selecting each row element in the cursor (up to 36) either by its index or its name, so that I can  apply the right threshold.

I hope I have managed to explain my problem in a clear way.

Any help will be much appreciated.