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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: xarray_fits-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 dc9595b8706db11b5f3725b012f042fc6cc6303be6c1903ce3f96d3e36fa5077
MD5 36072fdae8978bc6a4d23f3a605ed0a9
BLAKE2b-256 87c6abe928c196c2f2fb77d0caf0a051d9ee0690a36f240a1faf25ef096e2441

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xarray_fits-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f6fe1bbbd1d15d704c5f4037e6d231b38a729d1e7f0add95a12d2e5e9c855583
MD5 4c28282fcde0fc84adc0ecea8ed10886
BLAKE2b-256 16fa979595c52d36fdf4ced27725f40263d84cff8eaa1e59f83ba56f4e3e8f0b

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