コード例 #1
0
def test_unpack():
    class Unpacker(object):
        def __init__(self, x, y):
            self.x = x
            self.y = y

    unmarshal.register("unpack", unmarshal.unpack_into(Unpacker))
    unmarshalled = unmarshal.unmarshal("unpack", dict(x=1, y=True))
    assert isinstance(unmarshalled, Unpacker)
    assert unmarshalled.x == 1
    assert unmarshalled.y is True
コード例 #2
0
            ndarray = "None (Empty Image)"

        ndarray_line = "  * ndarray: {}".format(ndarray)

        properties_line = "  * properties: {}".format(_join_dict_keys(self.properties))
        bandinfo_line = "  * bandinfo: {}".format(_join_dict_keys(self.bandinfo))

        geocontext_line = "  * geocontext: {}".format(_join_dict_keys(self.geocontext))

        return "\n".join(
            (name_header, ndarray_line, properties_line, bandinfo_line, geocontext_line)
        )


unmarshal.register(
    "Image", warn_on_old_python_wrapper(unmarshal.unpack_into(ImageResult))
)


class ImageCollectionResult(EqualityMixin):
    """
    Result of calling `~.models.compute` on an `~.geospatial.ImageCollection`.

    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' # doctest: +SKIP
    ImageCollectionResult of length 2: