Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: per band resampling configuration for xr_repoject #103

Open
Kirill888 opened this issue Oct 15, 2020 · 0 comments
Open

Comments

@Kirill888
Copy link
Member

Currently xr_reproject accepts a resampling: str parameter that configures resampling for all bands of the dataset

def xr_reproject(src: Union[xr.DataArray, xr.Dataset],
geobox: GeoBox,
resampling: str = "nearest",
chunks: Optional[Tuple[int, int]] = None,
dst_nodata: Optional[NodataType] = None) -> Union[xr.DataArray, xr.Dataset]:
"""
Reproject DataArray to a given GeoBox
:param src : Input src[(time,) y, x]
:param geobox : GeoBox of the destination
:param resampling: Resampling strategy as a string: nearest, bilinear, average, mode ...
:param chunks : In Y,X dimensions only, default is to use input chunk size (ignored if input is not a dask array)
:param dst_nodata: nodata marker for dst image (default is to use src.nodata)
"""

Some times it is desirable to resample different bands with different resampling settings, in Datacube.load(..) this is achieved by accepting a dictionary mapping band name to resampling mode to use for the band, with special key '*' to configure resampling for "all other bands".

Would be nice for xr_reproject to accept the same, example

xx_ = xr_rerpoject(xx, geobox,
  resampling={'*': 'average', 'SCL': 'nearest'})
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

No branches or pull requests

1 participant