I'm just learning how to use arcpy scripting so this may seem rather basic, but I've searched all over to no avail.
I've tried numerous ways to do this, always receiving this error: "arcgisscripting.ExecuteError: ERROR 999999: Error executing function. Unsupported pixel type: Failed to execute MFD flow direction using arcpy."
Initially I was using a GRID input rather than TIFF, and was saving to a folder rather than GDB with .crf file extension after the output. I've then tried using a geodatabase (where file extensions aren't needed?) and still the same.
Am I missing something? I can run the tool in arcmap fine saving to the same file location with the .crf extension.
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
<SPAN class="keyword token">import</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>sa
<SPAN class="keyword token">from</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>sa <SPAN class="keyword token">import</SPAN> <SPAN class="operator token">*</SPAN>
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> <SPAN class="string token">"G:/PhD/GIS_Data"</SPAN> <SPAN class="comment token"># Set workspace</SPAN>
env<SPAN class="punctuation token">.</SPAN>overwriteOutput <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN> <SPAN class="comment token"># Allow output overwriting</SPAN>
<SPAN class="keyword token">print</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>CheckOutExtension<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Spatial"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Check out Spatial analyst</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>CreateFileGDB_management <SPAN class="punctuation token">(</SPAN><SPAN class="string token">"G:/PhD/GIS_Data"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"NE_Grnlnd"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Create Geodatabase</SPAN>
inraster <SPAN class="operator token">=</SPAN> <SPAN class="string token">"TIFs/fillDEM_5m.tif"</SPAN> <SPAN class="comment token"># Set input raster</SPAN>
outFlowDirection <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>sa<SPAN class="punctuation token">.</SPAN>FlowDirection<SPAN class="punctuation token">(</SPAN>inraster<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"FORCE"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"MFD"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Conduct MFD flow direction with no drop raster</SPAN>
outFlowDirection<SPAN class="punctuation token">.</SPAN>save<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"G:/PhD/GIS_Data/NE_Grnlnd/outflwdir1"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Save flow direction</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Completed Flow Direction"</SPAN> <SPAN class="comment token"># Print completion note</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
and the alternate version resulting in the same error:
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> <SPAN class="string token">"G:\PhD\GIS_Data"</SPAN> <SPAN class="comment token"># Set workspace</SPAN>
<SPAN class="keyword token">print</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>CheckOutExtension<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Spatial"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Check out Spatial analyst</SPAN>
inraster <SPAN class="operator token">=</SPAN> <SPAN class="string token">"TIFs/fillDEM_5m.tif"</SPAN> <SPAN class="comment token"># Set input raster</SPAN>
outFlowDirection<SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>sa<SPAN class="punctuation token">.</SPAN>FlowDirection<SPAN class="punctuation token">(</SPAN>inraster<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"FORCE"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"MFD"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Conducts MFD flow direction with no drop raster</SPAN>
outFlowDirection<SPAN class="punctuation token">.</SPAN>save<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"G:/PhD/GIS_Data/outputs/outflwdir1.crf"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Save flow direction as Cloud Raster Format . CRF</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Completed Flow Direction"</SPAN> <SPAN class="comment token"># Print completion note </SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>