Select to view content in your preferred language

How to replace values of a raster with from another raster with a condition?

2698
3
07-13-2016 12:21 PM
SagarParajuli1
Deactivated User

I am trying to replace all the cell values in raster 'acc_log_norm' that are equal to zero with the corresponding cell values in "modis3_norm_final" raster. The syntax I used in raster calculator is:

Con("acc_log_norm", "modis3_norm_final", "acc_log_norm", "Value = 0")

The syntax runs but the resulting raster is a weired raster with value range -3.40282e+038 to +3.40282e+038. The cell values range from 0 to 1 in both of the rasters. Please help.

0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

You have nodata values obviously

Con—Help | ArcGIS for Desktop try a boolean to get the hang of it

Con( "in_raster",1,0, condition)

where 1 will be assigned if the condition is true otherwise 0, then view your raster in that context and you will then be able to reinterpret yours.  Don't use a visual inspection, examine the histogram (floating point rasters) or the table (integer rasters) being aware of where your nodata values are

0 Kudos
DarrenWiens2
MVP Honored Contributor

The expression you want is: Con("acc_log_norm"==0, "modis3_norm_final", "acc_log_norm")

Translation: If "acc_log_norm" equals zero, then use "modis3_norm_final", else use "acc_log_norm".

SagarParajuli1
Deactivated User

It looks like that this issue was caused because my 'modis3_norm_final' raster didn't have a proper projection defined although the both map have same resolution and size.

0 Kudos