Skip to content

API

ReefGuideAPI._cache_location Method
julia
_cache_location(config::Dict)::String

Retrieve cache location for geotiffs.

source

ReefGuideAPI._lon_lat_to_tile Method
julia
_lon_lat_to_tile(zoom, lon, lat)

Identify the corresponding tile coordinates for a given lon/lat.

Returns

x and y tile coordinates

source

ReefGuideAPI._tile_bounds Method
julia
_tile_bounds(z::T, x::T, y::T) where {T<:Int64}

Obtain lon/lat bounds of a requested tile.

Returns

West, East, North South (min lon, max lon, lat max, lat min)

source

ReefGuideAPI._tile_to_lon_lat Method
julia
_tile_to_lon_lat(z::T, x::T, y::T) where {T<:Int64}

Obtain lon/lat of top-left corner of a requested tile.

Returns

lon, lat

source

ReefGuideAPI._write_cog Method
julia
_write_cog(file_path::String, data::Raster, config::Dict)::Nothing

Write out a COG using common options.

Arguments

  • file_path : Path to write data out to

  • data : Raster data to write out

source

ReefGuideAPI.adjusted_nearest Method
julia
adjusted_nearest(rst::Raster, z::Int, x::Int, y::Int, tile_size::Tuple{Int,Int}, orig_rst_size::Tuple{Int,Int})::Matrix

Resample a raster using nearest neighbor interpolation when the tile includes area outside where data exists (e.g., viewing the globe where the data may appear in a small corner of the tile). This approach attempts to account for planetary curvature while still maintaining some performance.

Arguments

  • rst: The input raster to be resampled.

  • z: Tile zoom level requested.

  • x: x coordinate for requested tile.

  • y: y coordinate for the requested tile.

  • tile_size: The desired dimensions of the tile (long, lat).

Returns

Matrix with the resampled data.

source

ReefGuideAPI.apply_criteria_lookup Method
julia
apply_criteria_lookup(
    reg_criteria::RegionalCriteria,
    rtype::Symbol,
    ruleset::Vector{CriteriaBounds{Function}}
)

Filter lookup table by applying user defined ruleset criteria.

Arguments

  • reg_criteria : RegionalCriteria containing valid_rtype lookup table for filtering.

  • rtype : Flats or slope category for assessment.

  • ruleset : User defined ruleset for upper and lower bounds.

Returns

Filtered lookup table containing points that meet all criteria in ruleset.

source

ReefGuideAPI.apply_criteria_thresholds Method
julia
apply_criteria_thresholds(criteria_stack::RasterStack, lookup::DataFrame, ruleset::Vector{CriteriaBounds{Function}})::Raster
apply_criteria_thresholds(criteria_stack::RasterStack, lookup::DataFrame, ruleset::Dict)::Raster
apply_criteria_thresholds(criteria_stack::RasterStack, lookup::DataFrame, ruleset::NamedTuple)::Raster

Apply thresholds for each criteria.

Arguments

  • criteria_stack : RasterStack of criteria data for a given region

  • lookup : Lookup dataframe for the region

  • ruleset : A set of CriteriaBounds, Dictionary or NamedTuple indicating a mapping of criteria names to their lower and upper thresholds.

Returns

BitMatrix indicating locations within desired thresholds

source

ReefGuideAPI.assess_reef_site Method
julia
assess_reef_site(
    rel_pix::DataFrame,
    geom::GI.Wrappers.Polygon,
    max_count::Float64,
    target_crs::GeoFormatTypes.EPSG;
    degree_step::Float64=15.0,
    start_rot::Float64=0.0,
    n_per_side::Int64=2,
    suit_threshold::Float64=0.7
)::Tuple{Float64,Int64,GI.Wrappers.Polygon,Int64}

Assesses the rotations of a search box geom for their suitability score (calculated as the proportion of pixels that meet all specified criteria thresholds). Search box rotation steps are returned so that the start_rot angle is 0, rotations anti-clockwise are negative and rotations clockwise are positive.

Extended help

