@@ -317,10 +317,10 @@ def _open_bands(
317
317
318
318
if not pixel_size :
319
319
pixel_size = band_arr .rio .resolution ()[0 ]
320
- clean_band_path = self ._get_clean_band_path (
320
+ clean_band_path = self .get_band_path (
321
321
band , pixel_size = pixel_size , writable = True , ** kwargs
322
322
)
323
- # If raw data, clean it !
323
+ # If raw data, clean it!
324
324
if AnyPath (band_path ).name != clean_band_path .name :
325
325
# Clean pixels
326
326
cleaning_method = CleanMethod .from_value (
@@ -596,7 +596,7 @@ def _load_clouds(
596
596
# First, try to open the cloud band written on disk
597
597
bands_to_load = []
598
598
for band in bands :
599
- cloud_path = self ._construct_band_path (
599
+ cloud_path = self .get_band_path (
600
600
band , pixel_size , size , writable = False , ** kwargs
601
601
)
602
602
if cloud_path .is_file ():
@@ -609,7 +609,7 @@ def _load_clouds(
609
609
610
610
# Write them on disk
611
611
for band_id , band_arr in loaded_bands .items ():
612
- cloud_path = self ._construct_band_path (
612
+ cloud_path = self .get_band_path (
613
613
band_id , pixel_size , size , writable = True , ** kwargs
614
614
)
615
615
band_arr = utils .write_path_in_attrs (band_arr , cloud_path )
@@ -664,7 +664,7 @@ def _load_masks(
664
664
# First, try to open the cloud band written on disk
665
665
bands_to_load = []
666
666
for band in bands :
667
- mask_path = self ._construct_band_path (
667
+ mask_path = self .get_band_path (
668
668
band , pixel_size , size , writable = False , ** kwargs
669
669
)
670
670
if mask_path .is_file ():
@@ -677,7 +677,7 @@ def _load_masks(
677
677
678
678
# Write them on disk
679
679
for band_id , band_arr in loaded_bands .items ():
680
- mask_path = self ._construct_band_path (
680
+ mask_path = self .get_band_path (
681
681
band_id , pixel_size , size , writable = True , ** kwargs
682
682
)
683
683
band_arr = utils .write_path_in_attrs (band_arr , mask_path )
@@ -719,44 +719,32 @@ def _create_mask(
719
719
720
720
return mask
721
721
722
- def _get_clean_band_path (
723
- self ,
724
- band : BandNames ,
725
- pixel_size : float = None ,
726
- writable : bool = False ,
727
- ** kwargs ,
728
- ) -> AnyPathType :
722
+ def _get_band_file_name_sensor_specific_suffix (
723
+ self , band : BandNames , ** kwargs
724
+ ) -> str :
729
725
"""
730
- Get clean band path.
731
-
732
- The clean band is the opened band where invalid pixels have been managed.
726
+ Get the sensor-specific suffix of a band filename.
733
727
734
728
Args:
735
729
band (BandNames): Wanted band
736
- pixel_size (float): Band pixel size in meters
737
- writable (bool): True if we want the band folder to be writeable
738
- kwargs: Additional arguments
730
+ **kwargs: Other args
739
731
740
732
Returns:
741
- AnyPathType: Clean band path
733
+ str: Band filename sensor-specific suffix
742
734
"""
743
- cleaning_method = CleanMethod .from_value (
744
- kwargs .get (CLEAN_OPTICAL , DEF_CLEAN_METHOD )
745
- )
746
-
747
- res_str = self ._pixel_size_to_str (pixel_size )
735
+ if is_spectral_band (band ):
736
+ cleaning_method = CleanMethod .from_value (
737
+ kwargs .get (CLEAN_OPTICAL , DEF_CLEAN_METHOD )
738
+ )
748
739
749
- # Radiometric processing
750
- rad_proc = "" if kwargs .get (TO_REFLECTANCE , True ) else "_as_is"
740
+ # Radiometric processing
741
+ rad_proc = "" if kwargs .get (TO_REFLECTANCE , True ) else "_as_is"
751
742
752
- # Window name
753
- win_suffix = utils .get_window_suffix (kwargs .get ("window" ))
754
- if win_suffix :
755
- win_suffix += "_"
743
+ suffix = f"_{ cleaning_method .value } { rad_proc } "
744
+ else :
745
+ suffix = ""
756
746
757
- return self ._get_band_folder (writable ).joinpath (
758
- f"{ self .condensed_name } _{ band .name } _{ res_str .replace ('.' , '-' )} _{ win_suffix } { cleaning_method .value } { rad_proc } .tif" ,
759
- )
747
+ return suffix
760
748
761
749
@cache
762
750
def _sun_earth_distance (self ) -> float :
0 commit comments