Note

Using interactive maps requires ipyleaflet, an optional dependency. See the guide for installation and troubleshooting instructions.

Interactive

Classes

WorkflowsLayer(image, *args, **kwargs) Subclass of ipyleaflet.TileLayer for displaying a Workflows Image.
LayerController(map, **kwargs) An ipyleaflet.WidgetControl for managing WorkflowsLayer.
LayerControllerList(map) Widget displaying a list of LayerControllerRow widgets for a Map.
Map(**kwargs) Subclass of ipyleaflet.Map with Workflows defaults and extra helper methods.
MapApp([map, layer_controller_list, …]) Widget displaying a map, layers, and output logs in a nicer layout.

Data

map A single MapApp instance that all visualize calls are automatically added to.
class WorkflowsLayer(image, *args, **kwargs)[source]

Subclass of ipyleaflet.TileLayer for displaying a Workflows Image.

Attributes

attribution A trait for unicode strings.
b_max Casting Float traitlet that also considers the empty string as None
b_min Casting Float traitlet that also considers the empty string as None
checkerboard A boolean (True, False) trait.
cmap_max Casting Float traitlet that also considers the empty string as None
cmap_min Casting Float traitlet that also considers the empty string as None
colormap A trait for unicode strings.
displayed_image A trait whose value must be an instance of a specified class.
error_output A trait whose value must be an instance of a specified class.
g_max Casting Float traitlet that also considers the empty string as None
g_min Casting Float traitlet that also considers the empty string as None
image A trait whose value must be an instance of a specified class.
min_zoom An int trait.
r_max Casting Float traitlet that also considers the empty string as None
r_min Casting Float traitlet that also considers the empty string as None
session_id A trait for unicode strings.
url A trait for unicode strings.
xyz_obj A trait whose value must be an instance of a specified class.

Methods

forget_errors() Clear the set of known errors, so they are re-displayed if they occur again
make_url() Generate the URL for this layer.
set_scales(scales[, new_colormap]) Update the scales for this layer by giving a list of scales
image

The Image to use

Type:Image
displayed_image

Read-only: the Image object that’s actually displayed. This differs from Image if colormap is set, for example.

Type:Image
xyz_obj

Read-only: The XYZ object this layer is displaying.

Type:XYZ
colormap

Name of the colormap to use. If set, image must have 1 band. Updates displayed_image by calling colormap on image.

Type:str, optional, default None
cmap_min

Min value for scaling the single band when a colormap is given.

Type:float, optional, default None
cmap_max

Max value for scaling the single band when a colormap is given.

Type:float, optional, default None
r_min

Min value for scaling the red band.

Type:float, optional, default None
r_max

Max value for scaling the red band.

Type:float, optional, default None
g_min

Min value for scaling the green band.

Type:float, optional, default None
g_max

Max value for scaling the green band.

Type:float, optional, default None
b_min

Min value for scaling the blue band.

Type:float, optional, default None
b_max

Max value for scaling the blue band.

Type:float, optional, default None
error_output

If set, write unique errors from tiles computation to this output area from a background thread. Setting to None stops the listener thread.

Type:ipywidgets.Output, optional, default None
forget_errors()[source]

Clear the set of known errors, so they are re-displayed if they occur again

make_url()[source]

Generate the URL for this layer.

This is called automatically as the attributes (image, colormap, scales, etc.) are changed.

set_scales(scales, new_colormap=False)[source]

Update the scales for this layer by giving a list of scales

Parameters:
  • scales (list of lists, default None) –

    The scaling to apply to each band in the Image.

    If Image contains 3 bands, scales must be a list like [(0, 1), (0, 1), (-1, 1)].

    If Image contains 1 band, scales must be a list like [(0, 1)], or just (0, 1) for convenience

    If None, each 256x256 tile will be scaled independently based on the min and max values of its data.

  • new_colormap (str, None, or False, optional, default False) –

    A new colormap to set at the same time, or False to use the current colormap.

    If changing both scales and colormap, this is more efficient than doing one at a time, since it will only re-publish one Workflow instead of two.

attribution

A trait for unicode strings.

b_max

Casting Float traitlet that also considers the empty string as None

b_min

Casting Float traitlet that also considers the empty string as None

checkerboard

A boolean (True, False) trait.

cmap_max

Casting Float traitlet that also considers the empty string as None

cmap_min

Casting Float traitlet that also considers the empty string as None

colormap

A trait for unicode strings.

