Open Kirill888 opened 6 years ago
If the largest value of the enumeration is <= 8,16,32,64
then enumeration can be converted to bit-field mask of type uint{8,16,32,64}
simply by doing 1<<v
for loaded mask image v
. We should consider implementing this case.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
There is code inside opendatacube/datacube-ows: Open Data Cube Open Web Services which handles this and should be ported into Core.
Masking currently supports enumeration types
For example, given flags definition like this:
we can then ask datacube to turn that into a mask this way:
For every pixel that was classified as
cloud
,m
will haveTrue
value. But if I wanted to get pixels that were classified as eithercloud
orshadow
I'd have to callmake_mask
twiceI propose we support following syntax as well:
Not only this adds convenience to the user it also has a potential for reducing peak memory requirement as computation can happen per time-slice.
Implementation Notes
Underlying function
create_mask_value
can not support multiple values for enumeration, because it assumes that conversion to bool can be represented asX_bool = ((X_raw & M) == V)
, whereM
andV
are simple integer types and are constructed from a bunch offield_name = field_value_as_a_string
pairs.Combining multiple enum types in one "query" might be a bit tricky.