agrc / DEQ-TankRisk

An ArcGIS Pro python toolbox for DEQ to asses tank risks
MIT License
1 stars 0 forks source link

Replace null values in soil data with default value #32

Closed rsaathoff closed 2 years ago

rsaathoff commented 2 years ago

The soilSev values are null in some cases which is causing errors with the import of the data. This occurs when the SoilVal is null.

steveoh commented 2 years ago

What would you like no value to be instead of null?

rsaathoff commented 2 years ago

The value gets a 5 if we have not data. Thanks!

steveoh commented 2 years ago

@rsaathoff what is the score of the null values?

Is it 0 or 1000 or somewhere in between?

texture = row[1]
if texture is None:
    return ('unknown', 0)

value = texture.casefold()

if 'gravel' in value:
    score = 5
elif 'cobb' in value:
    score = 5
elif 'ston' in value:
    score = 5
elif 'frag' in value:
    score = 5
elif 'bould' in value:
    score = 5
elif 'course' in value:
    score = 5
elif len(value.strip()) == 0:
    score = 5
elif 'sand' in value:
    score = 4
elif 'flag' in value:
    score = 3
elif 'channer' in value:
    score = 3
elif 'varia' in value:
    score = 3
elif value == 'loam':
    score = 3
elif 'ashy' in value:
    score = 3
elif 'shaly' in value:
    score = 2
elif 'silt' in value:
    score = 2
elif 'plant' in value:
    score = 2
elif 'pea' in value:
    score = 2
elif 'clay' in value:
    score = 1
elif 'bedr' in value:
    score = 1
else:
    score = 1000
rsaathoff commented 2 years ago

Did I not understand your first question when I said it gets a 5?

steveoh commented 2 years ago

Let me rephrase since those are two separate questions.

  1. What field is null, the value or the score?
  2. What should replace the null values that is causing problems for your import?
  3. What are the other soil values (score, or otherwise) of the records causing issues for your import.

The way the code is crafted, I don't see where null scores could happen.

rsaathoff commented 2 years ago

ok, both the soilVal and soilSev are null. If the soilVal is null, you could either leave it that way or put "No data" in that field. Regardless the soilSev should get a value of 5 if their is no data. You can get rid of the else: score = 1000 and change that to 5. I don't understand how nulls can happen either with that else statement. Attached is the csv from last week TankRiskResults_20220901091604.csv

steveoh commented 2 years ago

ok this should be fixed in 2.1.5

rsaathoff commented 2 years ago

ok, let me give it a try, thanks!

nathankota commented 2 years ago

Rick said it is working as expected.