Skip to content

What is the proper way to preserve XArray and units when running a gaussian_filter? #3294

Answered by kgoebber
rolypolyman asked this question in Q&A
Discussion options

You must be logged in to vote

HI @rolypolyman MetPy does have a couple of filtering options that we call smoothing.

https://unidata.github.io/MetPy/dev/examples/calculations/Smoothing.html#sphx-glr-examples-calculations-smoothing-py

The closest to the SciPy gaussian_filter would be MetPy's smooth_gaussian.

https://unidata.github.io/MetPy/dev/api/generated/metpy.calc.smooth_gaussian.html#metpy.calc.smooth_gaussian

If the function is fed an xarray DataArray, then it should give you back an xarray DataArray as is done in the MetPy xarray tutorial.

https://unidata.github.io/MetPy/dev/tutorials/xarray_tutorial.html#cf-compliant-dataset-example

Replies: 1 comment 1 reply

Comment options

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

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