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

Add support for compressed FSFiles to HRIT readers #2230

Merged
merged 9 commits into from Nov 9, 2022

Conversation

sfinkens
Copy link
Member

@sfinkens sfinkens commented Oct 10, 2022

Add support for compressed FSFiles to HRIT readers, in particular for MTSAT. Usage example:

import fsspec
from satpy import Scene
from satpy.readers import FSFile

open_file = fsspec.open("HRIT_MTSAT1_20090101_0630_DK01IR1.gz", compression="gzip")
fs_file = FSFile(open_file)
scn = Scene([fs_file], reader="jami_hrit")
scn.load(["IR1"])
  • Tests added
  • Fully documented

@codecov
Copy link

codecov bot commented Oct 10, 2022

Codecov Report

Merging #2230 (9eeb735) into main (7a30eb8) will increase coverage by 0.07%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2230      +/-   ##
==========================================
+ Coverage   94.13%   94.21%   +0.07%     
==========================================
  Files         293      295       +2     
  Lines       45079    45404     +325     
==========================================
+ Hits        42437    42778     +341     
+ Misses       2642     2626      -16     
Flag Coverage Δ
behaviourtests 4.66% <9.37%> (-0.02%) ⬇️
unittests 94.86% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
satpy/readers/hrit_jma.py 97.94% <ø> (ø)
satpy/readers/__init__.py 98.29% <100.00%> (+0.07%) ⬆️
satpy/readers/hrit_base.py 86.23% <100.00%> (+3.36%) ⬆️
satpy/tests/reader_tests/test_hrit_base.py 96.83% <100.00%> (+0.28%) ⬆️
satpy/readers/seadas_l2.py 96.84% <0.00%> (-1.28%) ⬇️
satpy/composites/ahi.py 100.00% <0.00%> (ø)
satpy/tests/test_composites.py 100.00% <0.00%> (ø)
satpy/tests/reader_tests/test_acspo.py 100.00% <0.00%> (ø)
satpy/tests/reader_tests/test_abi_l2_nc.py 100.00% <0.00%> (ø)
satpy/tests/reader_tests/test_goes_imager_nc.py
... and 14 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@coveralls
Copy link

coveralls commented Oct 10, 2022

Coverage Status

Coverage increased (+0.07%) to 94.813% when pulling 9eeb735 on sfinkens:gzipped-hrit into 15be5c1 on pytroll:main.

@sfinkens sfinkens changed the title Add support for gzipped HRIT files Add support for compressed FSFiles to HRIT readers Oct 10, 2022
@pdebuyl
Copy link
Contributor

pdebuyl commented Oct 10, 2022

I don't know fsspec's internal working. Does this create a local cache for compressed files?

@sfinkens
Copy link
Member Author

sfinkens commented Oct 10, 2022

I'm also new to fsspec, but the following seems to create a permanent cache:

filename = "filecache::/data/HRIT_MTSAT1_20090101_0630_DK01IR1.gz"
open_file = fsspec.open(
    filename_gz,
    compression="gzip",
    filecache={'cache_storage':'/cache/dir'}
)
fs_file = FSFile(open_file)
scn = Scene([fs_file], reader="jami_hrit")
scn.load(["IR1"])

By default caching is disabled.

@pdebuyl
Copy link
Contributor

pdebuyl commented Oct 11, 2022

Ultimately, these objects provide the read methods, etc. Seems fine (even though I start to be a bit afraid of the layers of IO technology!). My question was related to the performance. I guess it makes sense when developing to use local data, and else you don't want to keep cached copies of the data so a default of no cache seems fine.

@sfinkens sfinkens marked this pull request as ready for review October 25, 2022 15:16
@sfinkens sfinkens added enhancement code enhancements, features, improvements component:readers labels Oct 25, 2022
@sfinkens sfinkens self-assigned this Oct 25, 2022
Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is really all that is needed to make it work then 👍. Looks good to me. I had one inline comment about maybe moving a method for easier code reading.

satpy/readers/__init__.py Outdated Show resolved Hide resolved
@mraspaud mraspaud merged commit 0cd1109 into pytroll:main Nov 9, 2022
@sfinkens sfinkens deleted the gzipped-hrit branch November 10, 2022 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:readers enhancement code enhancements, features, improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants