Skip to content

Commit

Permalink
Add Sentinel-2 tile to CyFi explorer (#116)
Browse files Browse the repository at this point in the history
* add sentinel tile

* add commas

* add comma in hover over
  • Loading branch information
ejm714 committed Oct 11, 2023
1 parent ff314f9 commit 2463dcc
Showing 1 changed file with 8 additions and 4 deletions.
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

0 comments on commit 2463dcc

Please sign in to comment.