Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sentinel-2 tile to CyFi explorer #116

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions cyfi/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ def plot_image(

return (
im,
sample.density_cells_per_ml,
f"{sample.density_cells_per_ml:,.0f}",
sample.severity,
f"({sample.longitude}, {sample.latitude})",
sample.date,
sample.imagery_date,
sample.item_id,
)

def make_map():
Expand All @@ -120,7 +121,7 @@ def make_map():
mode="markers",
marker=dict(size=6, color=map_df.color),
hoverinfo="text",
hovertemplate="<b>Sample ID</b>: %{customdata[0]}<br>Date</b>: %{customdata[1]}<br><b>Latitude</b>: %{customdata[2]}<br><b>Longitude</b>: %{customdata[3]}<br><b>Predicted density</b>: %{customdata[4]}<br><b>Predicted severity</b>: %{customdata[5]}",
hovertemplate="<b>Sample ID</b>: %{customdata[0]}<br>Date</b>: %{customdata[1]}<br><b>Latitude</b>: %{customdata[2]}<br><b>Longitude</b>: %{customdata[3]}<br><b>Predicted density</b>: %{customdata[4]:,.0f}<br><b>Predicted severity</b>: %{customdata[5]}",
name="",
)
)
Expand Down Expand Up @@ -166,7 +167,7 @@ def make_map():
"density_cells_per_ml",
"severity",
]
],
].style.format({"density_cells_per_ml": "{:,.0f}"}),
height=200,
)

Expand All @@ -191,9 +192,12 @@ def make_map():
loc = gr.Textbox(label="Location")
date = gr.Textbox(label="Sampling date")
days_before_sample = gr.Textbox(label="Satellite imagery date")
tile = gr.Textbox(label="Sentinel-2 tile")

data.select(
plot_image, None, [image, density, severity, loc, date, days_before_sample]
plot_image,
None,
[image, density, severity, loc, date, days_before_sample, tile],
)

with gr.Row():
Expand Down