TransWikia.com

Set NoData value for multiband TIFF using arcpy

Geographic Information Systems Asked by ermintrude75 on January 27, 2021

I am working in ArcMap 10.6.1 with a script to take a NetCDF and output it to a folder of individual rasters, one for each time slice. Script source: https://support.esri.com/en/technical-article/000011318

The NetCDF series I wish to use is set up poorly with respect to NoData – there is a value of 9.96921e+36 (9969209968386869046778552952102584320.000000) which should clearly be NoData but is not set as such. It appears in the sea area, as the data relate to land only. I need to ensure this is NoData in the outputs.

The overall flow of the script is to first export the NetCDF to an N-band TIFF, where N is the number of time slices in the NetCDF. Each band is then exported to an individual numbered TIFF (Band_n.tif) in a specified output folder.

The N-band TIFF seems like an ideal opportunity to set the NoData value properly before creation of the single bands. I am trying to use:

arcpy.SetRasterProperties_management(OutputRaster, nodata="9.96921e+36")

The result is a runtime error, line 17533, in SetRasterProperties, raise e. I have also tried with the full value (not the exponential) and received the same error. I have tried using just this line (specifying the raster file path) within the Python window and get the same error.

I can edit the N-band TIFF’s Properties via ArcCatalog to set 9.96921e+36 as the NoData value for each band and this works. So the value itself does not seem to be a problem.

Can anyone tell me what the error indicates? How can I set the NoData value within the script, for all bands in the TIFF?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP