<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic NumPyArrayToRaster results in NoData values. in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58526#M2054</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I have followed this example on the documentation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; numpy

&lt;SPAN class="comment token"&gt;# Create a simple array from scratch using random values&lt;/SPAN&gt;
myArray &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; numpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;random&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;random_integers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;100&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2500&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
myArray&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;shape &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Convert array to a geodatabase raster&lt;/SPAN&gt;
myRaster &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;NumPyArrayToRaster&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;myArray&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;x_cell_size&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
myRaster&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"C:/output/fgdb.gdb/myRandomRaster"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code creates a raster file in my geodatabase, but the rasterfile appears to be empty. When I add the raster to ArcMap, the raster is invisible. Only if I check to "Display NoData values as" a color, I can see the raster. It seems like the raster is full of NoData.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I get a simple random NumPy array to correctly show up in a map document?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 22:13:30 GMT</pubDate>
    <dc:creator>MoritzS_</dc:creator>
    <dc:date>2021-12-10T22:13:30Z</dc:date>
    <item>
      <title>NumPyArrayToRaster results in NoData values.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58526#M2054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I have followed this example on the documentation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; numpy

&lt;SPAN class="comment token"&gt;# Create a simple array from scratch using random values&lt;/SPAN&gt;
myArray &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; numpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;random&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;random_integers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;100&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2500&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
myArray&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;shape &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Convert array to a geodatabase raster&lt;/SPAN&gt;
myRaster &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;NumPyArrayToRaster&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;myArray&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;x_cell_size&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
myRaster&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"C:/output/fgdb.gdb/myRandomRaster"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code creates a raster file in my geodatabase, but the rasterfile appears to be empty. When I add the raster to ArcMap, the raster is invisible. Only if I check to "Display NoData values as" a color, I can see the raster. It seems like the raster is full of NoData.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I get a simple random NumPy array to correctly show up in a map document?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:13:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58526#M2054</guid>
      <dc:creator>MoritzS_</dc:creator>
      <dc:date>2021-12-10T22:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToRaster results in NoData values.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58527#M2055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;a &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;random&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;randint&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;100&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2500&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;reshape&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
a&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"c:/temp/myarray.tif"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/arcpy/functions/numpyarraytoraster-function.htm" title="http://pro.arcgis.com/en/pro-app/arcpy/functions/numpyarraytoraster-function.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;NumPyArrayToRaster—ArcPy Functions | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;random.random_integer is being deprecated so you should have gotten a warning unless you are using an older version of numpy.&lt;/P&gt;&lt;P&gt;Now as for the saving, don't save it into a geodatabase and expect it to behave unless it is within the expected extent of the gdb and has the same coordinate system.&amp;nbsp; Make a tif and you need to specify the lower-left corner of the array and an appropriate cell size if you expect to see the raster at all.&lt;/P&gt;&lt;P&gt;Add it to a separate dataframe/map without one of those basemap things which will set the projection to web Mercator.&lt;/P&gt;&lt;P&gt;Numpy plays nice with Arc* but you can't skip a proper spatial reference and extent delineation via LL corner and cell size, followed by a Define Projection to solidify its coordinate system.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:13:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58527#M2055</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-10T22:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToRaster results in NoData values.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58528#M2056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your assistance!&lt;/P&gt;&lt;P&gt;I have tried your suggestion, but with no luck. First, I can't seem to directly save a NumPy array as a tif, using&amp;nbsp; a.save().&lt;/P&gt;&lt;P&gt;Saving the tiff outside of my geodatabase after I converted it to a raster creates a tiff file that is solid black when previewed in the windows explorer.&lt;/P&gt;&lt;P&gt;But when I add the raster to ArcMap, I have the same problem as initially: the raster is invisible, and appears to have only NoData values. When I set the symbology to display NoData as a certain color, the whole raster will have this color.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think it is a problem with the extent or projection, because&amp;nbsp; NumPyArrayToRaster should take care of those and I keep my settings consistent.&amp;nbsp;After all I was already able to see the raster at the right place with the right size, but only after I displayed the NoData values as a certain color.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I noticed is that the high and low values seem to be off in the symbology of the raster...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Dec 2018 10:51:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58528#M2056</guid>
      <dc:creator>MoritzS_</dc:creator>
      <dc:date>2018-12-10T10:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToRaster results in NoData values.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58529#M2057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't know what your setup issue is then, because it works as I describe.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image" height="534" src="https://community.esri.com/legacyfs/online/431188_numpyarraytoraster03.png" width="888" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Dec 2018 12:17:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58529#M2057</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-12-10T12:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToRaster results in NoData values.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58530#M2058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dan, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks to your help I found out what the problem was. Turns out it had to do with the extent after all. I had the processing extent in my script set to that of a feature. But I did not specify the lower_left_corner parameter when I converted the array. This resulted in a lower left corner of 0,0. This pont lied outside the actual extent, resulting in an empty raster.&lt;/P&gt;&lt;P&gt;Adding the origin point using the XMin and YMin values of the extent solved the problem:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;NumPyArrayToRaster&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;myArray&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Point&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;extent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;XMin&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;extent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;YMin&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Dec 2018 17:09:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58530#M2058</guid>
      <dc:creator>MoritzS_</dc:creator>
      <dc:date>2018-12-10T17:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: NumPyArrayToRaster results in NoData values.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58531#M2059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;glad it worked out&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Dec 2018 18:37:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/numpyarraytoraster-results-in-nodata-values/m-p/58531#M2059</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-12-10T18:37:34Z</dc:date>
    </item>
  </channel>
</rss>

