Extracts a single time slice from a local NetCDF file, OPeNDAP dataset, or THREDDS catalog-backed workflow and returns a `ggplot2` map. The function supports both curvilinear EMS grids with cell corners and regular regridded products that provide cell centres only.

map_ereefs(
  var_name = "true_colour",
  target_date = c(2018, 1, 30),
  layer = "surface",
  Land_map = FALSE,
  input_file = "catalog",
  input_grid = NA,
  scale_col = "viridis",
  scale_lim = c(NA, NA),
  plot_style = c("polygon", "smooth"),
  smooth_pixels = 600,
  zoom = 6,
  box_bounds = c(NA, NA, NA, NA),
  p = NA,
  suppress_print = TRUE,
  return_poly = FALSE,
  label_towns = TRUE,
  strict_bounds = FALSE,
  mark_points = NULL,
  gbr_poly = FALSE
)

Arguments

var_name

Variable to plot. Special values `"true_colour"` and `"plume"` are also supported.

target_date

Date or date-time to plot. If an exact match is not available, the nearest model output time is used.

layer

Layer selector. Use a positive layer index, a negative depth below mean sea level, or `"surface"`/`"bottom"`.

Land_map

Logical; add a simple land underlay where available.

input_file

NetCDF file path, OPeNDAP URL, or THREDDS catalog URL.

input_grid

Optional alternative source for grid metadata.

scale_col

Colour scale specification. Defaults to `"viridis"` for scalar maps.

scale_lim

Numeric colour limits. If left as `NA`, limits are inferred from the extracted data.

plot_style

Either `"polygon"` or `"smooth"`.

smooth_pixels

Resolution used for `"smooth"` display maps.

zoom

Deprecated legacy argument retained for backward compatibility.

box_bounds

Optional bounds in the form `c(longitude_min, longitude_max, latitude_min, latitude_max)`.

p

Optional existing plot object to add to.

suppress_print

Logical; if `TRUE`, suppresses automatic printing.

return_poly

Logical; if `TRUE`, return a list containing the plot and plotting polygons instead of only the plot object.

label_towns

Logical; add town labels where available.

strict_bounds

Deprecated legacy argument retained for backward compatibility.

mark_points

Optional locations to mark on the map.

gbr_poly

Logical; add GBR polygon overlay when available.

Value

A `ggplot2` object, or if `return_poly = TRUE`, a list containing the plot, plotting polygons, cell values, and associated metadata.