GeoEco.DataManagement.ArcGISRasters.ArcGISRaster.FromNumpyArray
- classmethod ArcGISRaster.FromNumpyArray(numpyArray, raster, xLowerLeftCorner, yLowerLeftCorner, cellSize, noDataValue=None, coordinateSystem=None, calculateStatistics=True, buildPyramids=False, buildRAT=True, overwriteExisting=False)
Creates an ArcGIS raster from a numpy array.
Requires: ArcGIS Pro 3.2.0 or later or ArcGIS Server equivalent to ArcGIS Pro 3.2.0 or later, Python numpy module.
- Parameters:
numpyArray (instance of <class 'object'>) – Numpy array to write out as an ArcGIS raster. This array must have 2 dimensions. The shape of this array must not be less than [1, 1]. This array must have one of the following dtypes꞉
'int8','uint8','int16','uint16','int32','uint32','float32','float64'.raster (
str) – Raster to create. If this is a file system path, missing directories in the path will be created if they do not exist. Minimum length꞉ 1.xLowerLeftCorner (
float) – X coordinate of the lower-left corner of the lower-left corner cell of the raster.yLowerLeftCorner (
float) – Y coordinate of the lower-left corner of the lower-left corner cell of the raster.cellSize (
float) – Length and width of each cell, in the units of the raster’s coordinate system. (ArcGIS requires the cells be square. It is not possible to specify a cell size for each dimension.)noDataValue (
float, optional) – Value that indicates a cell has no data. If not specified, all cells are assumed to have data.coordinateSystem (
str, optional) – Coordinate system to define for the raster. If not specified, a coordinate system will not be defined. Minimum length꞉ 1.calculateStatistics (
bool, optional) – If True, statistics will be calculated with GDAL. Calculating statistics is usually a good idea for most raster formats because ArcGIS may only display them with helpful colors and gradients if statistics have been calculated. For certain formats, the explicit calculation of statistics is not necessary because it happens automatically when the rasters are created. If you’re using one of those formats, you can set this option to False to speed up the creation of the output rasters.buildRAT (
bool, optional) – If True and the raster uses an integer data type, raster attribute tables (RATs) will be built for the output rasters using the ArcGISBuild Raster Attribute Table()tool. This option is ignored if the output rasters use a floating point data type. Raster attribute tables are essentially histograms: they store the counts of cells having each value. If you do not need this information, you can skip the building of raster attribute tables to speed up the creation of the output rasters. Note that for certain raster formats, such as ArcInfo Binary Grid, the explicit buliding of raster attribute tables is not necessary because it happens automatically when the rasters are created.buildPyramids (
bool, optional) – If True, pyramids will be built for the raster, which will improve its display speed in the ArcGIS user interface. Pyramids are built with the ArcGISBuildPyramids()tool.overwriteExisting (
bool, optional) – If True, the output raster will be overwritten, if it exists. If False, aValueErrorwill be raised if the output raster exists.