Skip to content

Conversation

@martinfleis
Copy link
Member

Always use the smallest int mask in rasterize within zonal_stats. No need to expose anything as suggested in #95 as this always picks the smaller of int16 or int32.

Closes #95

@martinfleis martinfleis merged commit 131e6cb into xarray-contrib:main Feb 4, 2025
9 checks passed
@martinfleis martinfleis deleted the zonal_dtypes branch February 4, 2025 08:25
length = len(geometry)
dtype = np.int16 if length < np.iinfo(np.int16).max else np.int32

labels = features.rasterize(
Copy link
Contributor

@dcherian dcherian Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing to consider is whether you want to make your own Grouper.

ds.groupby(xvec.GeometryGrouper(geometries))

or something .

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow custom dtypes and fills in _zonal_stats_rasterize

2 participants