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


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?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.