The scores produced are a proportion of the polygon that are covered by valid pixel points, relative to the maximum number of points (max_count) (0-1). max_count is approximate (determined by user x_dist and y_dist box dimensions) and doesn't account for buffering and rotation of the search box. In rare cases scores could be > 1, however returned values are capped at max 1.

Arguments

  • rel_pix : The point data for relevant pixels that are within the search area around a pixel.

  • geom : Starting search box for assessment.

  • max_count : The maximum number of pixels that can intersect the search box (used to standardise scores between 0 and 1).

  • target_crs : Coordinate Reference System used for analysis vector and raster data.

  • degree_step : Step to vary the search box rotations.

  • start_rot : Starting angle rotation that aligns the box with the closest reef edge.

  • n_per_side : Number of rotations to perform around the starting search box angle.

  • suit_threshold : Suitability threshold, below which sites are excluded from result sets.

Returns

  • Highest score

  • Highest scoring rotation step

  • Highest scoring polygon

  • Quality control flag for site, indicating if suit_threshold was met in the highest scoring rotation.

source

ReefGuideAPI.assess_reef_site Method
julia
assess_reef_site(
    rst::Union{Raster,RasterStack},
    geom::GI.Wrappers.Polygon,
    ruleset::Dict{Symbol,Function};
    degree_step::Float64=15.0,
    start_rot::Float64=0.0,
    n_per_side::Int64=1
)::Tuple{Float64,Int64,GI.Wrappers.Polygon}

Assess given reef site for it's suitability score at different specified rotations around the initial reef-edge rotation.

Arguments

  • rst : Raster of suitability scores.

  • geom : Initial site polygon with no rotation applied.

  • ruleset : Criteria ruleset to apply to rst pixels when assessing which pixels are suitable.

  • degree_step : Degree value to vary each rotation by. Default = 15 degrees.

  • start_rot : Initial rotation used to align the site polygon with the nearest reef edge. Default = 0 degrees.

  • n_per_side : Number of times to rotate polygon on each side (clockwise and anticlockwise). Default = 2 rotations on each side.

Returns

  • Highest score identified with rotating polygons.

  • The index of the highest scoring rotation.

  • The polygon with the highest score out of the assessed rotated polygons.

source

ReefGuideAPI.assess_region Method
julia
assess_region(reg_assess_data, reg, qp, rtype)

Perform raster suitability assessment based on user-defined criteria.

Arguments

  • reg_assess_data : Dictionary containing the regional data paths, reef outlines and full region names.

  • reg : Name of the region being assessed (format Cairns-Cooktown rather than Cairns/Cooktown Management Area).

  • qp : Dict containing bounds for each variable being filtered.

  • rtype : Type of zone to assess (flats or slopes).

Returns

GeoTiff file of surrounding hectare suitability (1-100%) based on the criteria bounds input by a user.

source

ReefGuideAPI.assess_region Method
julia
assess_region(config, qp::Dict, reg::String, rtype::String, reg_assess_data::OrderedDict)

Convenience method wrapping around the analysis conducted by assess_region(). Checks for previous assessment of indicated region and returns filename of cache if found.

source

ReefGuideAPI.assess_sites Method
julia
assess_sites(
    reg_assess_data::OrderedDict,
    reg::String,
    rtype::String,
    pixel_criteria::Dict,
    site_criteria::Dict,
    assess_locs::Raster
)

Arguments

  • reg_assess_data : Regional assessment data

  • reg : Short region name

  • rtype : Slopes or Flats assessment type

  • pixel_criteria : parameters to assess specific locations with

  • site_criteria : parameters to assess sites based on their polygonal representation

  • assess_locs : Raster of suitability scores for each valid pixel

Returns

GeoDataFrame of all potential sites

source

ReefGuideAPI.buffer_simplify Method
julia
buffer_simplify(
    gdf::DataFrame;
    number_verts::Int64=30,
    buffer_dist_m::Int64=40
)::Vector{GeoInterface.Wrappers.WrapperGeometry}

