Skip to content

Commit 0480e2a

Browse files
Diagnostic plotting extension (#304)
* Update example notebook * Fix validation function * Initial diagnostic plotting * DiagnosticPlot class * Pre-commit changes * Fix notebook image relative pathing * Another fix to relative pathing * Move images to a folder in `/example_workbooks` * Update dependencies * Changes to extension * Fixes to notebook * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add pinning for `jupyter_bokeh` to avoid unresolvable bug when using older versions * Add offset for minimum point size in `nasc_map` * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Changes to diagnostic plotting functions * Changes to diagnostic plotting notebook * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 96a0315 commit 0480e2a

10 files changed

+1277
-12
lines changed

docs/_toc.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ parts:
1414
sections:
1515
- file: example_notebooks/example_echopop_workflow
1616
- file: example_notebooks/report_generation
17-
- file: example_notebooks/plotting.ipynb
17+
- file: example_notebooks/plotting
18+
- file: example_notebooks/diagnostic_plotting
1819
- file: theory
1920
title: Underlying theory
2021
sections:

docs/example_notebooks/diagnostic_plotting.ipynb

+712
Large diffs are not rendered by default.
Loading
Loading

echopop/analysis.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ def krige(input_dict: dict, analysis_dict: dict, settings_dict: dict) -> tuple[p
362362
arguments and user-defined inputs.
363363
"""
364364

365+
# Initialize kriging analysis dictionary
366+
analysis_dict.update({"kriging": {}})
367+
365368
# Validate cropping method parameters
366369
validated_cropping_methods = MeshCrop.create(**settings_dict["cropping_parameters"])
367370
# ---- Update the dictionary
@@ -419,7 +422,16 @@ def krige(input_dict: dict, analysis_dict: dict, settings_dict: dict) -> tuple[p
419422
)
420423
else:
421424
# ---- Compute the cropped mesh
422-
mesh_full = crop_mesh(transect_data, mesh_data, validated_cropping_methods)
425+
mesh_full, transect_mesh_regions = crop_mesh(
426+
transect_data, mesh_data, validated_cropping_methods
427+
)
428+
# ---- Append 'transect_mesh_regions' to analysis variable
429+
analysis_dict["kriging"].update(
430+
{
431+
"transect_mesh_regions_df": transect_mesh_regions,
432+
}
433+
)
434+
# ---- Print message, if verbose
423435
if (settings_dict["verbose"]) and (
424436
validated_cropping_methods["crop_method"] == "convex_hull"
425437
):
@@ -453,7 +465,7 @@ def krige(input_dict: dict, analysis_dict: dict, settings_dict: dict) -> tuple[p
453465
# -------- y
454466
mesh_full["y"] = mesh_full["latitude"]
455467
# --- Append to the analysis attribute
456-
analysis_dict.update({"kriging": {"mesh_df": mesh_full, "transect_df": transect_data}})
468+
analysis_dict["kriging"].update({"mesh_df": mesh_full, "transect_df": transect_data})
457469

458470
# Kriged results
459471
kriged_results = kriging(

echopop/extensions/__init__.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
from .survey_extensions import patch_generate_reports as generate_reports
1+
from .survey_extensions import (
2+
patch_diagnostic_plots as diagnostic_plots,
3+
patch_generate_reports as generate_reports,
4+
)
25

36

47
# Flex patch import
58
def import_all_patches():
9+
diagnostic_plots()
610
generate_reports()
711

812

913
# ---- Automatic import for `import echopop.extensions`
1014
import_all_patches()
1115

1216
# Exposed individual patches for selective importing
13-
__all__ = ["generate_reports"]
17+
__all__ = ["diagnostic_plots", "generate_reports"]

0 commit comments

Comments
 (0)