I have an attribute table with a column that has many observations below a chemical detection limit - 0.005. Since these are not valid measurements, I would like to replace all values in the field under 0.005 with the value 0.0025. So: if an observation < 0.005 then replace with it 0.0025.
On a related note, for this same field there are some missing values which I would like to drop entirely. So something like: if NA, then omit.
I am not familiar with python coding. I have tried calculate field and then arcade reclassify function as follows (does not work - I think it is the wrong function for conditional replacement).
// Reclassify values to another value
function Reclass($feature.MEAN_RESULT) {
if ($feature.MEAN_RESULT < 0.005)
return 0.0025)
}
Solved! Go to Solution.
python parser.... you can arcade the idea if needed
# to call the def use
# r[!YourFieldNameHere!] like below
# r[!MEAN_RESULT!]
a = [0.1, None, 0.004] #emulate a field
# just copy the function below
def r(fld):
if fld is None or fld >= 0.005:
return fld
elif fld < 0.005:
return 0.0025
# test the result
[r(i) for i in a]
[0.1, None, 0.0025]
python parser.... you can arcade the idea if needed
# to call the def use
# r[!YourFieldNameHere!] like below
# r[!MEAN_RESULT!]
a = [0.1, None, 0.004] #emulate a field
# just copy the function below
def r(fld):
if fld is None or fld >= 0.005:
return fld
elif fld < 0.005:
return 0.0025
# test the result
[r(i) for i in a]
[0.1, None, 0.0025]
Worked perfectly - much thanks!
Dan, Can you help me formulate what I can put in to create a new field from an existing field information, in the VRI type data.
So I want "TM" and "TB" from the BCLCS_4 column to show as HWD in the new SPREADTYPE column.
Does that make sense? Can you help me please? I have very little python coding experience.