diff --git a/sen2chain/tiles.py b/sen2chain/tiles.py index e5be5ce91fcc3896c3c44438257fe31af29882c6..83993ec97b85927af3770f9dde11224d6cf131de 100644 --- a/sen2chain/tiles.py +++ b/sen2chain/tiles.py @@ -989,3 +989,8 @@ class Tile: shutil.rmtree(l2a_path) logger.info("Removing symlink: {}".format(l2a.path)) l2a.path.unlink() + else: + #~ l2a_path = os.readlink(str(l2a.path)) + logger.info("Removing: {}".format(l2a.path)) + shutil.rmtree(str(l2a.path)) + diff --git a/sen2chain/time_series.py b/sen2chain/time_series.py index 2545e7c194ee1aa64d2747d9f012ac7b87576b17..b8c6d91b684a62130963f0e1c476b49e4d173134 100644 --- a/sen2chain/time_series.py +++ b/sen2chain/time_series.py @@ -297,6 +297,12 @@ class TimeSeries: result_dict["tile"] = proc_item[4] result_dict["filename"] = proc_item[0].identifier for prop in features[fid]["properties"]: + #~ if type(features[fid]["properties"][prop]) == float: + #~ result_dict[prop] = "{:.6f}".format(features[fid]["properties"][prop]) + #~ logger.info("toto {}".format(result_dict[prop])) + #~ else: + #~ result_dict[prop] = features[fid]["properties"][prop] + #~ logger.info("tata {}".format(result_dict[prop])) result_dict[prop] = features[fid]["properties"][prop] shared_list.append(result_dict) @@ -336,6 +342,7 @@ class TimeSeries: #~ logger.info("{}".format(shared_list)) #~ for index1, prod in enumerate(products): rows_list = list(shared_list) + #~ logger.info("rows_list {}".format(rows_list)) if rows_list: self._df_dicts[indice] = TimeSeries._list_to_df(rows_list) @@ -568,7 +575,9 @@ class TimeSeries: for (index, row), ax, bx in zip((df.loc[df['fid'] == fid]).sort_values(by=['date']).iterrows(), np.array(axs).flatten(), np.array(bxs).flatten()): - prod_id = row['filename'][:(-12 - len(df_name))] + #~ logger.info("row[filename]: {}".format(row['filename'])) + prod_id = IndiceProduct(row['filename']).l2a + #~ prod_id = row['filename'][:(-12 - len(df_name))] indice_png_tile_path = out_path_fid_folder / "{0}_QL_{1}_{2}_{3}_{4}_{5}.jpg".format( self._vectors_file.stem, fidname, @@ -587,16 +596,17 @@ class TimeSeries: tile_indice_path = tile_obj.paths["indices"][df_name.lower()] tile_l2a_path = tile_obj.paths["l2a"] prod_path = tile_indice_path / prod_id / row['filename'] - tci_path = L2aProduct(IndiceProduct(row['filename']).l2a).tci_10m + tci_path = L2aProduct(prod_id).tci_10m #~ tci_path = list(Path(str(tile_l2a_path / row['filename'][:(-12 - len(df_name))])+ '.SAFE/')\ #~ .glob('GRANULE/*/IMG_DATA/R10m/*_TCI_10m.jp2')) crop_extent = gpd.read_file(str(self._vectors_file)) - raster_tci = rasterio.open(tci_path[0]) + logger.info(tci_path) + raster_tci = rasterio.open(tci_path) crop_extent_new_proj = crop_extent.to_crs(raster_tci.crs) extent_geojson = mapping(crop_extent_new_proj['geometry'][int(fid)].buffer(1000)) - with rasterio.open(tci_path[0]) as tci_data: + with rasterio.open(tci_path) as tci_data: tci_data_crop, tci_data_crop_affine = mask(tci_data, [extent_geojson], crop=True)