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

Fix scoring not exporting the last observation date #555

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions rdwatch/scoring/tasks/animation_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def create_animation(self, site_evaluation_id: UUID4, settings: dict[str, Any]):
frames = []
np_array = []
polygon = None
last_obs_date = None
point = None
count = 0
for img, width, height, image_record in images_data:
Expand Down Expand Up @@ -356,6 +357,11 @@ def create_animation(self, site_evaluation_id: UUID4, settings: dict[str, Any]):
)
except AnnotationProposalObservation.DoesNotExist:
observation = None
if observation:
polygon = observation.geom
label = observation.label
label_mapped = label_mapping.get(label.slug, {})
last_obs_date = observation.timestamp.strftime('%Y-%m-%d')
if observation:
polygon = Polygon.from_ewkt(observation.geometry)
label = observation.phase
Expand Down Expand Up @@ -455,6 +461,7 @@ def create_animation(self, site_evaluation_id: UUID4, settings: dict[str, Any]):
image_record.timestamp.strftime('%Y-%m-%d'),
date_box_point,
date_box_size,
label='img date:',
)
# Draw Source
source_point = (0, 0)
Expand All @@ -467,18 +474,18 @@ def create_animation(self, site_evaluation_id: UUID4, settings: dict[str, Any]):
source_size,
)
# Draw Observation
obs_width = ui_max_width / 10.0
obs_width = ui_max_width / 6.0
obs_point = (ui_max_width - obs_width, 0)
obs_size = (ui_max_width / 10.0, date_height)
obs_text = '+obs'
if image_record.observation is None:
obs_text = '-obs'
obs_size = (ui_max_width / 6.0, date_height)
obs_text = last_obs_date or '----------'
obs_label = 'last obs date:'
if 'obs' in labels:
draw_text_in_box(
draw,
obs_text,
obs_point,
obs_size,
label=obs_label,
)
# Draw Label
label_width = ui_max_width / 3.0
Expand Down
Loading