Rasters Sources Using NumPy¶
-
Dataset.
wrap_numpy_raster
(key, fp, array, channels_schema=None, sr=None, mode='w', **kwargs)[source]¶ Register a numpy array as a raster under key within this Dataset.
>>> help(NumpyRaster)
Parameters
- key: hashable (like a string)
File identifier within Dataset
To avoid using a key, you may use
awrap_numpy_raster()
- fp: Footprint of shape (Y, X)
Description of the location and size of the raster to create.
- array: ndarray of shape (Y, X) or (Y, X, C)
- channels_schema: dict or None
Channel(s) metadata. (see Channels schema fields below)
- sr: string or None
Spatial reference of the new file
In order not to set a spatial reference, use None.
In order to set a spatial reference, use a string that can be converted to WKT by GDAL.
Returns
- source: NumpyRaster
Channel schema fields
- Fields:
‘nodata’: None or number ‘interpretation’: None or str ‘offset’: None or number ‘scale’: None or number ‘mask’: None or str
- Interpretation values:
undefined, grayindex, paletteindex, redband, greenband, blueband, alphaband, hueband, saturationband, lightnessband, cyanband, magentaband, yellowband, blackband
- Mask values:
all_valid, per_dataset, alpha, nodata
Additionally:
A field missing or None is kept to default value.
A field can be passed as
a value: All bands are set to this value
a sequence of values of length channel_count: All bands will be set to their respective state
See Also
Dataset.awrap_numpy_raster()
: To skip the key assigmentbuzzard.wrap_numpy_raster()
: To skip the key assigment and the explicit Dataset instanciation
-
Dataset.
awrap_numpy_raster
(fp, array, channels_schema=None, sr=None, mode='w', **kwargs)[source]¶ Register a numpy array as a raster anonymously within this Dataset.
See Also
Dataset.wrap_numpy_raster()
: To assign a key to this source within the Datasetbuzzard.wrap_numpy_raster()
: To skip the key assigment and the explicit Dataset instanciation