Skip to content
Discussion options

You must be logged in to vote

@rsignell-usgs @alaws-USGS just wanted to chime in here, hope all are well. Like @ianthomas23 mentioned, xarray-spatial doesn't handle the rasterization step (yet...), but it does have zonal.apply() which takes an arbitrary callable on irregular zonals defined by contiguous values / labels.

Assuming you rasterized using datashader or another method...the xarray-spatial steps would look like:

  import numpy as np
  import xarray as xr
  from xrspatial import zonal

  # -- Assume rasterization is already done --
  # zones: 2D raster where each pixel holds a polygon/watershed ID
  # precip: 2D raster of precipitation values (same grid)
  # weights: 2D raster of fractional pixel overlap (0.0–…

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@rsignell-usgs
Comment options

Comment options

You must be logged in to vote
3 replies
@rsignell-usgs
Comment options

@ianthomas23
Comment options

@rsignell-usgs
Comment options

Comment options

You must be logged in to vote
1 reply
@brendancol
Comment options

Answer selected by brendancol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants