Skip to content
Snippets Groups Projects
Commit 1b83e5bd authored by pascal.mouquet_ird.fr's avatar pascal.mouquet_ird.fr
Browse files

few adjustments to Tile.remove_l2a

parent 35d7b408
No related branches found
No related tags found
No related merge requests found
Pipeline #36 failed
......@@ -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))
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment