Skip to content

Commit

Permalink
Merge pull request #1767 from daniel-riehm/dev/derive-md-more-invalid…
Browse files Browse the repository at this point in the history
…-checks

Detect invalid values in a few more places
  • Loading branch information
daniel-riehm authored May 22, 2023
2 parents 4825a44 + 254c533 commit 16b7a81
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arrows/core/derive_metadata.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ compute_slant_range( kwiver::vital::metadata_sptr const& metadata )
kv::rotation_d const total_rotation = get_total_rotation( metadata );
double yaw, pitch, roll;
total_rotation.get_yaw_pitch_roll( yaw, pitch, roll );
if ( pitch >= 0 )
{
VITAL_THROW( kv::invalid_value, "pitch must be negative" );
}

// Determine the altitude of the sensor above the frame center
kv::geo_point const sensor_location = get_sensor_location( metadata );
Expand Down Expand Up @@ -497,6 +501,10 @@ ::filter( kwiver::vital::metadata_vector const& input_metadata,
// Compute GSD
auto const gsd =
compute_gsd( updated_metadata, frame_width, frame_height );
if( !std::isfinite( gsd ) || gsd <= 0 )
{
VITAL_THROW( kv::invalid_value, "invalid GSD result" );
}
updated_metadata->add< kv::VITAL_META_AVERAGE_GSD >( gsd );

// Compute VNIIRS
Expand Down

0 comments on commit 16b7a81

Please sign in to comment.