OutDbSedonaRasterBase
as_numpy and as_rasterio read the
pixels from that file when called, so the Python process needs access to it.
For S3 paths, Sedona builds the credentials from the Spark session’s
spark.hadoop.fs.s3a.* configuration; see
sedona.spark.raster.gdal_conf.
Like the JVM reader, the pixel values have the source’s scale and offset
applied, unless the raster.reader.auto-rescale reader parameter (or the
session’s spark.hadoop.raster.reader.auto-rescale) turns rescaling off.
with_bands is not supported; convert the raster with RS_AsInDb in SQL
first.
Parameters
int
required
Width of the raster in pixels.
int
required
Height of the raster in pixels.
List[SampleDimension]
required
Metadata of each band.
AffineTransform
required
Transform from pixel coordinates to world coordinates.
str
required
CRS of the raster as a WKT string.
affine_trans
bands_meta
crs_wkt
height
outdb_meta
path
width
as_numpy()
as_numpy_masked()
as_rasterio()
close()
set_path()
Parameters
str
required
The new source path, for example a local copy of the file.
with_bands()
InDbSedonaRaster); other rasters
raise TypeError.
Parameters
np.ndarray
required
New pixel data, of shape (height, width) for a single band or
(bands, height, width). Height and width must match this raster;
the band count and dtype may differ.
float or sequence of float
default:"None"
NODATA value of the output bands: a scalar for every band, or one
value per band. Use
float('nan') for a band without NODATA. When
omitted, the output bands inherit NODATA from the source bands.Returns
SedonaRaster
A new raster with the given pixel data and the same spatial metadata.
OutDbSedonaRaster
as_rasterio returns a dataset backed by an
in-memory VRT that reads that region and those bands from the source.
Parameters
int
required
Width of the raster in pixels.
int
required
Height of the raster in pixels.
List[SampleDimension]
required
Metadata of each band.
AffineTransform
required
Transform from pixel coordinates to world coordinates.
str
required
CRS of the raster as a WKT string.
OutDbMeta
required
Where the pixels of this raster are stored.
affine_trans
bands_meta
crs_wkt
height
outdb_meta
path
width
as_numpy()
as_numpy_masked()
as_rasterio()
close()
generate_vrt_xml()
band_indices of a region of src_path.
With band_rescale, each band reads value * scale + offset through a
ComplexSource. Stored nodata is matched exactly before rescaling and becomes
NaN, as on the JVM. Nonzero finite nodata needs GDAL’s native replace_nodata
pixel function (GDAL >= 3.5). The padding outside the source reads the
NoDataValue too, or 0 for a band without one.
Parameters
str
required
Path of the source dataset, in GDAL form (for example
/vsis3/...).str
required
GDAL data type of the VRT bands, such as
"Float64".int
required
Width of the VRT in pixels.
int
required
Height of the VRT in pixels.
str
required
GDAL geotransform of the VRT, as six comma-separated numbers.
str
required
CRS of the VRT as a WKT string, or None or empty for none.
int
required
Column of the source where the region starts.
int
required
Row of the source where the region starts.
list of int
required
Zero-based indices of the source bands to read.
list of float
required
Stored NODATA value of each band, or None for a band without one.
Optional[List[BandRescale]]
default:"None"
(scale, offset) of each band, applied while reading.
Returns
bytes
The VRT XML document.
is_vrt_needed()
ds needs a VRT.
A VRT is needed when this raster covers only part of the source, or a
different set of its bands.
Parameters
DatasetReader
required
The opened source dataset.
Returns
bool
set_path()
Parameters
str
required
The new source path, for example a local copy of the file.
with_bands()
InDbSedonaRaster); other rasters
raise TypeError.
Parameters
np.ndarray
required
New pixel data, of shape (height, width) for a single band or
(bands, height, width). Height and width must match this raster;
the band count and dtype may differ.
float or sequence of float
default:"None"
NODATA value of the output bands: a scalar for every band, or one
value per band. Use
float('nan') for a band without NODATA. When
omitted, the output bands inherit NODATA from the source bands.Returns
SedonaRaster
A new raster with the given pixel data and the same spatial metadata.
LazyLoadOutDbSedonaRaster
Parameters
str
required
Path of the source file.
Optional[Dict[str, str]]
required
Reader parameters of the raster, such as
raster.reader.auto-rescale.affine_trans
bands_meta
crs_wkt
height
outdb_meta
path
width
as_numpy()
as_numpy_masked()
as_rasterio()
close()
set_path()
Parameters
str
required
The new source path, for example a local copy of the file.
Raises
RuntimeError: If this raster has already opened its source.
with_bands()
InDbSedonaRaster); other rasters
raise TypeError.
Parameters
np.ndarray
required
New pixel data, of shape (height, width) for a single band or
(bands, height, width). Height and width must match this raster;
the band count and dtype may differ.
float or sequence of float
default:"None"
NODATA value of the output bands: a scalar for every band, or one
value per band. Use
float('nan') for a band without NODATA. When
omitted, the output bands inherit NODATA from the source bands.Returns
SedonaRaster
A new raster with the given pixel data and the same spatial metadata.
OutDbMeta
Import fromsedona.spark.raster.meta.
Parameters
int
required
Data type of the pixels, as a
DataBuffer type code.list of int
required
Zero-based indices of the bands of the source file that this raster reads.
str
required
Path of the source file.
dict of str to str
required
Reader parameters of the raster, such as
raster.reader.auto-rescale.
