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
Extend use of bz2 compression for input files for seviri_l1b_hrit #1796
Comments
@pdebuyl Interesting! Is your archive accessible to all or is it only for internal usage? The with unzip_file(somefilename) as non_compressed_file:
with open(non_compressed_file).... where What do you think? |
Hi @mraspaud thank you for replying! Our archive is internal. It is a straight dump from EUMETCast though, with the prologue, epilogue, and cloudmask "bzip2-ed". The HRIT files use the internal compression (extension Regarding the use of a context manager, does satpy rely on lazy reading for some of the |
Some of the reader indeed do read the data lazily. However this is not the case for the prologue and epilogue files as far as I know, and when we do read lazily, we use In [15]: arr = np.ones((10000, 10000))
In [16]: arr.tofile("ones", "")
In [19]: data = np.memmap("ones", dtype=np.float)
In [20]: data
Out[20]: memmap([1., 1., 1., ..., 1., 1., 1.])
In [21]: os.remove("ones")
In [22]: data
Out[22]: memmap([1., 1., 1., ..., 1., 1., 1.])
In [23]: data * 5
Out[23]: array([5., 5., 5., ..., 5., 5., 5.]) |
I have started to test an update. I tried first at the level of Current approach: modify self.filename before reaching It seems to work but needs some cleaning up. Also, would you like to replace the current uses of I'll give an update next week. |
I was thinking about using Regarding replacing the current usages, if it's possible, I definitely think we should use the context syntax :) |
I found that you need to start the context before here: https://github.com/pytroll/satpy/blob/main/satpy/readers/hrit_base.py#L160 Else, the I have the following as a WIP: https://github.com/pdebuyl/satpy/tree/bzip2_PRO_EPI I don't remove the temporary files yet as they are removed too early with this solution. |
ok, I understand. So indeed, |
I have not yet looked at the image file handling, but for the prologue and epilogue, the files are opened and closed in Another solution: open the context before the I pushed this other solution to the same branch, if it is accepted I can make another branch or squash it. |
The easiest would be if you made a PR with your current branch, so we can review it properly. If you feel there are too many commits, we can do a squash merge when merging, so don't worry about that :) |
Feature Request
Is your feature request related to a problem? Please describe.
I use MSG seviri data in HRIT format. For some reason, our archive has the epilogue and prologue files compressed with bzip2 on disk. Currently, this is not possible to pass bzip2 compressed files to the seviri_l1b_reader
Describe the solution you'd like
Add .bz2 to the list of supported extension for prologue and epilogue files and use the
unzip_file
helper to decompress them as needed.Describe any changes to existing user workflow
This does not remove any existing feature and does not change how one would use satpy.
Additional context
In principle, I could provide decompressed files to satpy but it is of course more convenient if the process is automatic.
I understand fully if this extra convenience is not taken into account because it is too specific. Else, I would be willing to draft a PR using another bz2 aware reader as example.
The text was updated successfully, but these errors were encountered: