Is there a way to replace Null Value in Model Builder?

1120
10
12-20-2017 06:05 PM
JessicaRutherford2
New Contributor III

Hi 

I am looking for a way to replace Null Values (-9999) with a set value in Model Builder. I have extracted values to points and want to replace the Null values with a set value. I have tried an iterator but that doesn't seem to work. With raster image I used Is Null and Con Null tool to replace the value. I am not to sure if this is possible for extract values from points. When I do this manually I go through edit mode and do a find and replace. But this is not work for Model Builder. 

I was wondering if there is a script I could use or a way around this issue. 

I need to replace the -9999 values with -13.54.

If anyone has any ideas, that would be great.

Thank 

Jess

0 Kudos
10 Replies
DanPatterson_Retired
MVP Esteemed Contributor

If the -9999 is in a field in a featureclass table, you can combine a select by attribute to select those records in that field that equal -9999 then do a field calculate setting those records to ... None ... no quotes or another numeric value like ... -13.54

If it is a shapefile, then don't support <null> and you are stuck with that value, but you can change it to another numeric value

JessicaRutherford2
New Contributor III

Hi Dan

My data in saved to a geodatabase. I am not too sure what you are referring in your comment above. Are these in the Model Only Tools? I understand that this can be done manually in ArcMap, but I don't understand how to do this in Model Builder. Would you be able to  elaborate on this more, please?

Thanks 

Jess

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

select layer by attribute tool

calculate field tool

pretty well most of the menu functionality that is important has a tool equivalent, specifically so that one can emulate workflows in python scripts and/or modelbuilder... you just have to dig a bit

JessicaRutherford2
New Contributor III

Hello again Dan

This is not working for me. It seems that I can not connect my 'values to point' layer to the 'select layer by attribute'. Is there a step in here that I am missing?

It just will not allow my to connect the output slide area values to points to the tool. See below

I am not sure what else to try here. 

Suggestions?

Thanks

Jess

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

does values to points make a featurelayer or a featureclass?  Select Layer by attributes needs a layer... use MakeFeatureLayer to create one if needed

JessicaRutherford2
New Contributor III

Hey Dan

Thanks that worked well. Didn't realize the Make Layer Feature tool was a temporary file.

Thanks for your help.

Cheers

Jess 

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

glad I could help... I think

0 Kudos
JessicaRutherford2
New Contributor III

Hi Dan

Actually, I should probably open this up again. I thought it worked -well the model worked, but when I brought it into arcMap to view, I get only the top portion of the polygon. I looks like it just replaced all Null value but did not retain the rest of the rastervalues. I guess this is in the selection I used. My first attempt was to use New Selection, but I just tried "Add Selection", Remove Selection and Subset Selection..they all did not work. Still only get the portion that was Null Values before. See images below. I need the green to be the same as the grey image. But as you can see it only is showing value that I replace Null values with. 

Not sure what I can do from here???

I apologize for closing this before.  I got to exciting that the model actually worked. 

Any ideas of what I can do??

Cheers

Jess

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

from slide area values to points... I think! that you wanted to select the values in that file that had -9999 in them in some field... from there, you make that selection permanent by saving (copy features perhaps) to a new file... from that file, you wanted to do a field calculation to change the -9999 values to some other value that is too far up for me to scroll to tonight.  That last step, the field calculation.  

Now during this whole process, did you set your analysis properties in the tools... or as a parameter in your model... to a certain 'extent'.??  You need to.  You cannot assume that the extents of the analysis have anything to do with what you see on screen.  Set analysis extent to be the width and height of the data that you need to complete the analysis.

As far as modelbuilder goes... do it manually, get it to work, record the exact workflow including setting parameters for analysis properties and the like.  When the manual steps work, that is exactly what you have to replicate.  I see way too many people trying to get a model to work and it is the boring stuff that causes it to fail..( e.g. extents, coordinate systems, cell size, snap rasters, selection types... the list is long and not all these apply to your case)

Good luck

0 Kudos