Skip to content

Commit

Permalink
adding compression option
Browse files Browse the repository at this point in the history
  • Loading branch information
Antsalacia committed Nov 28, 2024
1 parent 9ee52fb commit 71b3cc5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions earthspy/earthspy.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def set_query_parameters(
download_mode: str = "SM",
remove_splitboxes: bool = True,
verbose: bool = True,
compression: str = None
) -> None:
"""Define a set of parameters used for the API request.
Expand Down Expand Up @@ -171,6 +172,10 @@ def set_query_parameters(

# set and correct resolution
self.set_correct_resolution()

# set compress mode

self.compress_mode = compression

# set post-processing attributes
self.get_evaluation_script(evaluation_script)
Expand All @@ -188,6 +193,14 @@ def set_query_parameters(

return None

def get_raster_compression(self) -> None:

try:
assert self.compress_mode in ['DEFLATE','LZW','PACKBITS','JPEG',
'WEBP','LZMA','ZSTD']
except:

Check notice

Code scanning / CodeQL

Except block handles 'BaseException' Note

Except block directly handles BaseException.
print("Not a valid compression keyword")

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

Expand Down

0 comments on commit 71b3cc5

Please sign in to comment.