Simplify and buffer the polygons in a GeoDataFrame to account for uncertainty and inaccuracies in the reef outlines.

Arguments

  • gdf : GeoDataFrame containing the reef polygons in gdf.geometry.

  • number_verts : Number of vertices to simplify the reefs to. Default is 30 vertices.

  • buffer_dist_m : Buffering distance in meters to account for innacuracies in reef outlines. Default distance is 20m.

Returns

Vector containing buffered and simplified reef polygons

source

ReefGuideAPI.cache_filename Method
julia
cache_filename(qp::Dict, config::Dict, suffix::String, ext::String)

Generate a filename for a cache.

Arguments

  • qp : Query parameters to hash

  • config : app configuration (to extract cache parent directory from)

  • suffix : a suffix to use in the filename (pass "" if none required)

  • ext : file extension to use

source

ReefGuideAPI.closest_reef_edge Method
julia
closest_reef_edge(
    pixel::GeometryBasics.Point{2, Float64},
    reef_lines::Vector{T}
)::Vector{Tuple{Float64, Float64}} where {T}

Find the nearest line in reef_lines to a point pixel.

Arguments

  • pixel : Target point geometry.

  • reef_lines : Vector containing lines for comparison.

Returns

Coordinates of the reef edge line that is closest to the target pixel. Returned in Tuples.

source

ReefGuideAPI.create_bbox Method
julia
create_bbox(xs::Tuple, ys::Tuple)::Vector{Tuple{Float64, Float64}}

Create bounding box from x and y coordinates

Returns

Bounding box coordinates in order of top left, top right, bottom right, bottom left, top left.

source

ReefGuideAPI.criteria_middleware Method
julia
criteria_middleware(handle)

Creates middleware that parses a criteria query before reaching an endpoint

Example

https://somewhere:8000/suitability/assess/region-name/reeftype?criteria_names=Depth,Slope&lb=-9.0,0.0&ub=-2.0,40

source

ReefGuideAPI.degrees_to_meters Method
julia
degrees_to_meters(x, lat)

Convert degrees to meters at target latitude.

source

ReefGuideAPI.filter_distances Method
julia
filter_distances(
    target_rast::Raster,
    dist_buffer
)::Raster

Apply a mask to exclude pixels that are outside the indicated distance buffer(s).

target_rast and the dist_buffer should be in the same CRS (e.g., EPSG:7844 / GDA2020).

Arguments

  • target_rast : Raster of suitable pixels (Bool) to filter pixels from.

  • dist_buffer : Buffer geometry to use as the mask.

Returns

  • Masked boolean raster indicating pixels that are within the target distance.

source

ReefGuideAPI.filter_distances Method
julia
filter_distances(
    target_rast::Raster,
    gdf::DataFrame,
    dist_nm
)::Raster

Exclude pixels in target_rast that are beyond dist_nm (nautical miles) from a geometry in gdf. target_rast and gdf should be in the same CRS (EPSG:7844 / GDA2020 for GBR-reef-guidance-assessment).

Arguments

  • target_rast : Boolean raster of suitable pixels to filter.

  • gdf : DataFrame with geometry column that contains vector objects of interest.

  • dist_nm : Filtering distance from geometry object in nautical miles.

Returns

  • tmp_areas : Raster of filtered pixels containing only pixels within target distance

from a geometry centroid.

source

ReefGuideAPI.filter_far_reefs Method
julia
filter_far_reefs(gdf::DataFrame, pixel::GIWrap.Point, lat::Float64, dist::Union{Int64,Float64})::BitVector

Filter out reefs that are > dist (meters) from the target pixel (currently dist is hardcoded in initial_search_rotation()).

source

ReefGuideAPI.filter_sites Method
julia
filter_sites(res_df::DataFrame)::DataFrame

Filter out sites where the qc_flag indicates a suitability < surr_threshold in searching. Where site polygons are overlapping, keep only the highest scoring site polygon.

Arguments

  • res_df : Results DataFrame containing potential site polygons (output from identify_potential_sites() or identify_edge_aligned_sites()).

