<?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 Re: numpy array to raster in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/numpy-array-to-raster/m-p/396860#M31325</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Melanie,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, both rasters are in the same projection/cell size as they have been extracted from the same raster. I had a go at changing the axis, and even thought axis=0 is correct, changing it to 1 made me realise that the raster extents are the problem. For some reason, the extract by mask tool did not update the raster extents and the original extents are still being used. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;While I can fix this, I'm now wondering if the NoData cells are going to cause a problem with the alignment of the extracted rasters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Update: seems like I'm also blocked by the differences in array dimension for each raster.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 Mar 2013 20:00:59 GMT</pubDate>
    <dc:creator>MatthewBrown1</dc:creator>
    <dc:date>2013-03-17T20:00:59Z</dc:date>
    <item>
      <title>numpy array to raster</title>
      <link>https://community.esri.com/t5/python-questions/numpy-array-to-raster/m-p/396858#M31323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am iterating through a series of rasters and would like to mosaic the results, but don't have access to any tools that I would normally use because this is a Runtime SDK for WPF project using local server only. (Available tools: &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#//01700000006r000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#//01700000006r000000&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One option I have tried is numpy.concatenate but this is only partially successful:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]22625[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;r2 is in the correct location, but r1 has shifted. No idea where the backwards 'F' came from.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the code I'm using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import numpy
from arcpy.sa import *

r1 = Raster("ras1")
r2 = Raster("ras2")

arcpy.env.outputCoordinateSystem = r2.spatialReference

x = r2.extent.XMin
y = r2.extent.YMin

point = arcpy.Point(x,y)

a1 = arcpy.RasterToNumPyArray(r1)
a2 = arcpy.RasterToNumPyArray(r2)

b = numpy.concatenate((a1,a2))

c = arcpy.NumPyArrayToRaster(b,point,15)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas what I am missing?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:09:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpy-array-to-raster/m-p/396858#M31323</guid>
      <dc:creator>MatthewBrown1</dc:creator>
      <dc:date>2021-12-11T18:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: numpy array to raster</title>
      <link>https://community.esri.com/t5/python-questions/numpy-array-to-raster/m-p/396859#M31324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Do both of your rasters use the same projections?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do they both have the same cell sizes? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Should r1 be south or north of r2?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;If so, you might want to try explicitly specifying the axis to concatenate your numpy array on. &lt;A href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.concatenate.html"&gt;Here are examples&lt;/A&gt; for axis 0 and 1 (at the bottom of the linked page in green).&amp;nbsp; You would want to use axis=0. &lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;If that doesn't work, you may need to look at how your environment settings are being applied. &lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Mar 2013 01:08:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpy-array-to-raster/m-p/396859#M31324</guid>
      <dc:creator>MelanieMaguire</dc:creator>
      <dc:date>2013-03-16T01:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: numpy array to raster</title>
      <link>https://community.esri.com/t5/python-questions/numpy-array-to-raster/m-p/396860#M31325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Melanie,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, both rasters are in the same projection/cell size as they have been extracted from the same raster. I had a go at changing the axis, and even thought axis=0 is correct, changing it to 1 made me realise that the raster extents are the problem. For some reason, the extract by mask tool did not update the raster extents and the original extents are still being used. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;While I can fix this, I'm now wondering if the NoData cells are going to cause a problem with the alignment of the extracted rasters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Update: seems like I'm also blocked by the differences in array dimension for each raster.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Mar 2013 20:00:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/numpy-array-to-raster/m-p/396860#M31325</guid>
      <dc:creator>MatthewBrown1</dc:creator>
      <dc:date>2013-03-17T20:00:59Z</dc:date>
    </item>
  </channel>
</rss>

