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

Adding raster compression option #106

Merged
merged 37 commits into from
Dec 17, 2024
Merged
Changes from 2 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
71b3cc5
adding compression option
Antsalacia Nov 28, 2024
c7dbb65
Adding modification and verification in method
Antsalacia Nov 29, 2024
7ac2f6c
Add argument in method
Antsalacia Nov 29, 2024
ba57e0c
rename and add docstring
Antsalacia Nov 29, 2024
a3ae236
Add `raster_compression` type in docstring
AdrienWehrle Nov 29, 2024
5bbc9d5
fix None bug and rename
Antsalacia Nov 29, 2024
a706f43
Merge branch 'fix/34' of https://github.com/Antsalacia/earthspy into …
Antsalacia Nov 29, 2024
f584b99
change argument
Antsalacia Nov 29, 2024
40366a1
CodeQL issue
Antsalacia Dec 2, 2024
2c8c688
pre-commit issues
Antsalacia Dec 2, 2024
37f5765
Address CodeQL alert
AdrienWehrle Dec 2, 2024
3727118
test with pre-commit
Antsalacia Dec 3, 2024
582b681
Merge branch 'fix/34' of https://github.com/Antsalacia/earthspy into …
Antsalacia Dec 3, 2024
a3d8c28
Merge branch 'main' into fix/34
AdrienWehrle Dec 3, 2024
e9c5cf2
change in metadata
Antsalacia Dec 3, 2024
0a9d2cc
add pre-commit
Antsalacia Dec 3, 2024
ad78deb
resolve merge conflict
Antsalacia Dec 3, 2024
e34429c
pre-commit change
Antsalacia Dec 3, 2024
f65d35a
modify `get_raster_compression` docstring
AdrienWehrle Dec 3, 2024
468020c
modify line length on docstring
AdrienWehrle Dec 3, 2024
d8512b1
Problem with self and variables env
Antsalacia Dec 6, 2024
d8cb87f
Adding conftest and test
Antsalacia Dec 12, 2024
4ea9306
Merge branch 'main' into fix/34
AdrienWehrle Dec 12, 2024
74cb8b0
rename filepath for authfile
AdrienWehrle Dec 12, 2024
bf94c1a
fix authfile fixture
AdrienWehrle Dec 12, 2024
3f242d8
try and fix authfile writing in Github action
AdrienWehrle Dec 12, 2024
b6bc469
modify compression methods
AdrienWehrle Dec 12, 2024
f6acfc7
fix authfile
AdrienWehrle Dec 12, 2024
9d722c2
fix authfile
AdrienWehrle Dec 12, 2024
7ec7f3d
add assert for authentification
AdrienWehrle Dec 12, 2024
2dd7d8a
remove assert
AdrienWehrle Dec 12, 2024
533c2f9
change None check and add test for comp
Antsalacia Dec 16, 2024
239bfb2
Add comments
Antsalacia Dec 16, 2024
92c6479
comply with github_adv_sec
Antsalacia Dec 16, 2024
0ebfcc6
fix typo
Antsalacia Dec 16, 2024
7ade2d3
forgot pre-commit
AdrienWehrle Dec 17, 2024
80b174b
add Antsalacia in author list
AdrienWehrle Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions earthspy/earthspy.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
self.set_correct_resolution()

# set compress mode
self.get_raster_compression(compression)
self.get_raster_compression(raster_compression)

# set post-processing attributes
self.get_evaluation_script(evaluation_script)
Expand All @@ -196,18 +196,20 @@

return None

def get_raster_compression(self, compress_mode) -> str:
def get_raster_compression(self, raster_compression) -> str:
AdrienWehrle marked this conversation as resolved.
Show resolved Hide resolved
"""Verify valid keyword for raster compression

:return: Compression mode
"""

if compress_mode in ['DEFLATE','LZW','PACKBITS','JPEG', 'WEBP','LZMA','ZSTD']:
self.compress_mode = compress_mode
if raster_compression in ['DEFLATE','LZW','PACKBITS','JPEG', 'WEBP','LZMA','ZSTD']:
self.raster_compression = raster_compression
elif raster_compression == None:
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Show resolved Hide resolved
self.raster_compression = None
else:
raise KeyError("Compression mode not found")

return self.compress_mode
return self.raster_compression

def get_data_collection(self) -> shb.DataCollection:
"""Get Sentinel Hub DataCollection object from data collection name.
Expand Down Expand Up @@ -1080,7 +1082,7 @@
"height": mosaic.shape[1],
"width": mosaic.shape[2],
"transform": output_transform,
"compress": self.compress_mode
"compress": self.raster_compression
}
)

Expand Down
Loading