Returns

DataFrame containing only the highest scoring sites where site polygons intersect, and containing only sites with scores greater than the surr_threshold specified in identify_edge_aligned_sites() (default=0.6).

source

ReefGuideAPI.find_horizontal Method
julia
find_horizontal(geom::GI.Wrappers.Polygon)::Vector{Tuple{Float64,Float64}, Tuple{Float64,Float64}}

Find a horizontal line if one exists within a geometry.

Returns

Vector containing tuples of coordinates for a horizontal line found within geom.

source

ReefGuideAPI.from_zero Method
julia
from_zero(v::Vector{Tuple{Float64,Float64}})::Vector{Tuple{Float64, Float64}}

Translates Vector of points v to begin from (0, 0), retaining direction and length.

Argument

  • v : Vector of point coordinates (Tuple{Float64, Float64}).

source

ReefGuideAPI.generate_criteria_mask! Method
julia
generate_criteria_mask!(fn::String, rst_stack::RasterStack, lookup::DataFrame, ruleset::Vector{CriteriaBounds{Function}})

Generate mask file for a given region and reef type (slopes or flats) according to thresholds applied to a set of criteria.

Notes

  • Zeros indicate locations to mask out.

  • Ones indicate locations to keep.

Arguments

  • fn : File to write geotiff to

  • reg_criteria : RegionalCriteria to assess

  • rtype : reef type to assess (:slopes or :flats)

  • crit_map : List of criteria thresholds to apply (see apply_criteria_thresholds())

Returns

Nothing

source

ReefGuideAPI.get_points Method
julia
get_points(geom)

Helper method to retrieve points for a geometry.

source

ReefGuideAPI.identify_edge_aligned_sites Method
julia
identify_edge_aligned_sites(
    env_lookup::DataFrame,
    search_pixels::DataFrame,
    res::Float64,
    gdf::DataFrame,
    x_dist::Union{Int64,Float64},
    y_dist::Union{Int64,Float64},
    target_crs::GeoFormatTypes.EPSG,
    region::String;
    degree_step::Float64=15.0,
    n_rot_p_side::Int64=2,
    suit_threshold::Float64=0.7
)::DataFrame

Identify the most suitable site polygons for each pixel in the search_pixels DataFrame. x_dist and y_dist are x and y lengths of the search polygon in meters. A buffer of the raster files' resolution is applied to the search box. And angle from a pixel to a reef edge is identified and used for searching with custom rotation parameters. Method is currently opperating for CRS in degrees units.

Arguments

  • env_lookup : DataFrame containing environmental variables for assessment.

  • search_pixels : DataFrame containing lon and lat columns for each pixel that is intended for analysis.

  • res : Resolution of the original raster pixels. Can by found via abs(step(dims(raster, X))).

  • reef_outlines : GeoDataFrame of reef outlines used to align the search box edge.

  • x_dist : Length of horizontal side of search box (in meters).

  • y_dist : Length of vertical side of search box (in meters).

  • target_crs : CRS of the input Rasters. Using GeoFormatTypes.EPSG().

  • region : Region name, e.g. "Cairns-Cooktown" or "FarNorthern".

  • degree_step : Degree to perform rotations around identified edge angle.

  • n_rot_p_side : Number of rotations to perform clockwise and anticlockwise around the identified edge angle. Default 2 rotations.

  • suit_threshold : Theshold used to skip searching where the proportion of suitable pixels is too low.

Returns

DataFrame containing highest score, rotation and polygon for each assessment at pixels in indices.

source

ReefGuideAPI.identify_edge_aligned_sites Method
julia
identify_edge_aligned_sites(
    rst_stack::Raster,
    search_pixels::DataFrame,
    gdf::DataFrame,
    x_dist::Union{Int64,Float64},
    y_dist::Union{Int64,Float64},
    target_crs::GeoFormatTypes.EPSG,
    region::String,
    reef_lines::Vector{Vector{GeometryBasics.Line{2,Float64}}};
    degree_step::Float64=15.0,
    n_rot_per_side::Int64=2
)::DataFrame

