boundary_us_file = '../data/raw/boundaries/cb_2022_us_state_20m/cb_2022_us_state_20m.shp'
modis_lc_file = "../data/raw/MODIS/MCD12Q1_LC_CONUS_2021.tif"
boundary_us = gpd.read_file(boundary_us_file)
boundary_wa = boundary_us[boundary_us['STUSPS'] == 'WA'].to_crs(epsg=4326)
xy_wref = (-121.95191, 45.82049)
l1b_shots = shots_gpd_within.to_crs(epsg=4326)
example_shot = shots_filtered[20]
# PFT Rasters
pft_wa_bands, transform_wa, profile_wa = rt.mask_raster(modis_lc_file, boundary_wa, nodata=255)
pft_neon_bands, transform_neon, profile_neon = rt.mask_raster(modis_lc_file, neon_coverage, nodata=255)
pft_wa = pft_wa_bands[4]
pft_neon = pft_neon_bands[4]
# Other overlay layers
raster_crs = profile_wa["crs"]
boundary_wa_r = boundary_wa.to_crs(raster_crs)
coverage_r = neon_coverage.to_crs(raster_crs)
shots_r = l1b_shots.to_crs(raster_crs)
wref_point = gpd.GeoSeries.from_xy([xy_wref[0]], [xy_wref[1]], crs=4326).to_crs(raster_crs)
example_point = gpd.GeoSeries.from_xy([example_shot["lon"]], [example_shot["lat"]], crs=4326).to_crs(raster_crs)
# Plot
fig, axd = plt.subplot_mosaic(
[["wa", "waveform"],
["shots", "waveform"]],
figsize=(12, 8),
)
ax_wa, ax_shots, ax_wf = axd["wa"], axd["shots"], axd["waveform"]
# Top left: PFT over WA, with ALS coverage and WREF
rt.plot_pft(pft_wa, transform_wa, fill_value=255, ax=ax_wa, alpha=0.8)
ax_wa.get_legend().remove()
boundary_wa_r.plot(ax=ax_wa, color="none", edgecolor="black", linewidth=1)
coverage_r.plot(ax=ax_wa, color="none", edgecolor="blue", linewidth=0.8)
wref_point.plot(ax=ax_wa, color="red", markersize=5)
ax_wa.set_title("WREF ALS Coverage and GEDI Shots")
# Bottom left: PFT, GEDI shots and one example shot
rt.plot_pft(pft_wa, transform_wa, fill_value=255, ax=ax_shots, alpha=0.8)
rt.plot_pft(pft_neon, transform_neon, fill_value=255, ax=ax_shots,
legend_loc="lower left", legend_bbox_to_anchor=None, legend_title=None)
coverage_r.plot(ax=ax_shots, color='none', edgecolor='blue', linewidth=2, zorder=100)
shots_r.plot(ax=ax_shots, color='gray', markersize=5, zorder=1)
example_x = example_point.x.iloc[0]
example_y = example_point.y.iloc[0]
ax_shots.scatter(example_x, example_y, color='red', s=10, zorder=2)
ax_shots.annotate("Example Shot", (example_x, example_y),
textcoords="offset points", xytext=(-38, 5), ha='center', color='red', rotation=0)
ax_shots.set_xlim(coverage_r.total_bounds[0] - 5000, coverage_r.total_bounds[2] + 5000)
ax_shots.set_ylim(coverage_r.total_bounds[1] - 5000, coverage_r.total_bounds[3] + 5000)
# Right: Example waveform (unchanged)
gt.plot_waveform(example_shot['rx_raw'], example_shot['tx_raw'], (example_shot["elevation_bin0"], example_shot["elevation_lastbin"]), simulation=False,
title = 'Example Shot', ax=ax_wf)
plt.tight_layout()
plt.show()