I'm clipping some rasters with the ArcPy Clip tool (from the raster toolset) and a polygon feature and I'm having some problems with nodata values.
The script I'm using is based on the code from Arcgis help:
Usage:
Clip_management (in_raster, rectangle, out_raster, {in_template_dataset}, {nodata_value} {NONE | ClippingGeometry})
##Clip Raster Dataset with feature geometry
arcpy.Clip_management("image.tif", "#", "clip.tif","feature.shp", "0", "ClippingGeometry")
If I use '0' as NoData value, the clipping is OK. But there are some pixels where a band has 0 values and I get this in the clipped pixels:
So, despite the clipping area it's fine, the raster doesn't look like the original because there's a band without its value.
I have been trying to use the ExtractbyMask tool but I've seen that some raster values are modified. It doesn't works for me because I need exactly the same values from the source.
Does somebody know if it's possible to define in ArcPy a Nodata value that considers the 3 bands at the same time?
Is it possible to define NoData value as '0,0,0' to solve this question?
I've been trying this but I'm not used to Python coding and maybe I'm not doing it properly.