Identify the most suitable site polygons for each pixel in the search_pixels DataFrame. x_dist and y_dist are x and y lengths of the search polygon. A buffer of rst_stack resolution is applied to the search box. And angle from a pixel to a reef edge is identified and used for searching with custom rotation parameters.

Arguments

  • rst_stack : Raster containing environmental variables for assessment.

  • search_pixels : DataFrame containing lon and lat values for each pixel intended for

  • gdf : GeoDataFrame containing the reef outlines used to align the search box edge.

  • x_dist : Length of horizontal side of search box.

  • y_dist : Length of vertical side of search box.

  • target_crs : CRS of the input Rasters. Using GeoFormatTypes.EPSG().

  • region : Management region name in GBRMPA format - e.g. "Mackay/Capricorn Management Area"

  • reef_lines : Vector containing reef outline segments for each reef in gdf.geometry (Must be separate object to gdf rather than a column).

  • degree_step : Degree to perform rotations around identified edge angle.

  • n_rot_per_side : Number of rotations to perform clockwise and anticlockwise around the identified edge angle. Default 2 rotations.

Returns

DataFrame containing highest score, rotation and polygon for each assessment at pixels in indices.

source

ReefGuideAPI.initial_search_box Method
julia
initial_search_box(
    (lon::Float64, lat::Float64),
    x_dist::Union{Int64, Float64},
    y_dist::Union{Int64, Float64},
    target_crs::GeoFormatTypes.EPSG,
    res::Float64
)::GI.Wrappers.Polygon

Create an initial search box that is centered around the point (lon, lat) in target_crs, and is buffered by res distance.

Arguments

  • (lon, lat) : Longitude and latitude coordinates of the center target pixel.

  • x_dist : x (longitude) dimension length of initial search box.

  • y_dist : y (latitude) dimension length of initial search box.

  • target_crs : Target CRS of box to match input data types.

  • res : Buffer distance (resolution of input raster search data).

Returns

Initial search box geometry.

source

ReefGuideAPI.initial_search_rotation Method
julia
initial_search_rotation(
    pixel::GeometryBasics.Point{2, Float64},
    geom_buff::GI.Wrappers.Polygon,
    gdf::DataFrame,
    reef_outlines::Vector{Vector{T}};
    search_buffer::Union{Int64,Float64}=20000.0
)::Float64 where {T}

Identifies the closest edge to the target pixel/geom_buff. The angle required to rotate geom_buff by to match this reef edge is calculated.

Extended help

The returned angle is the angle relative to the default geom_buff horizontal orientation. Therefore, if returned angle = 45 degrees, rot_geom(geom_buff, 45) will rotate geom_buff by 45 degrees to match the identified reef edge.

Arguments

  • pixel : Target point at the center of the search polygon.

  • geom_buff : Initial search box with zero rotation.

  • reef_geoms : Geometries representing reefs

  • reef_outlines : Line segments for the outlines of each reef in gdf.

Returns

Rotation angle required to match reef edge when used in rotate_geom(geom_buff, rot_angle).

source

ReefGuideAPI.initialize_regional_data_cache Method
julia
initialize_regional_data_cache(reef_data_path::String, reg_cache_fn::String)

Create initial regional data store with data from reef_data_path, excluding geospatial data and save to reg_cache_fn path.

source

ReefGuideAPI.line_angle Method
julia
line_angle(a::T, b::T)::Float64 where {T <: Vector{Tuple{Float64,Float64}}}

Calculate the angle between two lines.

Arguments

  • a : Line between point coordinates.

  • b : Line between point coordinates.

Returns

Angle between the two lines.

Examples

julia
line_angle([(0.0,5.0), (0.0,0.0)], from_zero(edge_line))
line_angle([(0.0,5.0), (0.0,0.0)], [(1.0, 4.0), (7.0, 8.0)])

source

ReefGuideAPI.lookup_assess_region Method
julia
lookup_assess_region(reg_assess_data, reg, qp, rtype; x_dist=100.0, y_dist=100.0)

