11import datetime as dt
22import json
33import logging
4+ from pathlib import Path
45from typing import Any , Literal , cast
56from zoneinfo import ZoneInfo
67
@@ -518,6 +519,7 @@ def create_stac_item(self, orbit_cube_idx: str, **kwargs) -> pystac.Item:
518519 orbit_cube_idx = orbit_cube_idx ,
519520 data = select_rgb_from_xarr (nc_data ),
520521 dims = self .thumbnail_dims ,
522+ thumbnail_location = thumbnail_location ,
521523 )
522524
523525 # Thumbnail
@@ -759,6 +761,7 @@ def make_thumbnail(
759761 mode : Literal ["L" , "RGB" , "RGBA" ] = "RGB" ,
760762 cmap : str | None = None , # left at none for composite
761763 fmt : str = "png" ,
764+ thumbnail_location : Path | None = None ,
762765 ):
763766 """Creates a thumbnail for a datacube out of one of its 2D data arrays.
764767
@@ -774,7 +777,14 @@ def make_thumbnail(
774777 thumbnail = convert_arr_to_thumbnail (
775778 data = data , resize_dims = dims , mode = mode , cmap = cmap
776779 )
777- self .log .debug (f"""Saving as { orbit_cube_idx } _{ dims [0 ]} x{ dims [1 ]} .{ fmt } """ )
778- thumbnail .save (
779- self .thumbnail_folder / f"{ orbit_cube_idx } _{ dims [0 ]} x{ dims [1 ]} .{ fmt } "
780- )
780+
781+ if thumbnail_location is None :
782+ thumbnail_location = (
783+ self .thumbnail_folder / f"{ orbit_cube_idx } _{ dims [0 ]} x{ dims [1 ]} .{ fmt } "
784+ )
785+ self .log .debug (
786+ f"`thumbnail_location` not defined. Saving at { thumbnail_location .resolve ()} "
787+ )
788+
789+ self .log .debug (f"""Saving as { thumbnail_location .resolve ()} """ )
790+ thumbnail .save (thumbnail_location )
0 commit comments