Skip to main content

Hi,


Is there anything I can do to handle the Windows 255 path limit such as renaming the filename when downloading Sentinel-2 data and reconstructing the .SAFE format via the following code?


Need urgent help.


from sentinelhub.aws import AwsProductRequest
from sentinelhub import SHConfig


config = SHConfig(aws_access_key_id="XXXX", aws_secret_access_key="XXXX")

i = "S2B_MSIL1C_20221121T155549_N0400_R054_T18SUG_20221121T175935"
data_folder = r"INSERT_PATH_STR"
product_request = AwsProductRequest(product_id=i, bands=["B01","B02", "B03", "B04", "B05", "B06", "B07", "B08", "B8A", "B09", "B10", "B11", "B12"],
data_folder=data_folder, safe_format=True, config=config)

I’ve tried renaming the filenames manually for each download request to an abbreviated name, but either the downloading or .SAFE reconstruction fails.


for dl_req in product_request.get_download_list():
fn = dl_req.filename
split_fn = fn.split('\\')'0].split('_')
abbrev_fn = ("_").join(split_fnf0:2] + split_fnf0:2] + split_fnf5:7])
dl_req.filename = abbrev_fn
Be the first to reply!

Reply