2

I have an 84x73 masked numpy array to load into ArcGIS (version 10.3.1, Windows 8.1).

To overcome the fact that Masked Numpy arrays cannot be saved to .npy file as of yet, I am saving my array from Jupyter as

import numpy
myarray.dump("C:\MyName\MyFolder\Array_to_raster.npy")

Then, I load this array in ArcGIS, as suggested at Numpy Array to ArcGIS GRID gives ValueError?:

myarray = numpy.load(r"C:\MyName\MyFolder\Array_to_raster.npy")

And then I attempt to create a raster out of it as

arcpy.NumPyArrayToRaster (myarray, arcpy.Point(447328.4200,357465.6840), 1500, 1500, -2147483648)

where -2147483648 is the fill_value of my masked cells.

However, this throws an error:

Runtime error 
Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\__init__.py", line 2292, in NumPyArrayToRaster
 return _NumPyArrayToRaster(*args, **kwargs)
ValueError: Argument in_array: A two or three dimensional NumPy array is required.

But as I said, I already have a 2D array:

>>> myarray.shape
(84, 73)

How can I create the raster out of myarray?

Fezter
22k11 gold badges72 silver badges128 bronze badges
asked May 30, 2017 at 13:32
1

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.