Result Types¶
When calling compute
, results are packaged into these types (or returned as builtin Python types when appropriate, such as for Dict
, Int
, or Datetime
).
Note that these are just simple containers, and aren’t interoparable with their corresponding Proxytypes. For instance, you can’t do wf.Image.from_id("foo") + my_image_result
, where my_image_result
is an ImageResult
instance.
Classes:
ImageResult (ndarray, properties, bandinfo, …) |
Result of calling compute on an Image . |
ImageCollectionResult (ndarray, properties, …) |
Result of calling compute on an ImageCollection . |
GeometryResult (type, coordinates[, crs]) |
Result of calling compute on a Geometry . |
GeometryCollectionResult (type, geometries[, crs]) |
Result of calling compute on a GeometryCollection . |
FeatureResult (geometry, properties) |
Result of calling compute on a Feature . |
FeatureCollectionResult (features) |
Result of calling compute on a FeatureCollection . |
-
class
ImageResult
(ndarray, properties, bandinfo, geocontext)[source]¶ Result of calling
compute
on anImage
.Examples
>>> from descarteslabs.workflows import Image >>> my_img = Image.from_id("sentinel-2:L1C:2019-05-04_13SDV_99_S2B_v1") >>> my_img.compute(my_geoctx) # my_geoctx is an arbitrary geocontext for 'my_img' ImageResult: * ndarray: MaskedArray<shape=(27, 512, 512), dtype=float64> * properties: 'absolute_orbit', 'acquired', 'archived', 'area', ... * bandinfo: 'coastal-aerosol', 'blue', 'green', 'red', ... * geocontext: 'geometry', 'key', 'resolution', 'tilesize', ...
-
ndarray
¶ 3-dimensional array of image data, in order
(band, y, x)
Type: numpy.ndarray
-
bandinfo
¶ OrderedDict of metadata about each band. The order corresponds to the bands in the
ndarray
.Type: OrderedDict[str, dict[str, any]]
-
geocontext
¶ GeoContext over which computation was done.
Type: dict
-
-
class
ImageCollectionResult
(ndarray, properties, bandinfo, geocontext)[source]¶ Result of calling
compute
on anImageCollection
.Examples
>>> from descarteslabs.workflows import ImageCollection >>> my_col = ImageCollection.from_id("landsat:LC08:01:RT:TOAR", ... start_datetime="2017-01-01", ... end_datetime="2017-05-30") >>> my_col.compute(my_geoctx) # my_geoctx is an arbitrary geocontext for 'my_col' ImageCollectionResult of length 2: * ndarray: MaskedArray<shape=(2, 27, 512, 512), dtype=float64> * properties: 2 items * bandinfo: 'coastal-aerosol', 'blue', 'green', 'red', ... * geocontext: 'geometry', 'key', 'resolution', 'tilesize', ...
-
ndarray
¶ 4-dimensional array of image data, in order
(image, band, y, x)
Type: numpy.ndarray
-
properties
¶ List of metadata dicts about each
Image
in theImageCollection
. The order corresponds to axis 0 of thendarray
.Type: list[dict[str, any]]
-
bandinfo
¶ OrderedDict of metadata about each band. The order corresponds to the bands (axis 1) in the
ndarray
.Type: OrderedDict[str, dict[str, any]]
-
geocontext
¶ GeoContext over which computation was done.
Type: dict
-
-
class
GeometryResult
(type, coordinates, crs=None)[source]¶ Result of calling
compute
on aGeometry
.Examples
>>> from descarteslabs.workflows import Geometry >>> my_geom = Geometry(type="Point", coordinates=[1, 2]) >>> my_geom.compute() GeometryResult(type=Point, coordinates=[1, 2])
-
type
¶ The type of geometry. One of “Point”, “MultiPoint”, “LineString”, “MultiLineString”, “Polygon”, “MultiPolygon”, or “LinearRing”.
Type: str
-
coordinates
¶ Coordinates for the geometry, in WGS84 lat-lon (EPSG:4326). May be a list of floats, a list of lists of floats, or a list of lists of lists of floats depending on the
type
.Type: list
-
__geo_interface__
¶ GeoJSON representation of the
Geometry
, following the Python__geo_interface__
convention.Type: dict
-
shapely
¶ The
GeometryResult
as a shapely shape. RaisesImportError
if the shapely package is not installed.Type: shapely.geometry.BaseGeometry
-
-
class
GeometryCollectionResult
(type, geometries, crs=None)[source]¶ Result of calling
compute
on aGeometryCollection
.Examples
>>> from descarteslabs.workflows import Geometry, GeometryCollection >>> my_geom = Geometry(type="Point", coordinates=[1, 2]) >>> my_gc = GeometryCollection(type="GeometryCollection", geometries=[my_geom, my_geom, my_geom]) >>> my_gc.compute() GeometryCollectionResult(type=GeometryCollection, geometries=( GeometryResult(type=Point, coordinates=[1, 2]), GeometryResult(type=Point, coordinates=[1, 2]), GeometryResult(type=Point, coordinates=[1, 2])))
-
type
¶ The type of geometry. Always “GeometryCollection”.
Type: str
-
geometries
¶ List of
GeometryResult
objects in the collection.Type: list[GeometryResult]
-
__geo_interface__
¶ GeoJSON representation of the
GeometryCollection
, following the Python__geo_interface__
convention.Type: dict
-
shapely
¶ The
GeometryCollection
as a shapely shape. RaisesImportError
if the shapely package is not installed.Type: shapely.geometry.GeometryCollection
-
-
class
FeatureResult
(geometry, properties)[source]¶ Result of calling
compute
on aFeature
.Examples
>>> from descarteslabs.workflows import Geometry, Feature >>> my_geom = Geometry(type="Point", coordinates=[1, 2]) >>> my_feat = Feature(geometry=my_geom, properties={"foo": "bar"}) >>> my_feat.compute() FeatureResult(geometry=GeometryResult(type=Point, coordinates=[1, 2]), properties={'foo': 'bar'})
-
geometry
¶ The
GeometryResult
of the feature.Type: GeometryResult
-
properties
¶ Properties associated with the
FeatureResult
.Type: dict
-
__geo_interface__
¶ GeoJSON representation of the
FeatureResult
, following the Python_geo_interface__
convention.Type: dict
-
shapely
¶ The
geometry
of theFeatureResult
as a shapely shape. RaisesImportError
if the shapely package is not installed.Type: shapely.geometry.BaseGeometry
-
-
class
FeatureCollectionResult
(features)[source]¶ Result of calling
compute
on aFeatureCollection
.Examples
>>> from descarteslabs.workflows import Geometry, Feature, FeatureCollection >>> my_geom = Geometry(type="Point", coordinates=[1, 2]) >>> my_feat = Feature(geometry=my_geom, properties={"foo": "bar"}) >>> my_fc = FeatureCollection(features=[my_feat, my_feat, my_feat]) >>> my_fc.compute() FeatureCollectionResult(features=( FeatureResult(geometry=GeometryResult(type=Point, coordinates=[1, 2]), properties={'foo': 'bar'}), FeatureResult(geometry=GeometryResult(type=Point, coordinates=[1, 2]), properties={'foo': 'bar'}), FeatureResult(geometry=GeometryResult(type=Point, coordinates=[1, 2]), properties={'foo': 'bar'})))
-
features
¶ List of
FeatureResult
result objects in the collection.Type: list[FeatureResult]
-
__geo_interface__
¶ GeoJSON representation of the
FeatureCollectionResult
, following the Python__geo_interface__
convention.Type: dict
-