Module Streamlines.Plot

Plot - Workflow module that produces plots of DTM, ROI, and processed results

Copyright (C) 2017-2018,  Colin P Stark and Gavin J Stark.  All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @file   plot.ml
 * @brief  Plot workflow
 *
module Option = Batteries.Option
module Owl_plot = Streamlines__.Local_owl_plot
module ODM = Owl.Dense.Matrix.Generic
module ODN = Owl.Dense.Ndarray.Generic

Types

type t_plot = {
props : Properties.t_props_plot;
region : int list list;
plot : Owl_plot.handle;
subplots : int * int;
mutable current_sub : int;
filename : string;
}

t_plot

Structure used by the Plot workflow module

pv_verbosity functions

val pv_noisy : t_plot ‑> (unit ‑> unit) ‑> unit

pv_noisy t

Shortcut to use Plot.t_plot verbosity for Properties.pv_noisy

val pv_debug : t_plot ‑> (unit ‑> unit) ‑> unit

pv_debug t

Shortcut to use Plot.t_plot verbosity for Properties.pv_debug

val pv_info : t_plot ‑> (unit ‑> unit) ‑> unit

pv_info t

Shortcut to use Plot.t_plot verbosity for Properties.pv_info

val pv_verbose : t_plot ‑> (unit ‑> unit) ‑> unit

pv_verbose t

Shortcut to use Plot.t_plot verbosity for Properties.pv_verbose

Matrix conversion functions to generate plottable big arrays (doubles) from others

val matrix_for_plot_float32 : region:int list list ‑> (float, Bigarray.float32_elt) ODN.t ‑> (float, Bigarray.float64_elt) ODM.t

matrix_for_plot_float32 ~region ba

Take an (x,y) big array of float32s and prepare it for plotting; replacing any NaNs with 0, transposing it to be (y,x), then flipping vertically (as 0,0 is at the top? for plplot)

The region is extracted first - for all, use ; to subsample by 5 in X and 3 in Y use [0;-1;5];[0;-1;3]; to select X from 10 to 30 and Y from 40 to 70 use [10;30];[40;70] etc

val matrix_for_plot_byte : region:int list list ‑> (char, 'aODM.t ‑> (float, Bigarray.float64_elt) ODM.t

matrix_for_plot_byte ~region ba

Take an (x,y) big array of chars and prepare it for plotting; transposing it to be (y,x), then flipping vertically (as 0,0 is at the top? for plplot)

see matrix_for_plot_float32 for details on regions

Shading and Masking array creation

val generate_hillshade : (float, 'aStreamlines__.Globals.ODM.t ‑> float ‑> float ‑> (float, 'aODM.t

generate_hillshade ba azimuth_degrees angle_altitude_degrees

Hillshade render DTM topo with light from direction azimuth_degrees and tilt angle_attitude_degrees

Generate a 0,1 matrix with each pixel being a shaded relief

val generate_masked_roi : (float, 'aODM.t ‑> (char, 'bODN.t ‑> (float, 'aStreamlines__.Globals.ODN.t

generate_masked_roi ba mask

Generate a 0,0.99 matrix with each pixel being a height, with masked out as 1.0

This can be plotted with a color map with colors in the range 0-0.99 of required alpha, and a color for 1.0 with an alpha of 0

val all : 'a list
val pi : float
val plot_roi_contours : ?⁠region:int list list ‑> Core.t_core_data ‑> Owl_plot.handle ‑> Owl_plot.handle
val plot_roi_image : ?⁠region:int list list ‑> Core.t_core_data ‑> Owl_plot.handle ‑> Owl_plot.handle
val oldplot_roi_image : ?⁠region:int list list ‑> Core.t_core_data ‑> Owl_plot.handle ‑> Owl_plot.handle
val plot_basin_mask : ?⁠region:int list list ‑> Core.t_core_data ‑> Owl_plot.handle ‑> Owl_plot.handle
val new_figure : ?⁠title:string ‑> ?⁠window_title:string ‑> ?⁠region:float array ‑> ?⁠x_pixel_scale:float ‑> ?⁠y_pixel_scale:float ‑> t_plot ‑> unit

new_figure ?title ?window_title ?region ?x_pixel_scale ?y_pixel_scale t

Create a new figure with bounding boxes and so on

Overlay plot functions

val plot_updownstreamlines_overlay : ?⁠do_down:bool ‑> t_plot ‑> Core.t_core_data ‑> Core.t_trace_results ‑> unit

plot_updownstreamlines_overlay ?do_down t data results

Plot upstream or downstream streamlines, by selecting streamlines from seeds in the results (randomly if there are more than the limit specified in the properties).

Show a progress while the plotting is ongoing

Plot trajectories from the seed using lines (should be of the correct color, size and alpha)

val plot_roi_shaded_relief_overlay : ?⁠do_plot_color_relief:bool ‑> ?⁠color_alpha:float ‑> ?⁠hillshade_alpha:float ‑> t_plot ‑> Core.t_core_data ‑> unit

plot_roi_shaded_relief_overlay ?do_plot_color_relief ?color_alpha ?hillshade_alpha t data

Append a plot of a shaded relief of ROI

val plot_classical_streamlines_overlay : ?⁠region:int list list ‑> 'a ‑> Core.t_core_data ‑> 'b ‑> unit

plot_classical_streamlines_overlay t data results

Classic streamlines (overlay method)

*

Output plot creation functions

val plot_dtm_shaded_relief : t_plot ‑> ?⁠subsample:int ‑> Core.t_core_data ‑> Geodata.t_data ‑> unit

plot_dtm_shaded_relief t ?subsample:(subsample=5) data geodata

Create a figure with a plot of the shaded relief of DTM

Add the figure to the output plots

val plot_roi_shaded_relief : t_plot ‑> Core.t_core_data ‑> unit

plot_roi_shaded_relief t data

Create a figure with the plot of the shaded relief of ROI

Add the figure to the output plots

val plot_streamlines : t_plot ‑> Core.t_core_data ‑> Core.t_trace_results ‑> unit

plot_streamlines t data results

Create a figure with the semi-transparent shaded relief, and plot flow vectors, streamlines, seed points, blockages and loops on as required by the properties

Add the figure to the output plots

val plot_classical_streamlines : t_plot ‑> Core.t_core_data ‑> 'a ‑> unit

plot_classical_streamlines t data results

Create a figure with the ROI shaded relieft overlaid by arrows for classical streamlines for the vector uv field

Output plot group creation functions

val plot_maps : t_plot ‑> Core.t_core_data ‑> Geodata.t_data ‑> Core.t_trace_results ‑> unit

plot_maps t data geodata results

Plot maps of DTM ROI streamlines and processed grids

val plot_distributions : 'a ‑> 'b ‑> unit

plot_distributions t data

blah

Workflow functions

val create : Properties.t_props ‑> t_plot

create props

Create the Plot workflow from its properties

val process : t_plot ‑> Core.t_core_data ‑> Geodata.t_data ‑> Core.t_trace_results ‑> unit

process t data geodata results

Perform the plot workflow, creating all the plots required by the properties.