How to use the descarteslabs.workflows.types.primitives.Int function in descarteslabs

To help you get started, we’ve selected a few descarteslabs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github descarteslabs / descarteslabs-python / descarteslabs / workflows / types / geospatial / geometry.py View on Github external
    @typecheck_promote((Int, Float))
    def buffer(self, distance):
        return Geometry._from_apply("buffer", self, distance)
github descarteslabs / descarteslabs-python / descarteslabs / workflows / types / geospatial / imagecollection.py View on Github external
    @typecheck_promote(None, back=Int, fwd=Int)
    def map_window(self, func, back=0, fwd=0):
        """
        Map a function over a sliding window of this `ImageCollection`.

        The function must take 3 arguments:

        * ``back``: `ImageCollection` of N prior images
        * ``current``: current `Image`
        * ``fwd``: `ImageCollection` of N subsequent images

        The window slides over the `ImageCollection`, starting at
        index ``back`` and ending ``fwd`` images before the end.

        Note that the total length of the window is ``back + 1 + fwd``.
        Specifying a window longer than the `ImageCollection` will cause an error.
github descarteslabs / descarteslabs-python / descarteslabs / workflows / types / geospatial / imagecollection.py View on Github external
    @typecheck_promote((Image, lambda: ImageCollection, Int, Float))
    def __rsub__(self, other):
        return self._from_apply("sub", other, self)
github descarteslabs / descarteslabs-python / descarteslabs / workflows / types / proxify / proxify.py View on Github external
return obj
    elif callable(obj):
        return Function.from_callable(obj)
    elif isinstance(obj, (tuple, list)):
        contents = [proxify(x) for x in obj]
        types = tuple(type(x) for x in contents)
        if (
            isinstance(obj, list)
            and len(types) > 0
            and all(t is types[0] for t in types[1:])
        ):
            return List[types[0]](contents)
        else:
            return Tuple[types](contents)
    elif isinstance(obj, int):
        return Int(obj)
    elif isinstance(obj, float):
        return Float(obj)
    elif isinstance(obj, bool):
        return Bool(obj)
    elif isinstance(obj, str):
        return Str(obj)
    elif obj is None:
        return NoneType(obj)
    elif isinstance(obj, (datetime.datetime, datetime.date)):
        return Datetime._promote(obj)
    elif isinstance(obj, datetime.timedelta):
        return Timedelta._promote(obj)
    else:
        try:
            return Any._promote(obj)
        except ProxyTypeError:
github descarteslabs / descarteslabs-python / descarteslabs / workflows / types / geospatial / mixins.py View on Github external
    @typecheck_promote((Int, Float))
    def buffer(self, distance):
        return self._from_apply("buffer", self, distance)
github descarteslabs / descarteslabs-python / descarteslabs / workflows / types / geospatial / where.py View on Github external
isinstance(condition, Bool)
        and isinstance(x, (Int, Float))
        and isinstance(y, (Int, Float))
    ):
        raise ValueError(
            "Can't call workflows.where with a boolean condition and scalar x, y; currently not supported."
        )
    args = [condition, x, y]
    if any(isinstance(arg, ImageCollection) for arg in args):
        return_type = ImageCollection
    elif any(isinstance(arg, Image) for arg in args):
        return_type = Image
    elif isinstance(x, Float) or isinstance(y, Float):
        return_type = Float
    else:
        return_type = Int
    return return_type._from_apply("where", condition, x, y)
github descarteslabs / descarteslabs-python / descarteslabs / workflows / types / containers / collection.py View on Github external
def length(self):
        """Length is equivalent to the Python ``len`` operator.

        Returns
        -------
        Int
            An Int Proxytype
        """
        return Int._from_apply("length", self)