-
Notifications
You must be signed in to change notification settings - Fork 51
[Workflow Accuracy] Plot DEM with profiles when level > 2 #967
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
Merged
Merged
Changes from all commits
Commits
Show all changes
123 commits
Select commit
Hold shift + click to select a range
0037501
add: tests CLI + list topo
marinebcht 2dd3958
doc + topo inputs list + cli test OK
marinebcht 8fe01c0
add: tests cli
marinebcht 3361538
add: input = dict in topo
marinebcht 7c90b01
fix: test load dem with new set_dem()
marinebcht e8317f6
fix: minors
marinebcht 337eb2b
fix: from/to_vcrs to set_vcrs
marinebcht 27497cd
fix: minors
marinebcht d451985
add: test: vcrs (skipped)
marinebcht 8442828
fix: CI error
marinebcht 5d43afc
fix: output pres @terminal @topo workflow
marinebcht 5bd138c
fix: review Valentine
marinebcht d79f039
fix: windows size fractal + load dem force + wip tiff/png
marinebcht 738f96c
fix: window_size_fractal = 13
marinebcht 7468810
add: no more extra_info @att + add to_repro/crs
marinebcht 199fbdf
little fixes
marinebcht c8ce0d9
wip: doc + generate_pdf true/false
marinebcht 53d8cf8
tests: generate_pdf + raster after reprojection @ topo
marinebcht 1b6fc4c
fix: dem_* to elev_reprojected.tif
marinebcht c01182a
end: tests + docs minus crs @ topo part
marinebcht 8a49ef7
fix: retours Valentine/Romain; add test in test_terrain
marinebcht 23cc0d9
add: prop retro (to_crs to crs, remove output_grid % plot)
marinebcht da5cc94
skip: test to complete in a new issue + doc
marinebcht bc85ed9
fix: report and doc pres
marinebcht f9c6d7c
fix: test multi when window_size and window_size_fractal needed
marinebcht 8c5dd64
fix: No such file or directory: diff_elev_coreg_tba_map.png
marinebcht 4ae7ec0
remove size window fractal
marinebcht 629c062
test doc
marinebcht 0174111
fix: CI tests/test_workflows/test_cli.py::test_invalid_parameters
marinebcht 1754914
test CI has/has not weasy print
marinebcht e8eb6c2
test CI has/has not weasy print
marinebcht 2358976
add: doc reports workflow
marinebcht 4223770
force new version weasyprint
marinebcht a30b4d9
force new version weasyprint
marinebcht f71f129
force new version weasyprint
marinebcht ffa7ef3
test CI: print lib_gobject_name
marinebcht fa9fc2b
add: row function
marinebcht aba0e70
add figure to pdf
marinebcht eda0300
remove tests for CI
marinebcht 784be23
add: test _has_weasyprint
marinebcht 7f21417
Merge remote-tracking branch 'origin/854_enhancements_CLI_None' into …
marinebcht 5ea86e2
add: plots to the report (modulo level) + adapt generate_plot_with_pr…
marinebcht 890db13
change plot profiles positions + doc
marinebcht 896d64e
add: min/max + fix name fig
marinebcht 352c733
add: print in CI
marinebcht a0cd4ee
gestion reports doc
marinebcht e4c09f7
Remove PDF build in documentation (#939)
rhugonnet 0cdf8de
Bump conda-incubator/setup-miniconda from 3 to 4 (#952)
dependabot[bot] a42a095
Blockwise documentation (#936)
ould-a 1bc47a5
add: window_size_fractal
marinebcht 485251b
add: report
marinebcht c57b5a7
add: report
marinebcht ca6426f
add: rebase
marinebcht d94c01c
fix: rebase windows_size_factal
marinebcht 4a47481
fix: rebase windows_size_factal
marinebcht ac1a1f8
fix: rebase windows_size_factal
marinebcht c8f7377
fix: rebase reports
marinebcht d4110a0
add: debug CI
marinebcht f58981d
add: debug CI
marinebcht eb8aa4e
add: debug CI
marinebcht 20831b7
add: debug CI
marinebcht f3dac03
add: debug CI
marinebcht f80b7e9
add: debug CI
marinebcht 6ecead7
add: debug CI
marinebcht 3e36cfa
add: debug CI
marinebcht ca8edb0
add: debug CI
marinebcht fd6a822
add: debug CI
marinebcht 0f14b98
add: debug CI
marinebcht afdf2e0
add: debug CI
marinebcht 574077e
add: debug CI
marinebcht b71e9b3
add: debug CI
marinebcht a347a6a
add: debug CI
marinebcht e6956d7
add: debug CI
marinebcht 4449318
add: debug CI
marinebcht 335f2ad
add: debug CI
marinebcht 4ac8265
add: debug CI
marinebcht f989854
add: debug CI
marinebcht 7402f00
add: debug CI
marinebcht cc243bc
add: debug CI
marinebcht 923ab65
add: debug CI
marinebcht 09931b0
add: debug CI
marinebcht d045792
Revert "add: debug CI"
marinebcht fa3543d
Revert "add: debug CI"
marinebcht 1c98236
Revert "add: debug CI"
marinebcht 77b46db
Revert "add: debug CI"
marinebcht e87ed5c
Revert "add: debug CI"
marinebcht 02e4595
Revert "add: debug CI"
marinebcht 76d5b71
Revert "add: debug CI"
marinebcht e45967e
Revert "add: debug CI"
marinebcht dd342de
Revert "add: debug CI"
marinebcht 2f21db7
Revert "add: debug CI"
marinebcht 9465f56
Revert "add: debug CI"
marinebcht 50d6d76
Revert "add: debug CI"
marinebcht f568a13
Revert "add: debug CI"
marinebcht ec988f6
Revert "add: debug CI"
marinebcht b326f5a
Revert "add: debug CI"
marinebcht 89c30c1
Revert "add: debug CI"
marinebcht 9364084
Revert "add: debug CI"
marinebcht effc054
Revert "add: debug CI"
marinebcht 03ff4ba
Revert "add: debug CI"
marinebcht bff4c55
Revert "add: debug CI"
marinebcht f877961
Revert "add: debug CI"
marinebcht 14eab93
Revert "add: debug CI"
marinebcht ffa56f1
Revert "add: debug CI"
marinebcht 0873473
Revert "add: debug CI"
marinebcht bfdbb5d
fix: CI +pre-commit
marinebcht abfe235
fix: reports + print/comments
marinebcht 15f339d
Revert "fix: reports + print/comments"
marinebcht 77f7206
fix: prints+comments
marinebcht d2e6c74
remove outputs reports
marinebcht 92e49e4
add: reports
marinebcht 72f366c
add: report via make html
marinebcht 355b88d
fix: to-be-alignED + align imshow
marinebcht 23dfeec
fix: plt.show()
marinebcht cb32710
fix: no coreg diff object
marinebcht b6e76f3
test: fix CI reports
marinebcht 186b1f9
add: new config topo / doc
marinebcht 44e3326
add: reports
marinebcht 28c6910
validate merge
marinebcht 3503557
maj: get cmap from matplotlib news
marinebcht 7e21734
merge personnal 854
marinebcht 3e4ee2b
merge: main
marinebcht 23ee0c7
fix: doc + name png
marinebcht File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,7 +97,6 @@ def _load_data(self) -> tuple[float, float]: | |
| title_dem_right="To-be-aligned elevation", | ||
| vmin=vmin, | ||
| vmax=vmax, | ||
| cbar_title=f"Elevation ({self.reference_elev.crs.linear_units})", | ||
| ) | ||
| if ref_mask is not None or tba_mask is not None: | ||
| if ref_mask is not None: | ||
|
|
@@ -115,7 +114,6 @@ def _load_data(self) -> tuple[float, float]: | |
| title_dem_right="Masked terrain for to-be-aligned elevation", | ||
| vmin=vmin, | ||
| vmax=vmax, | ||
| cbar_title=f"Elevation ({self.reference_elev.crs.linear_units})", | ||
| ) | ||
|
|
||
| self.dico_to_show = [ | ||
|
|
@@ -214,7 +212,6 @@ def _prepare_datas(self, vmin: float, vmax: float) -> None: | |
| filename="preprocessed_to_be_aligned_elev_map", | ||
| vmin=vmin, | ||
| vmax=vmax, | ||
| cbar_title=f"Elevation ({self.to_be_aligned_elev.crs.linear_units})", | ||
| ) | ||
| else: | ||
| self.reference_elev = self.reference_elev.crop(coord_intersection) | ||
|
|
@@ -224,7 +221,6 @@ def _prepare_datas(self, vmin: float, vmax: float) -> None: | |
| filename="preprocessed_reference_elev_map", | ||
| vmin=vmin, | ||
| vmax=vmax, | ||
| cbar_title=f"Elevation ({self.reference_elev.crs.linear_units})", | ||
| ) | ||
|
|
||
| if self.level > 1: | ||
|
|
@@ -342,32 +338,66 @@ def run(self) -> None: | |
| self.stats_after["median"] + 3 * self.stats_after["nmad"], | ||
| ) | ||
|
|
||
| self.generate_plot( | ||
| dem=self.diff_before, | ||
| title="Difference between To-be-align and Reference elevation\n(before coregistration)", | ||
| filename="diff_elev_diff_coreg_map", | ||
| dem_right=self.diff_after, | ||
| title_dem_right="Difference between Aligned and Reference elevation\n(after coregistration)", | ||
| vmin=vmin_diff, | ||
| vmax=vmax_diff, | ||
| cmap="RdBu", | ||
| cbar_title=f"Elevation differences ({self.diff_before.crs.linear_units})", | ||
| ) | ||
| if self.level == 1: | ||
| self.generate_plot( | ||
| dem=self.diff_before, | ||
| title="Difference between To-be-aligned and Reference elevation\n(before coregistration)", | ||
| filename="diff_elev_diff_coreg_map", | ||
| dem_right=self.diff_after, | ||
| title_dem_right="Difference between Aligned and Reference elevation\n(after coregistration)", | ||
| vmin=vmin_diff, | ||
| vmax=vmax_diff, | ||
| cmap="RdBu", | ||
| ) | ||
| else: | ||
| self.generate_plot_with_profiles( | ||
|
Contributor
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. one 2x1 plot -> two 1x1 plot |
||
| dem=self.diff_before, | ||
| title="Difference between To-be-aligned and Reference elevation\n(before coregistration)", | ||
| filename="diff_elev_before_coreg_map", | ||
| vmin=vmin_diff, | ||
| vmax=vmax_diff, | ||
| cmap="RdBu", | ||
| ) | ||
|
|
||
| self.generate_plot_with_profiles( | ||
| dem=self.diff_after, | ||
| title="Difference between Aligned and Reference elevation\n(after coregistration)", | ||
| filename="diff_elev_after_coreg_map", | ||
| vmin=vmin_diff, | ||
| vmax=vmax_diff, | ||
| cmap="RdBu", | ||
| ) | ||
|
|
||
| if self.level > 1: | ||
| self.diff_coreg_tba = aligned_elev.reproject(self.to_be_aligned_elev) - self.to_be_aligned_elev | ||
|
|
||
| self.generate_plot( | ||
| self.generate_plot_with_profiles( | ||
| dem=self.diff_coreg_tba, | ||
| title="Difference between Aligned and To-be-align elevation\n(no coregistration)", | ||
| title="Difference between Aligned and To-be-aligned elevation\n(after coregistration)", | ||
| filename="diff_elev_coreg_tba_map", | ||
| cmap="RdBu", | ||
| cbar_title=f"Elevation differences ({self.diff_after.crs.linear_units})", | ||
| ) | ||
| else: | ||
| self.diff = self.to_be_aligned_elev - self.reference_elev | ||
| self.stats = self.diff.get_stats(stats_keys) | ||
| vmin, vmax = -(self.stats["median"] + 3 * self.stats["nmad"]), self.stats["median"] + 3 * self.stats["nmad"] | ||
| if self.level == 1: | ||
| self.generate_plot( | ||
| self.diff, | ||
| title="Difference between To-be-aligned and Reference elevation", | ||
| filename="diff_elev_without_coreg_map", | ||
| vmin=vmin, | ||
| vmax=vmax, | ||
| cmap="RdBu", | ||
| ) | ||
| else: | ||
| self.generate_plot_with_profiles( | ||
| dem=self.diff, | ||
| title="Difference between To-be-aligned and Reference elevation", | ||
| filename="diff_elev_without_coreg_map", | ||
| vmin=vmin, | ||
| vmax=vmax, | ||
| cmap="RdBu", | ||
| ) | ||
| self.generate_plot( | ||
| self.diff, | ||
| title="Difference between To-be-align and Reference elevation", | ||
|
|
@@ -494,26 +524,32 @@ def print_dict(title: str, dictionary: dict[str, Any]) -> str: | |
| div_html += "</div>\n" | ||
| return div_html | ||
|
|
||
| def print_png(title: str, width: int = 100) -> str: | ||
| return ( | ||
| f"<img src='plots/{title}.png' alt='Image PNG' style='width: {width}%; " | ||
| f"height: auto; justify-content: center'>\n" | ||
| ) | ||
|
|
||
| # Metadata: Inputs | ||
| inputs_information = list_dict[0] | ||
| html += print_dict(inputs_information[0], inputs_information[1]) | ||
|
|
||
| # Plot preprocessed data if did | ||
| if "sampling_grid" in self.config["inputs"] and self.config["inputs"]["sampling_grid"] is not None: | ||
| if self.config["inputs"]["sampling_grid"] == "reference_elev": | ||
| preprocessed_data = "plots/preprocessed_to_be_aligned_elev_map.png" | ||
| preprocessed_data = "preprocessed_to_be_aligned_elev_map" | ||
| else: | ||
| preprocessed_data = "plots/preprocessed_reference_elev_map.png" | ||
| preprocessed_data = "preprocessed_reference_elev_map" | ||
|
|
||
| html += "<h2>Preprocessed elevation data</h2>\n" | ||
| html += "<img src='" + preprocessed_data + "' alt='Image PNG' style='width: 100%; height: auto;'>\n" | ||
| html += print_png(preprocessed_data) | ||
|
|
||
| # Metadata: Inputs | ||
| for title, dictionary in list_dict[1:]: # type: ignore | ||
| html += print_dict(title, dictionary) | ||
|
|
||
| if self.compute_coreg and self.level > 1: | ||
| html += "<img src='plots/diff_elev_coreg_tba_map.png' alt='Image PNG' style='width: 100%; height: auto'>\n" | ||
| html += print_png("diff_elev_coreg_tba_map") | ||
|
|
||
| # Statistics table: | ||
| if self.df_stats is not None: | ||
|
|
@@ -530,16 +566,19 @@ def print_dict(title: str, dictionary: dict[str, Any]) -> str: | |
| # Coregistration: Add elevation difference plot and histograms before/after | ||
| if self.compute_coreg: | ||
| html += "<h2>Elevation differences</h2>\n" | ||
| html += "<img src='plots/diff_elev_diff_coreg_map.png' alt='Image PNG' style='width: 100%; height: auto'>\n" | ||
| if self.level == 1: | ||
| html += print_png("diff_elev_diff_coreg_map") | ||
| else: | ||
| html += print_png("diff_elev_before_coreg_map") | ||
| html += print_png("diff_elev_after_coreg_map") | ||
|
|
||
| html += "<h2>Differences histogram</h2>\n" | ||
| html += "<img src='plots/elev_diff_histo.png' alt='Image PNG' style='width: 100%; height: auto'>\n" | ||
| html += print_png("elev_diff_histo") | ||
|
|
||
| else: | ||
| html += "<h2>Elevation differences</h2>\n" | ||
| html += ( | ||
| "<img src='plots/diff_elev_without_coreg_map.png' alt='Image PNG' style='width: 100%; height: auto'>\n" | ||
| ) | ||
| html += print_png("diff_elev_without_coreg_map") | ||
|
|
||
| html += """ | ||
| </body> | ||
| </html> | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
color bar is ALWAYS f"Elevation ({self.reference_elev.crs.linear_units})", so not a param anymore