Skip to content
Snippets Groups Projects
Commit 6a056359 authored by Verouden, Niels's avatar Verouden, Niels
Browse files

Comment out plotting clipped SAR image

parent a68e7a21
No related branches found
No related tags found
No related merge requests found
......@@ -79,9 +79,9 @@ CLIENT_ID = 'fa722f2a-4dec-487e-aebd-16a03646379a'
CLIENT_SECRET = ']GsJ)JrZ<s:iXxK4KerK{vfvG-e;_3TB[eXIX+8,'
start = '2022-01-01'
end = '2022-04-01'
end = '2022-07-01'
coordinates = (-72.243484,19.697338,-72.154221,19.773160)
dest_name = "CapHaitien_JanFebMar2022_completeFilterLee5x5"
dest_name = "CapHaitien_Jan2022Jun2022"
resolution = 4
# Visualise results (y/n)? And if so, which band(s) (VV, VH, VVVH, DEM)?
......
......@@ -55,16 +55,16 @@ from urban_areas.py.s13CalculatePrecipSum import calculatePrecipSum
# =============================================================================
# DEFINE INPUT PARAMETERS
# =============================================================================
start = '2020-01-01'
end = '2022-06-30'
coordinates = (-72.190141,19.721568,-72.173747,19.739352)
dest_name = "CapHaitien_Jan2020Jun2022"
grid = 3
start = '2022-01-01'
end = '2022-07-01'
coordinates = (-72.225786,19.719889,-72.173258,19.765477)
dest_name = "CapHaitien_Jan2022Jun2022"
grid = 4
sum_days = 14
# Visualise coordinates (y/n)? If so, define SAR_path
visualise = "y"
SAR_path = 'CapHaitien_Jan2020Jun2022'
SAR_path = 'CapHaitien_Jan2022Jun2022'
# =============================================================================
# EXECUTE STEPS
......
......@@ -61,9 +61,9 @@ from Urban_areas.py.s23OutlierDetection import visualOutlierDetection, statistic
# =============================================================================
# PARAMETERS FOR RASTER CLIPPING
# Make 'coordinates' an empty tuple to take SAR image as extent
SAR_path = 'SAR/CapHaitien_try1'
SAR_path = 'CapHaitien_Jan2022Jun2022'
urban_raster = 'urban_areas/GHS_BUILT_S_E2018_GLOBE_R2022A_HAITI.tif'
coordinates = (-72.221598,19.733007,-72.192072,19.757579)
coordinates = (-72.225786,19.719889,-72.173258,19.765477)
# Show boundingbox in map? (y/n) (not exported to output)
show_bbox = 'y'
......@@ -71,7 +71,7 @@ show_bbox = 'y'
# =============================================================================
# PARAMETERS FOR VISUALISATION
# Add file name of the precipitation data that should be linked to the mean vv (including '.CSV')
precipitation_csv = 'precipitation_data/daily_precipitation_avg14days_CapHaitien_Jan2020Jun2022.CSV'
precipitation_csv = 'precipitation_data/daily_precipitation_avg14days_CapHaitien_Jan2022Jun2022.CSV'
# =============================================================================
# EXECUTE RASTER CLIPPING
......@@ -94,18 +94,18 @@ file_name, path_mean_vv = exportToCSV(mean_values, dates, SAR_path)
# =============================================================================
# VISUALISE RESULTS AND OUTLIER DETECTION
# =============================================================================
# # STEP 1: LINEPLOTS OF MEAN VV BACKSCATTER, AVG PRECIPITATION, AND SUM PRECIPITATION
# df_total, days, mean_VV, sum_xdays, title_name = visualiseData(SAR_path, precipitation_csv, file_name, path_mean_vv)
# STEP 1: LINEPLOTS OF MEAN VV BACKSCATTER, AVG PRECIPITATION, AND SUM PRECIPITATION
df_total, days, mean_VV, sum_xdays, title_name = visualiseData(SAR_path, precipitation_csv, file_name, path_mean_vv)
# # STEP 2: VISUAL OUTLIER DETECTION
# output_dir = visualOutlierDetection(title_name, df_total, days, mean_VV, sum_xdays)
# STEP 2: VISUAL OUTLIER DETECTION
output_dir = visualOutlierDetection(title_name, df_total, days, mean_VV, sum_xdays)
# # STEP 3: STATISTICAL OUTLIER DETECTION
# df_outlier, LR_columns = statisticalOutlierDetection(df_total, mean_VV, sum_xdays)
# visualiseStatisticalOutliers(output_dir, title_name, df_outlier, LR_columns, mean_VV, sum_xdays, days)
# STEP 3: STATISTICAL OUTLIER DETECTION
df_outlier, LR_columns = statisticalOutlierDetection(df_total, mean_VV, sum_xdays)
visualiseStatisticalOutliers(output_dir, title_name, df_outlier, LR_columns, mean_VV, sum_xdays, days)
# # STEP 4: EXPORT OUTLIER DETECTION DF
# exportOutlierDetection(output_dir, df_outlier, title_name)
# STEP 4: EXPORT OUTLIER DETECTION DF
exportOutlierDetection(output_dir, df_outlier, title_name)
print(f"----- {round((time.time() - start_time), 2)} seconds -----")
......@@ -54,9 +54,11 @@ def createBbox(coordinates, SAR_path, show_bbox='n'):
if show_bbox == 'y':
# Plot bbox and first SAR image
fig, ax = plt.subplots(figsize=(5,5))
fig, ax = plt.subplots(figsize=(20,20))
rio.plot.show(SAR, ax=ax)
gdf.plot(ax=ax, facecolor='none', edgecolor='red')
gdf.plot(ax=ax, facecolor='none', edgecolor='red', linewidth=5)
plt.axis("off")
plt.show()
return gdf
......@@ -207,23 +209,8 @@ def clipSAR(SAR_path, gpd_urban, coordinates):
# ax.imshow(SAR_clipped)
# plt.axis('off')
# plt.title(f'VV backscatter urban areas ({tif[0:10]})', fontdict={'fontsize': 30})
# # plt.savefig(f"Urban_areas/output/{tif[0:10]}.png", dpi=300)
# plt.show()
mosaic, output = merge(raster_to_mosaic)
output_meta = SAR_clipped.meta.copy()
output_meta.update(
{"driver": "GTiff",
"height": mosaic.shape[1],
"width": mosaic.shape[2],
"transform": output,
}
)
output_path = os.path.join('Urban_areas', 'output')
with rio.open(output_path, 'w', **output_meta) as m:
m.write(mosaic)
return list_of_means, list_of_dates
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment