Skip to main content

xarray Datasets for FITS-like data

Project description

Given some FITS files with matching HDUs:

$ tree data
/home/user/data
├── data-0.fits
├── data-1.fits
└── data-2.fits

0 directories, 3 files
>>> from xarrayfits import xds_from_fits
>>> datasets = xds_from_fits("/home/user/data*", prefix="data")

The above returns a list of three xarray Datasets

>>> datasets
[<xarray.Dataset> Size: 800B
 Dimensions:  (data0-0: 10, data0-1: 10)
 Dimensions without coordinates: data0-0, data0-1
 Data variables:
     data0    (data0-0, data0-1) float64 800B dask.array<chunksize=(10, 10), meta=np.ndarray>,
 <xarray.Dataset> Size: 800B
 Dimensions:  (data0-0: 10, data0-1: 10)
 Dimensions without coordinates: data0-0, data0-1
 Data variables:
     data0    (data0-0, data0-1) float64 800B dask.array<chunksize=(10, 10), meta=np.ndarray>,
 <xarray.Dataset> Size: 800B
 Dimensions:  (data0-0: 10, data0-1: 10)
 Dimensions without coordinates: data0-0, data0-1
 Data variables:
     data0    (data0-0, data0-1) float64 800B dask.array<chunksize=(10, 10), meta=np.ndarray>]

Using xarray these can be concatenated along a dimension:

>>> import xarray
>>> ds = xarray.concat(datasets, dim="data0-0")
>>> ds
<xarray.Dataset> Size: 2kB
Dimensions:  (data0-0: 30, data0-1: 10)
Dimensions without coordinates: data0-0, data0-1
Data variables:
    data0    (data0-0, data0-1) float64 2kB dask.array<chunksize=(10, 10), meta=np.ndarray>

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

xarray_fits-0.2.2.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

xarray_fits-0.2.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file xarray_fits-0.2.2.tar.gz.

File metadata

  • Download URL: xarray_fits-0.2.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for xarray_fits-0.2.2.tar.gz
Algorithm Hash digest
SHA256 ab2172018adf054ed913c6897ed1381c9688d2e8a86fcfc4fb45753e23302af3
MD5 263b33405fb0b5d1f11ad30476cfe939
BLAKE2b-256 b54a2c2e45bb3667889d50a364d9b15bfc8a54ded9e2fe257bb109efc82f9631

See more details on using hashes here.

File details

Details for the file xarray_fits-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: xarray_fits-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for xarray_fits-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 300cd88a7298d0bf62bab55d5fc9ca80784748dfc4d493c4870ade1f69ba28a4
MD5 1e1007e40524262d074d3ae2d5266c3b
BLAKE2b-256 ff43d75eefb4a3719b9af14dd6f3df65e2617e881ac8e9cabaa3acd13186bf5e

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