@@ -797,6 +797,16 @@ def blend(activity, band_map, quality_band, build_clear_observation=False, block
797797 saturated = radsat_extract_bits (saturated , 1 , 7 ).astype (numpy .bool_ )
798798 masked .mask [saturated ] = True
799799
800+ # Get current observation file name
801+ file_path = bandlist [order ].name
802+ file_date = datetime .strptime (merges_band_map [file_path ], '%Y-%m-%d' )
803+ day_of_year = file_date .timetuple ().tm_yday
804+
805+ if build_clear_observation and is_combined_collection :
806+ datasource_block = provenance_merge_map [file_date .strftime ('%Y-%m-%d' )].dataset .read (1 , window = window )
807+ if mask_values ['bits' ]:
808+ confidence .oli = numpy .isin (datasource_block , index_landsat_oli )
809+
800810 if mask_values ['bits' ]:
801811 matched = get_qa_mask (masked ,
802812 clear_data = clear_values ,
@@ -829,16 +839,6 @@ def blend(activity, band_map, quality_band, build_clear_observation=False, block
829839
830840 stack_total_observation [window .row_off : row_offset , window .col_off : col_offset ] += copy_mask .astype (numpy .uint8 )
831841
832- # Get current observation file name
833- file_path = bandlist [order ].name
834- file_date = datetime .strptime (merges_band_map [file_path ], '%Y-%m-%d' )
835- day_of_year = file_date .timetuple ().tm_yday
836-
837- if build_clear_observation and is_combined_collection :
838- datasource_block = provenance_merge_map [file_date .strftime ('%Y-%m-%d' )].dataset .read (1 , window = window )
839- if mask_values ['bits' ]:
840- confidence .oli = datasource_block == index_landsat_oli
841-
842842 # Find all no data in destination STACK image
843843 stack_raster_where_nodata = numpy .where (
844844 stack_raster [window .row_off : row_offset , window .col_off : col_offset ] == nodata
@@ -849,9 +849,6 @@ def blend(activity, band_map, quality_band, build_clear_observation=False, block
849849 stack_raster [window .row_off : row_offset ,
850850 window .col_off : col_offset ].shape )
851851
852- if build_clear_observation and is_combined_collection :
853- datasource_block = provenance_merge_map [file_date .strftime ('%Y-%m-%d' )].dataset .read (1 , window = window )
854-
855852 # Find all valid/cloud in destination STACK image
856853 raster_where_data = numpy .where (raster != nodata )
857854 raster_data_pos = numpy .ravel_multi_index (raster_where_data , raster .shape )
0 commit comments