UNPKG

@seasketch/geoprocessing

Version:

Geoprocessing and reporting framework for SeaSketch 2.0

66 lines (65 loc) 3.95 kB
import { Zone } from "./types.js"; import { RegBasedClassificationMetric, RbcsMpaProtectionLevel } from "./index.js"; import { Sketch, SketchCollection, NullSketch, NullSketchCollection, Metric } from "../types/index.js"; /** * Type guard for checking string is one of supported objective IDs * Use in conditional block logic to coerce to type RbcsObjectiveKey within the block */ export declare function isRbcsProtectionLevel(key: string): key is RbcsMpaProtectionLevel; /** * Returns protection level given MPA classification index value */ export declare function getMpaClassificationName(index: number): "Fully Protected Area" | "Highly Protected Area" | "Moderately Protected Area" | "Poorly Protected Area" | "Unprotected Area"; export declare function getZoneClassificationName(zoneId: number): string; export declare const sketchToZone: (sketch: Sketch | NullSketch, sketchArea: number) => Zone; /** * Returns object mapping sketch id to MPA classification * given sketch for rbcsMpa or collection of sketches for rbcsMpas with rbcs activity userAttributes, * and area metrics for each sketch, assumes each mpa is a single zone mpa * @param sketch - sketch or sketch collection with GEAR_TYPES (multi), * BOATING (single), and AQUACULTURE (single) user attributes * @param childMetrics - area metrics for sketches */ export declare function getSketchToMpaProtectionLevel(sketch: Sketch | SketchCollection | NullSketchCollection | NullSketch, metrics: Metric[]): Record<string, RbcsMpaProtectionLevel>; /** * Transforms an rbcs zone object to a metric * @param sketch - single sketch zone * @param zone - rbcs zone * @param score * @returns */ export declare const rbcsZoneToMetric: (sketchId: string, zone: Zone, score: number) => RegBasedClassificationMetric; export declare const rbcsMpaToMetric: (sketchId: string, score: number, label: string) => RegBasedClassificationMetric; /** * Given sketch for rbcsZone or collection of zone sketches with userAttributes for rcbs activities, * returns metrics with zone classification score as value. * If sketch collection, collection metric will have mpa classification score index as value * @param sketch - sketch or sketch collection with GEAR_TYPES (multi), * BOATING (single), and AQUACULTURE (single) user attributes * @param childMetrics - area metrics for sketches */ export declare function zoneClassMetrics(sketch: NullSketchCollection | NullSketch, childAreaMetrics?: Metric[]): RegBasedClassificationMetric[]; /** * Given sketch for rbcsMpa with rbcs activity userAttributes, * assumes mpa is a single zone mpa and returns metrics with mpa classification score * @param sketch - sketch with GEAR_TYPES (multi), * BOATING (single), and AQUACULTURE (single) user attributes * @param childAreaMetric - area metric for sketch */ export declare function mpaClassMetric(sketch: NullSketch, childAreaMetric: Metric): RegBasedClassificationMetric[]; /** * Given sketch for rbcsMpa or collection of sketches for rbcsMpas with rbcs activity userAttributes, * assumes each mpa is a single zone mpa and returns metrics with mpa classification score * Collection metric will have mpa classification score index as value * @param sketch - sketch or sketch collection with GEAR_TYPES (multi), * BOATING (single), and AQUACULTURE (single) user attributes * @param childMetrics - area metrics for sketches */ export declare function mpaClassMetrics(sketch: NullSketchCollection | NullSketch, childAreaMetrics?: Metric[]): RegBasedClassificationMetric[]; /** * Returns percent protection given index value, * percent is proportion (percent) of bottom color to top color to use for icon given index value (as shown in paper) * e.g. index = 5.4 means bottom icon color should take 25% of icon and top color 75% * @param index - classification index value for sketch collection */ export declare function getIndexIconPerc(index: number): 0 | 100 | 75 | 50 | 25;