Scipy integrated into xarray
Project description
scipy for xarray
xr-scipy is a thin wrapper of scipy for the xarray eco-system. You can read the documentation here.
Many scipy functions, such as scipy.integrate.trapezoid requires coordinate array as an argument.
xr-scipy wraps these functions to use native coordinate objects of xarray and returns an xarray object with the computed data.
This enables more xarray-oriented data analysis with scipy.
Other usage/options are kept almost the same as the original scipy function.
Example
import xarray as xr
import numpy as np
import xrscipy.integrate
In[1]: da = xr.DataArray([0, 3, 2, 4, 6], coords={'x': np.linspace(0, 1, 5)})
In[2]: da
Out[2]:
<xarray.DataArray (x: 5)>
array([0, 3, 2, 4, 6])
Coordinates:
* x (x) float64 0.0 0.25 0.5 0.75 1.0
In[3]: xrscipy.integrate.cumulative_trapezoid(da, coord='x')
Out[3]:
<xarray.DataArray (x: 5)>
array([0. , 0.375, 1. , 1.75 , 3. ])
Coordinates:
* x (x) float64 0.0 0.25 0.5 0.75 1.0
Installation
pip install xrscipy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xrscipy-3.0.0.tar.gz.
File metadata
- Download URL: xrscipy-3.0.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d58322554308b1b4fc46356f5b9af79911181aff0a3c57093c314177553d152
|
|
| MD5 |
5f88517c3621bf570c63b33614bf96b9
|
|
| BLAKE2b-256 |
65329a725192702b3bed30703cbde624f6db285ca1529d984bb7dc91eabc0afd
|
File details
Details for the file xrscipy-3.0.0-py3-none-any.whl.
File metadata
- Download URL: xrscipy-3.0.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9e26bc96f6d80a43e66765ac7d6eb97e5914f27cf96fb743c4b0b8336af7d90
|
|
| MD5 |
6a6b2c3428174df79e6b522a77b0e1f3
|
|
| BLAKE2b-256 |
94157c259dbef58146d492844f5ee837644718bb62ba2da0280b8c4d61efe10a
|