Learn R Programming

ggOceanMaps (version 1.1)

raster_bathymetry: Simplify a bathymetry raster ready to be vectorized

Description

Simplifies bathymetry raster ready for the vector_bathymetry function. Warning: processing may take a long time if the bathymetry raster is large.

Usage

raster_bathymetry(
  bathy,
  depths,
  proj.out,
  boundary = NULL,
  file.name = NULL,
  aggregation.factor = NA
)

Arguments

bathy

A raster object or a string giving the path to a bathymetry NetCDF or grd file

depths

Numeric vector giving the cut points for depth contours (see cut.

proj.out

A character string specifying the PROJ.4 projection arguments for the output. See CRS and proj.org.

boundary

A SpatialPolygons(DataFrame) object, text string defining the file path to a spatial polygon, or a numeric vector of length 4 giving the boundaries for which bathy should be cut to. Should be given as decimal degrees. If numeric vector, the first element defines the minimum longitude, the second element the maximum longitude, the third element the minimum latitude and the fourth element the maximum latitude of the bounding box. Use NULL not to cut bathy.

file.name

A character string specifying the file path without extension where the output should be saved. If NULL a temporary file will be used. See writeRaster.

aggregation.factor

An integer defining the fact argument from the aggregate function. Set to NA to ignore aggregation.

Value

A list with raster object containing projected bathymetry defined by the proj.out argument and a data frame of depth intervals.

Details

You can use GEBCO or ETOPO1 bathymetry grids downloaded from respective sources as the bathy argument. The bathymetry grids read from files must be in NetCDF/grd format and defined using decimal degrees. Alternatively use the marmap::getNOAA.bathy function to download ETOPO1 bathymetry and convert it to a raster object using the marmap::as.raster function.

Note that the size of the output is heavily influenced by the number of depth contours (depths) as well as the resolution of bathy and choise of aggregation.factor. To make the vector_bathymetry function and consequent plotting faster, limiting the details of the bathymetry raster may be desireable.

References

GEBCO Compilation Group (2019) GEBCO 2019 15-arcsecond grid (doi:10.5285/836f016a-33be-6ddc-e053-6c86abc0788e). URL: https://www.gebco.net/data_and_products/gridded_bathymetry_data/gebco_2019/gebco_2019_info.html. ETOPO1 1 Arc-Minute Global Relief Model. URL: https://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/docs/ETOPO1.pdf.

See Also

Other create shapefiles: clip_shapefile(), vector_bathymetry()