Perform suitability assessment with the lookup table based on user-defined criteria. This is currently orders of magnitude slower than the raster-based approach, although it uses significantly less memory.

Arguments

  • reg_assess_data : Dictionary containing the regional data paths, reef outlines and full region names.

  • reg : Name of the region being assessed (format Cairns-Cooktown rather than Cairns/Cooktown Management Area).

  • qp : Dict containing bounds for each variable being filtered.

  • rtype : Type of zone to assess (flats or slopes).

  • x_dist : width of search polygon

  • y_dist : height of search polygon

Returns

Raster of surrounding hectare suitability (1-100%) based on the criteria bounds input by a user.

source

ReefGuideAPI.mask_region Method
julia
mask_region(reg_assess_data, reg, qp, rtype)

Arguments

  • reg_assess_data : Regional assessment data

  • reg : The region name to assess

  • qp : query parameters

  • rtype : region type (one of :slopes or :flats)

Returns

Raster of region with locations that meet criteria masked.

source

ReefGuideAPI.meters_to_degrees Method
julia
meters_to_degrees(x, lat)

Convert meters to degrees at target latitude.

source

ReefGuideAPI.move_geom Method
julia
move_geom(geom, new_centroid::Tuple)::GI.Wrappers.Polygon

Move a geom to a new centroid.

Arguments

  • geom : geometry to move

  • new_centroid : Centroid given in (lon, lat).

source

ReefGuideAPI.n_gdal_threads Method
julia
n_gdal_threads(config::Dict)::String

Retrieve the configured number of threads to use when writing COGs with GDAL.

source

ReefGuideAPI.output_geojson Method
julia
output_geojson(destination_path::String, df::DataFrame)::Nothing

Writes out GeoJSON file to a target directory. Output file will be located at location: destination_path.

Arguments

  • destination_path : File path to write geojson file to.

  • df : DataFrame intended for writing to geojson file.

source

ReefGuideAPI.parse_criteria_query Method
julia
parse_criteria_query(qp)::Tuple

Parse criteria values from request query.

Queries should take the form of: Depth=-9.0:0.0&Slope=0.0:40.0&Rugosity=0.0:0.0

Arguments

  • qp : Parsed query string from request.

Returns

Tuple of criteria names, lower bounds, upper bounds

source

ReefGuideAPI.polygon_to_lines Method
julia
polygon_to_lines(
    polygon::Union{Vector{T},T,GIWrap.MultiPolygon}
) where {T<:GIWrap.Polygon}

Extract the individual lines between vertices that make up the outline of a polygon.

Returns

Vector of GeometryBasics.LineString{2, Float64} with one line for each adjacent vertex pair in polygon.

source

ReefGuideAPI.port_buffer_mask Method
julia
port_buffer_mask(gdf::DataFrame, dist::Float64; unit::String="NM")

Create a masking buffer around indicated port locations.

Arguments

  • gdf : GeoDataFrame of port locations (given as long/lat points)

  • dist : distance from port in degrees (deg), kilometers (km), or nautical miles (NM; default)

  • unit : unit dist is in

source

ReefGuideAPI.proportion_suitable Method
julia
proportion_suitable(
    x::Union{BitMatrix,SparseMatrixCSC{Bool,Int64}}; square_offset::Tuple=(-4, 5)
)::SparseMatrixCSC{UInt8,Int64}

Calculate the the proportion of the subsection that is suitable for deployments. The subsection is the surrounding a rough hectare area centred on each cell of a raster marked as being suitable according to user-selected criteria.

Cells on the edges of a raster object are assessed using a smaller surrounding area, rather than shifting the window inward. In usual applications, there will be no target pixel close to the edge due to the use of buffer areas.

Arguments

  • x : Matrix of boolean pixels after filtering with user criteria.

  • square_offset : The number of pixels +/- around a center "target" pixel to assess as the moving window. Defaults to (-4, 5). Assuming a 10m² pixel, the default square_offset resolves to a one hectare area.

