0

I have ENVI files one ASCII file .hdr and a flat_binary raster file which is a file without an extension I'd like to convert them to TIFF files These are the steps I followed:

  1. Rename flat_binary raster file by adding “.dat”
  2. Keep the pair of files in the same directory
  3. Then, I wrote this code
import arcpy
ndvi_file="G:\\data\\test\\MYD13A2_A2006201_MED_1km.dat"
ndvi_tiff_file="G:\\data\\test\\data_tiff"
arcpy.RasterToOtherFormat_conversion(ndvi_file, ndvi_tiff_file, "TIFF")

But I didn't get the converted File I'm getting this error

Failed to convert: <built-in function input>. ERROR 999999: Error executing function.
Failed to execute (CopyRaster)

Is there anything missing?

2
  • Is ndvi_tiff_file a workspace path or file path? It should be a workspace path. – Aaron Apr 2 at 16:03
  • yes it's the workspace – hanen balti Apr 3 at 7:15
0

Can ArcMap read the .dat file (it reads ENVI format without conversion).

Have you tried specifying the .tif extension on the output? The Copy Raster tool requires the .tif extension on the output path.

Also "TIFF" is an incorrect parameter in that spot. try format="TIFF" (if you need it, honestly, I think the file extension should do the trick). (UPDATE sorry, I didn't see you were using this batch copy tool)

5
  • Thank you, but for the format="TIFF" It is not possible I followed the documentation (desktop.arcgis.com/fr/arcmap/10.3/tools/conversion-toolbox/…) and Adding the extension doesn't work – hanen balti Apr 2 at 14:44
  • I would try Copy Raster first before you try this tool to copy all of them. I'm guessing your ENVI files are not set up in a way that ArcMap can read them. If they were in the proper format, you could access them directly (not much reason to convert). ArcMap reads ENVI directly. desktop.arcgis.com/fr/arcmap/10.3/manage-data/raster-and-images/… – Curtis Price Apr 2 at 15:52
  • The problem that when I do ADD data with ArcMap I cannot see my data, is there any other alternative ? – hanen balti Apr 3 at 7:09
  • My guess is that the ENVI images are of a data type that ArcGIS does not support, like Double. If you scale the NDVI values to float or byte and use a file extension (.dat or .img) you can probably read the ENVI files. – Curtis Price Apr 4 at 21:20
  • The problem that if I change the extension of the ENVI file and open it in ArcMap I get 3 bands images with 0..255 values so I think i lose the NDVI values – hanen balti Apr 5 at 10:13

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.