Skip to contents

Reads the pre-computed H3 effort grid and CPUE Parquet files from cloud storage, derives fishing grounds, and uploads web-ready files that can be fetched directly by a Next.js / DeckGL application.

Versioned files are produced (following the package's add_version() convention, i.e. prefix__YYYYMMDDHHMMSS_<sha7>__extension):

  • pds-h3-effort-r{h3_res}__*__json: all-fleet JSON array for H3HexagonLayer (one row per h3_index × year)

  • pds-h3-effort-gear-r{h3_res}__*__json: same metrics broken down by gear and country (one row per h3_index × year × gear × country); only emitted when the effort grid carries the gear/country columns

  • pds-cpue-r{h3_res}__*__json: JSON array for H3HexagonLayer

  • pds-fishing-grounds__*__geojson: GeoJSON FeatureCollection for GeoJsonLayer

Usage

export_pds_spatial(
  h3_res = 9L,
  min_trips_grounds = 3L,
  log_threshold = logger::DEBUG,
  package = "coasts"
)

Arguments

h3_res

Integer. H3 resolution of the effort grid to export. Default is 9L.

min_trips_grounds

Integer. Minimum unique trips per H3 cell to include in fishing grounds derivation and in pds_effort. Default is 3L.

log_threshold

Logging threshold. Default is logger::DEBUG.

package

Name of the package whose inst/conf.yml to read. Defaults to "coasts".

Value

Invisibly NULL. Uploads the web-ready files described above to GCS and MongoDB as a side effect.

Details

Files follow the same versioning convention as other pipeline outputs (add_version()). The consuming Next.js app uses cloud_object_name() or an equivalent GCS listing + timestamp sort to discover the latest version.

Schema for each file:

  • Effort JSON (per H3 cell × year): [{h3_index, year, fishing_hours, unique_trips, n_active_days, avg_fidelity, constancy, avg_hours_per_day, avg_visits_per_day, hours_per_trip}]

  • Effort-by-gear JSON (per H3 cell × year × gear × country): the effort schema with gear and country inserted after year.

  • CPUE JSON: [{h3_index, country, species, cpue, n_trips, lon, lat}]

  • Fishing grounds GeoJSON (same metrics, plus ground-specific; country is included when the effort grid carries it): {ground_id, country, area_km2, n_cells, fishing_hours, unique_trips, n_active_days, avg_fidelity, constancy, avg_hours_per_day, avg_visits_per_day, hours_per_trip, fishing_hours_per_km2, unique_trips_per_km2, hours_per_day_per_km2}

When the effort grid carries country, the same cells and grounds also go to the coasts portal MongoDB database for the country dashboards, which filter them by country:

  • pds_effort: one document per h3_index × country, all years pooled, {h3_index, country, fishing_hours, unique_trips, n_active_days, avg_hours_per_day, lng, lat} (lng/lat is the cell centre)

  • pds_fishing_grounds: the fishing grounds GeoJSON, one document per ground