Skip to main content

Scipy integrated into xarray

Project description

Documentation Status

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xrscipy-2.1.0.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

xrscipy-2.1.0-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file xrscipy-2.1.0.tar.gz.

File metadata

  • Download URL: xrscipy-2.1.0.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1023-azure

File hashes

Hashes for xrscipy-2.1.0.tar.gz
Algorithm Hash digest
SHA256 f12a13f83c42180ede05db5379e82690e4d9f9e1ba953199f2a8febbe2dece26
MD5 68aafa075e523f8bb34427fe22a23ef7
BLAKE2b-256 116959886ba8906058b5ac6f593e1f83c2ffa6c06f2d6b1e751080cf1bcbd8b0

See more details on using hashes here.

File details

Details for the file xrscipy-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: xrscipy-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1023-azure

File hashes

Hashes for xrscipy-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39b14aee4545a80cbf3fb3842c5b06d8d66ef7eeaec73d91ff4815ca66e3ecf9
MD5 39bdc130d3cfe3de22d1c2765469c8b6
BLAKE2b-256 7864ccb29dc7c70d8a8a2bb13d8062a261c7523c77c60a6ecbffb5ef64037d35

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page