Returns

Matrix of values 0 - 100 indicating the percentage of the area around the target pixel that meet suitability criteria.

source

ReefGuideAPI.remove_rugosity Method
julia
remove_rugosity(reg, criteria, lbs, ubs)

Remove rugosity layer from consideration if region is not Townsville. Rugosity data currently only exists for the Townsville region.

source

ReefGuideAPI.rotate_geom Method
julia
rotate_geom(
    geom,
    degrees::Float64,
    target_crs::GeoFormatTypes.EPSG
)

Rotate target geom by degrees rotation in clockwise direction. target_crs is applied to output geometry.

Returns

Rotated geometry.

source

ReefGuideAPI.rotate_polygon Method
julia
rotate_polygon(poly_points, centroid, degrees)

Rotate target poly_points by degrees rotation about its center defined by centroid.

source

ReefGuideAPI.rotate_polygon Method
julia
rotate_polygon(geom, degrees)

Rotate target geom by degrees rotation about its center.

Returns

Rotated geometry.

source

ReefGuideAPI.search_lookup Method
julia
search_lookup(raster::Raster, threshold::Union{Int64,Float64})::DataFrame

Build a look up table identifying all pixels in a raster that meet a suitability threshold.

Arguments

  • raster : Raster of regional data

  • threshold : Suitability threshold value (greater or equal than)

Returns

DataFrame containing indices, lon and lat for each pixel that is intended for further analysis.

source

ReefGuideAPI.setup_regional_data Method
julia
setup_regional_data(config::Dict)

Load regional data to act as an in-memory cache.

Arguments

  • config : Configuration settings, typically loaded from a TOML file.

  • reef_data_path : Path to pre-prepared reef data

Returns

OrderedDict of RegionalCriteria for each region.

source

ReefGuideAPI.threshold_mask Method
julia
threshold_mask(reg_criteria, rtype::Symbol, crit_map)::Raster
threshold_mask(reg_criteria, rtype::Symbol, crit_map, lons::Tuple, lats::Tuple)::Raster

Generate mask for a given region and reef type (slopes or flats) according to thresholds applied to a set of criteria.

Notes

  • Zeros indicate locations to mask out.

  • Ones indicate locations to keep.

Arguments

  • reg_criteria : RegionalCriteria to assess

  • rtype : reef type to assess (:slopes or :flats)

  • crit_map : List of criteria thresholds to apply (see apply_criteria_thresholds())

  • lons : Longitudinal extent (min and max, required when generating masks for tiles)

  • lats : Latitudinal extent (min and max, required when generating masks for tiles)

Returns

True/false mask indicating locations within desired thresholds.

source

ReefGuideAPI.tile_size Method
julia
tile_size(config::Dict)::Tuple

Retrieve the configured size of map tiles in pixels (width and height / lon and lat).

source

ReefGuideAPI.valid_lonlat_inds Method
julia
valid_lonlat_inds(data::DataFrame, criteria::Symbol, lb::T, ub::T) where {T}

Retrieve the indices of valid data for a region.

Arguments

  • data :

  • criteria :

  • lb :

  • ub :

Returns

Tuple{Vector{Int64}, Vector{Int64}}, of lon and lat indices.

source

ReefGuideAPI.valid_pixel_positions Method
julia
valid_pixel_positions(data::DataFrame, criteria::Symbol, lb::T, ub::T) where {T}

Obtain the pixel positions of valid data.

Intended for use in applications similar to ImageryLayer - client side pixel filter.

Arguments

  • data :

  • criteria :

  • lb : lower bound

  • ub : upper bound

source

ReefGuideAPI.warmup_cache Method
julia
warmup_cache(config_path::String)

Invokes warm up of regional data cache to reduce later spin up times.

source

ReefGuideAPI.within_thresholds Method
julia
within_thresholds(ctype::Val, data::Raster, lb::T, ub::T) where {T}

Apply in-bound constraints.

Notes

Why is this a simple one line function? Because we want to be able to cache results for each constraint type.

source