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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: xarray_fits-0.2.3.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.3.tar.gz
Algorithm Hash digest
SHA256 03f2fc33a0e5cbceddf2e6d7620a670c512c347c8898f5426a278815720f7a0f
MD5 9779674657a8054c841faf7a38c44458
BLAKE2b-256 577fdbb247b580bafe269e005d091637bf233e33ef8baf7e969082a59bebf79a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xarray_fits-0.2.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3f0223dd4b825e7d78f0d3f7cec663ec921ff379f7d2bd21ec7491cd53a99141
MD5 f8b689f4ab0e0db760e816939ee453ee
BLAKE2b-256 e0a070ae6adc1ffbdc05cd961faeeeaae67557b853e0b0603b453881a6b0d693

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