raster_bathymetry: Simplify a bathymetry raster ready for vectorization

View source: R/raster_bathymetry.R

raster_bathymetryR Documentation

Simplify a bathymetry raster ready for vectorization

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 = NULL,
  proj.bathy = NULL,
  boundary = NULL,
  warp = FALSE,
  estimate.land = FALSE,
  downsample = NULL,
  verbose = TRUE
)

Arguments

bathy

A stars 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). If NULL, no depth aggregation will be made. This option is suitable for raster bathymetries passed directly to basemap.

proj.out

A character string specifying the coordinate reference system (CRS) argument for the output. See st_crs and proj.org. If NULL, the projection is retrieved from bathy and the output will not be reprojected saving processing time (since proj.out and proj.bathy would match.

proj.bathy

A character string specifying the CRS for the input (bathy). Only required if bathy lacks CRS information. If NULL, "EPSG:4326" is assumed.

boundary

A st_polygon object, text string defining the file path to a spatial polygon, bounding box, or a numeric vector of length 4 giving the boundaries for which bathy should be cut to. Should be given as decimal degrees. If unnamed 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. You can also use the sf bounding box format as named vector. Use NULL not to cut bathy.

warp

Logical indicating whether the resulting grid should be resampled to a new CRS if proj.out != proj.bathy using the st_warp function. A time-consuming operation, but necessary when CRS changes in raster bathymetries. Not required if the next step is to vectorise the bathymetry.

estimate.land

Logical indicating whether to include land to the output. Can be used in the following vector_bathymetry step to estimate land polygons.

downsample

An integer defining how many rows in bathy should be skipped to reduce the size (and resolution). 1 skips every second row, 2 every second and third. See st_downsample. Set to NULL (default) to skip downsampling.

verbose

Logical indicating whether information about progress and guessed projection should be returned. Set to FALSE to make the function silent.

Details

You can use GEBCO, IBCAO, ETOPO bathymetry grids downloaded from respective sources as the bathy argument. The bathymetry grids read from files must be in any format read by read_stars. 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 choice of downsample. To make the vector_bathymetry function and consequent plotting faster, limiting the details of the bathymetry raster may be desirable.

Value

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

Author(s)

Mikko Vihtakari

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. NOAA National Centers for Environmental Information. 2022: ETOPO 2022 15 Arc-Second Global Relief Model. NOAA National Centers for Environmental Information. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.25921/fd45-gt74")}.

See Also

Other create shapefiles: clip_shapefile(), geonorge_bathymetry(), vector_bathymetry()


ggOceanMaps documentation built on May 29, 2024, 5:36 a.m.