Repository navigation
fix(engine): window, series, tool-input and clip loss notices keep their codes (#2371) #3083
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
Changes from all commits
1735063
4e8be1d
0a3ff2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1777,17 +1777,34 @@ pub(crate) fn process_work(s: &Session, p: &Value) -> Result<super::workflows::W | |
| format!("no cell of {} falls inside {pl} ({} polygon part(s) failed raster projection)", r.name, failed_parts.len()) | ||
| })?; | ||
| let clipped = clip_window(&r, cols, rows, Some(&mask), None, out)?; | ||
| let mut messages = Vec::new(); | ||
| // Each a loss with its code: said as a notice once the clip is added, and kept in the | ||
| // answer's `messages` for a script. | ||
| let mut notes = Vec::new(); | ||
| if skipped > 0 { | ||
| messages.push(format!("{pl}: skipped {skipped} feature(s) with invalid polygon geometry")); | ||
| notes.push(rustgis_data::loss::Note::loss( | ||
| rustgis_data::loss::LossCode::DroppedFeature, | ||
| format!("{pl}: skipped {skipped} feature(s) with invalid polygon geometry"), | ||
| )); | ||
|
Comment on lines
+1784
to
+1787
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Features with an invalid polygon are left out of the clip, so Category: quality
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here a whole feature is left out of the clip, so |
||
| } | ||
| if !failed_parts.is_empty() { | ||
| messages.push(format!( | ||
| "{pl}: skipped {} polygon part(s) that could not be projected onto the raster grid; valid parts were retained", | ||
| failed_parts.len() | ||
| notes.push(rustgis_data::loss::Note::loss( | ||
| rustgis_data::loss::LossCode::DroppedGeometry, | ||
| format!( | ||
| "{pl}: skipped {} polygon part(s) that could not be projected onto the raster grid; valid parts were retained", | ||
| failed_parts.len() | ||
| ), | ||
| )); | ||
| } | ||
| super::workflows::made(clipped, (!messages.is_empty()).then(|| json!({"messages": messages}))) | ||
| let messages: Vec<&str> = notes.iter().map(|n| n.text.as_str()).collect(); | ||
| let extra = (!messages.is_empty()).then(|| json!({"messages": messages})); | ||
| let then: Option<super::workflows::Then> = (!notes.is_empty()).then(|| { | ||
| Box::new(move |s: &mut Session, _: &mut Value| { | ||
| for note in notes { | ||
| s.say(note); | ||
| } | ||
| }) as super::workflows::Then | ||
| }); | ||
| super::workflows::made_then(clipped, extra, then) | ||
| })) | ||
| } | ||
| "clip" => { | ||
|
|
@@ -2701,6 +2718,8 @@ fn clip_window( | |
| } | ||
| // Some of the values rounded when the file was read may be in the window: how many isn't known. | ||
| out.keep_rounded_mark(r); | ||
| // What reading the input left out was said, with its code, when the input was read: a clip, | ||
| // like a resample or a pixel edit, doesn't say it again. | ||
| Ok(out) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
searchedis the search's own notes (series_notes, about line 424). Tiles past the search's list, and index rows that can't be read, are features left out of the read, and this maps them toNote::plain, so a strict run doesn't see them. The reference-layer counts a few lines up (about line 804, "features without geometry / that aren't points / can't be given in longitude/latitude, left out of the reference") are plain too, while the reference points left out just below are codeddropped.feature. The PR body lists only the reference-layer counts as kept plain on purpose, and not these. Either code the dropped rows and tiles and the reference left-outsdropped.feature(the same kind of loss asmissed_points), or add them to "Kept plain on purpose" with the reason.I haven't checked whether the search's notes ever report a loss that isn't a dropped feature. The inline comment covers only the notes that are clearly dropped rows or tiles.
Category: quality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kept plain in this PR: the search's notes mix tiles past the list with notes that only inform. Splitting them by code is left for the release quality pass.