Having some issues with the getCellValue tool in arcpy. I am finding that the tool always returns 'NoData' when I run from a script. I can however run the tool with the same inputs in Pro and it gives me an expected value. I have made sure the extents overlap and my rasters and selecting point are in the same projection.
center<SPAN class="operator token">=</SPAN>arcpy<SPAN class="punctuation token">.</SPAN>Describe<SPAN class="punctuation token">(</SPAN>boundary<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>extent<SPAN class="punctuation token">.</SPAN>polygon<SPAN class="punctuation token">.</SPAN>trueCentroid
coords <SPAN class="operator token">=</SPAN> <SPAN class="string token">'{} {}'</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>center<SPAN class="punctuation token">.</SPAN>X<SPAN class="punctuation token">,</SPAN> center<SPAN class="punctuation token">.</SPAN>Y<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>coords<SPAN class="punctuation token">)</SPAN>
rst_lyr <SPAN class="operator token">=</SPAN> <SPAN class="string token">'rst_lyr'</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>MakeRasterLayer_management<SPAN class="punctuation token">(</SPAN>outdata<SPAN class="punctuation token">,</SPAN> rst_lyr<SPAN class="punctuation token">,</SPAN> "<SPAN class="comment token">#", boundary)</SPAN>
result <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>GetCellValue_management<SPAN class="punctuation token">(</SPAN>rst_lyr<SPAN class="punctuation token">,</SPAN> coords<SPAN class="punctuation token">,</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>result<SPAN class="punctuation token">.</SPAN>getOutput<SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
cellvalue <SPAN class="operator token">=</SPAN> float<SPAN class="punctuation token">(</SPAN>result<SPAN class="punctuation token">.</SPAN>getOutput<SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#fails here returns no data</SPAN>
<SPAN class="keyword token">return</SPAN> cellvalue<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>Wondering what I am doing wrong here?
-Patrick