1

I have an 8 bit raster that I'm clipping using arcpy 10.7

arcpy.Clip_management("inrasPATH","","outrasPATH","PolygonPATH","256","ClippingGeometry","MAINTAIN_EXTENT")

However whenever I clip the raster I expect it to set the pixels outside of the polygon area to NoData(256) and the raster to be promoted to 16 bit but instead it the values clipped out are set to "0", the raster is promoted to 16 bit, the NoData value shows "256", and creates a black bounding box around my georeferenced raster. It works ok if I set the NoData value to "0" but there is a chance that it will share that value with some pixels in the area I want to keep.

Basically the clip is not setting pixels clipped out to my defined NoData value, instead its setting it to zero

The funny thing is that it works correctly on another coworkers arcmap also running 10.7

I have not adjusted any Environment settings.

  • Have a look at your environment nodata setting desktop.arcgis.com/en/arcmap/latest/tools/environments/… ensure this is set to PROMOTION and then hopefully it works as documented. – Michael Stimson Nov 28 '19 at 3:03
  • I tried setting that environment to PROMOTION, MAXIMUM and NONE with no success – MoxGoat Nov 28 '19 at 16:02
  • So your outside is still 0, in 16 bit, with a nodata value of 256 on the raster band. Are you removing the raster between iterations? I would be clutching at straws to try to guess why this is going wrong.. so at this point perhaps it's time to contract Esri support and a representative can talk through the process or, at the risk of going off-topic, you could use gdalwarp (-te xmin ymin xmax ymax, -ot Int16, -dstnodata 256 and -cutline) with subprocess.Popen. Let me know if you want to try this way, I can provide an example of how to incorporate GDAL by Popen in an arcpy script.. – Michael Stimson Nov 28 '19 at 22:24
0

If I run this tool while using ArcMap 10.3 instead of 10.7 I don't seem to have this issue. I can't seem to find any differences between the clip function from 10.3 to 10.7. I will likely have to contact ESRI support

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.