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.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

xarray_fits-0.2.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xarray_fits-0.2.0.tar.gz
  • Upload date:
  • Size: 5.4 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.0.tar.gz
Algorithm Hash digest
SHA256 ae514387754a0bd5dd8e7de3487c87102d68ae97d032f36dd7e4e5fbc419a546
MD5 2da0561595deb50689c8be11dde63024
BLAKE2b-256 b295eec93c4d6d69433585683b8c02b35a6680763b54b824ef195eb5825b96e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xarray_fits-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aaaec58654df0c919e92a53c3a973114265405192647f6b37b5b478380df3d4f
MD5 bc69ce1f5ce0bf10c96eed35bd596a70
BLAKE2b-256 9f9fe44efcd6dad959e92c2de912cdcf5fe29a93621babcdc9b508229baf91d0

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