displayed_image

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

error_output

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

g_max

Casting Float traitlet that also considers the empty string as None

g_min

Casting Float traitlet that also considers the empty string as None

image

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

min_zoom

An int trait.

r_max

Casting Float traitlet that also considers the empty string as None

r_min

Casting Float traitlet that also considers the empty string as None

session_id

A trait for unicode strings.

url

A trait for unicode strings.

xyz_obj

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class LayerController(map, **kwargs)[source]

An ipyleaflet.WidgetControl for managing WorkflowsLayer.

Unlike other ipyleaflet controls, a Map must be passed in on instantiation. Creating a LayerController automatically adds it to the given Map.

Example

>>> import descarteslabs.workflows as wf
>>> img = wf.Image.from_id("landsat:LC08:PRE:TOAR:meta_LC80270312016188_v1").pick_bands("red green blue")
>>> map = wf.Map()  # doctest: +SKIP
>>> layer = wf.WorkflowsLayer(img)  # doctest: +SKIP
>>> map.add_layer(layer)  # doctest: +SKIP
>>> ctl = wf.LayerController(map)  # doctest: +SKIP
>>> map  # doctest: +SKIP
controller_list

The LayerControllerList widget displayed.

Type:LayerControllerList

Create the LayerController.

Parameters:map (Map) – The Map to which to add this control.
class LayerControllerList(map)[source]

Widget displaying a list of LayerControllerRow widgets for a Map.

Attributes

map A trait whose value must be an instance of a specified class.
map

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class Map(**kwargs)[source]

Subclass of ipyleaflet.Map with Workflows defaults and extra helper methods.

Attributes

center An instance of a Python list.
error_log A trait whose value must be an instance of a specified class.
min_zoom An int trait.
output_log A trait whose value must be an instance of a specified class.
scroll_wheel_zoom A boolean (True, False) trait.
zoom_start An int trait.

Methods

geocontext() A Workflows GeoContext representing the current view area and resolution of the map.
move_layer(layer, new_index) Move a layer to a new index.
move_layer_down(layer) Move a layer down one, if not already at the bottom.
move_layer_up(layer) Move a layer up one, if not already at the top.
output_log

Widget where functions doing operations on this map (especially compute operations, like autoscaling or timeseries) can log their output.

Type:ipywidgets.Output
geocontext()[source]

A Workflows GeoContext representing the current view area and resolution of the map.

Returns:geoctx
Return type:GeoContext
move_layer(layer, new_index)[source]

Move a layer to a new index.

Parameters:
  • layer (ipyleaflet.Layer) –
  • new_index (int) –
Raises:

ValueError: – If layer is a base layer, or does not already exist on the map.

move_layer_down(layer)[source]

Move a layer down one, if not already at the bottom.

Parameters:layer (ipyleaflet.Layer) –
Raises:ValueError: – If layer is a base layer, or does not already exist on the map.
move_layer_up(layer)[source]

Move a layer up one, if not already at the top.

Parameters:layer (ipyleaflet.Layer) –
Raises:ValueError: – If layer is a base layer, or does not already exist on the map.
center

An instance of a Python list.

error_log

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

min_zoom

An int trait.

output_log

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

scroll_wheel_zoom

A boolean (True, False) trait.

zoom_start

An int trait.

class MapApp(map=None, layer_controller_list=None, position_controller=None)[source]

Widget displaying a map, layers, and output logs in a nicer layout.

Forwards attributes and methods to self.map.

Methods

clear_layers() Remove all layers from the map (besides the base layer)
remove_layer(layer_name) Remove a named layer from the map
clear_layers()[source]

Remove all layers from the map (besides the base layer)

remove_layer(layer_name)[source]

Remove a named layer from the map

map = `ipyleaflet` and/or `ipywidgets` Jupyter extensions are not installed! (or you're not in a Jupyter notebook.) To install for JupyterLab, run this in a cell: !jupyter labextension install jupyter-leaflet @jupyter-widgets/jupyterlab-manager To install for plain Jupyter Notebook, run this in a cell: !jupyter nbextension enable --py --sys-prefix ipyleaflet Then, restart Jupyter and re-run this notebook.

A single MapApp instance that all visualize calls are automatically added to.

Run:

wf.map

in a JupyterLab cell to display the map the first time, then right-click and select “New View for Output”. You can then position and rearrange the map as a tab however you like.

Calling Image.visualize will by default add new layers to this map.