AnsweredAssumed Answered

NoData setting differs according to file format in raster save method

Question asked by Y.Morita on Jul 6, 2017
Latest reply on Aug 9, 2017 by Dan_Patterson


I tried to make masked raster.

At first, making mask raster, and then SetNull for input raster.It's very common process.

All processes is well ,but NoData setting differs according to file format in raster save method....

I've checked following two format.

  1. ESRI Gird:output raster has no problem, NoData pixels are not displayed in ArcMap.
  2. TIF: Not working NoData value. NoData pixels have values(-3.4028235e+038 or 0). So, NoData pixels are displayed in ArcMap.

Unfortunately,  I need to save in TIF format ,so it is just the problem. 

I tried arcpy.env.nodata setting. However, Noting had changed.


What should I do?


# -*- coding: utf-8 -*-
# Import arcpy module
import arcpy
import sys
import os



class LisenceError(Exception):

# Check Spatial Analyst license
  if arcpy.CheckExtension("Spatial") == "Available":
    # raise a custom extension
    raise LisenceError
except LisenceError:
  print("Spatial Analyst License is unavailable")
  arcpy.AddMessage("Spatial Analyst License is unavailable")

def makeCoheMask(coheRas, ccthresh):
    coheMask = < ccthresh, 0, 1)
    return coheMask
  except arcpy.ExecuteError:

def makeSlopeMask(dem, geoid, angle, heightType, zfactor):
    arcpy.env.cellSize = "MINOF"

    TMP_SLOPE = arcpy.env.scratchWorkspace + '\\tmp_slope'
    arcpy.Slope_3d(dem, TMP_SLOPE, 'DEGREE', zfactor)
    return slopeMask
  except arcpy.ExecuteError:

def makeLSMask(lsData, type):

      outRas = > 1, 0, 1)
      return outRas
  except arcpy.ExecuteError:

# Set overwrite option
arcpy.env.overwriteOutput = True

# Arguments
inputRas = sys.argv[1]
coheFlg = sys.argv[2]
coheRas = sys.argv[3]
ccthresh = sys.argv[4]
slopeFlg = sys.argv[5]
dem = sys.argv[6]
zfactor = sys.argv[7]
angle = sys.argv[8]
lsFlg = sys.argv[9]
lsData = sys.argv[10]
output = sys.argv[11]



  input_Raster = arcpy.Raster(inputRas)

  if coheFlg.lower() == 'true':
    mask_cohe = makeCoheMask(coheRas, float(ccthresh))
    arcpy.AddMessage('NOT applied coherence mask')
    mask_cohe = 1

  if slopeFlg.lower() == 'true':
    mask_slope = makeSlopeMask(dem, geoid, float(angle), heightType, float(zfactor))
    arcpy.AddMessage('NOT applied slope mask')
    mask_slope = 1

  if lsFlg.lower() == 'true':
    mask_ls = makeLSMask(lsData, type)
    arcpy.AddMessage('finish making LS mask')
    arcpy.AddMessage('NOT applied LS mask')
    mask_ls = 1

  conRas = * (mask_slope * mask_ls))
  outSetNull =, input_Raster, "VALUE = 0")

  if arcpy.Exists(TMP_SLOPE):

except arcpy.ExecuteError: