Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support writing to FITS #25

Open
sjperkins opened this issue Mar 27, 2024 · 0 comments
Open

Support writing to FITS #25

sjperkins opened this issue Mar 27, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@sjperkins
Copy link
Member

As dask processes datasets in chunks, It would be useful to support writing to FITS files in chunks. The alternative is aggregating all chunks into a single large array before writing to disk, which is untenable with the data sizes that we currently encounter.

In the reading case, each chunk is handled as follows:

def _get_data_function(fits_proxy, h, i, dt):
if fits_proxy.is_memory_mapped:
data = fits_proxy.hdu_list[h].data[i]
else:
data = fits_proxy.hdu_list[h].section[i]
return data.astype(dt.newbyteorder("="))

Either the data or section attributes are accessed, depending whether the file is memory mapped on a local filesystem, or remotely accessed. Presumably these attributes can be used to support chunk writes.

One concern I have is whether writing from multiple threads/processes will be handled properly. This is probably OK in the remote case, and I expect that the OS will handle paging the writes between memory and disk in the memory mapped case.

/cc @bennahugo @o-smirnov

@sjperkins sjperkins added the enhancement New feature or request label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant