I am trying to calculate a reinspection date for surveys using the field calculator in ArcGIS Pro. I am using a predefined survey date and risk zone for this calculation. The risk zones are LOW, MED and HIGH. Low risk zones are reinspected every 1825 days, medium every 1095 days and high every 486 days. I am trying to use the known survey date and known risk zone to calculate the new reinspection date in the field calculator. This is what I have done in the field calculator :
Expression line: reclass(!SurveyDate!,!RiskZone!) def reclass(SurveyDate, RiskZone): if (RiskZone == 'HIGH'): return SurveyDate + datetime.timedelta(days=486) elif (RiskZone == 'MED'): return SurveyDate + datetime.timedelta(days=1095) elif (RiskZone == 'LOW'): return SurveyDate + datetime.timedelta(days=1825)
I validate the script and it confirms it is correct, however, when I run it an error message pops up.
ERROR 000539: Traceback (most recent call last): File "<expression>", line 1, in <module> NameError: name 'MED' is not defined
Why is this happening? I'm not sure where the fault may be.