0

I have a feature class with greater than 1000 features and I would like to change all values greater than 2 Standard Deviations to a Zero. Seems like I could possibly use Field Calculator for something like this but I'm not exactly how to attack it. I'm not seeing a way to even calculate the Standard Deviation from within the Field Calculator. And secondly, I not sure how I would do the replace of these values.

3

you can right click on the field and ask for statistics of the field, which will give you the standard deviation and mean which will need to be manually typed into the function call. then you can use the field calculator like this:

setToZero(!yourfield!, std, mean)

code block

def setToZero(a, std, mean):
    if a > (mean + 2*std):
        return 0
    else:
        return a

EDIT : if you don't want to type the std manually, add one field with a single value (if it does not exist), run summarize table on it (or summary statistics in a script) with STD and MEAN, join the resulting table to your table, and use the joined fields in the field calculator (instead of manually entering mean and STD). Its longer, but if you need to do this several times you can create a model or a script.

  • Thanks radouxju, this works but it's still not ideal since I have to manually type in the std and mean. Seems like there should be a function I could use to calculate the mean and std vs. manually typing them. If you or someone here can show how that can be done, I will mark that as the answer. Thanks again for getting me most the way there. – wilbev Jun 4 '14 at 21:24
  • 2
    @wilbev The Field Calculator works with individual records. By itself, it can't do a calculation involving all records (ie, standard deviation of a column). Also note this method will rewrite every record (some with the same value, but still rewrite). Not a big deal with as few as you have, but a consideration on large or remote datasets. – Chris W Jun 4 '14 at 22:10
0

Right click the field you want to do the calculation on, and choose 'Summarize', There is a 'Standard Deviation' check-box. After, you can field calculate on the resultant summary table and make the records with values greater than 2 to a zero, and join them back together on a unique ID.

0

Another alternative. Once you determine your standard deviation using summarize or statistics, perform a select by attributes where that field value is outside the desired range (or inside two standard deviations and then invert the selection), followed by Field Calculating the selected records to 0.

Going into the symbology tab, choosing a quantities method, selecting the right field, and clicking on classify will also give you statistics and show you a distribution graph.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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