Skip to content

Method to extract single distinct, non-null value from a raster (error otherwise) #421

Description

@nathanjmcdougall

By analogy with more_itertools.one.

We just want to raise an error if there are multiple distinct raster cell values (or, I suppose, if the raster is empty). If there is exactly one value, return it.

For users, this is mostly useful for migration contexts where a quantity was previously represented as a float but the user wants to migrate to allow it to vary spatially. Then the underlying representation can be changed to a raster but any methods that expect a single float can use .one safely until proper spatial variability is supported in the user's downstream applications.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions