get_depths: Get depths of locations from a bathymetry raster

View source: R/get_depths.R

get_depthsR Documentation

Get depths of locations from a bathymetry raster

Description

Given a bathymetry raster and an input dataframe of point locations (given in decimal degrees), computes the depths at these locations (values for the cell each point falls in). The accuracy is dependent on the resolution of the bathymetry raster (see load_Bathy to get high resolution data).

Usage

get_depths(Input, Bathy, NamesIn = NULL)

Arguments

Input

dataframe with, at least, Latitudes and Longitudes. If NamesIn is not provided, the columns in the Input must be in the following order:

Latitude, Longitude, Variable 1, Variable 2, ... Variable x.

Bathy

bathymetry raster with the appropriate projection, such as this one. It is highly recommended to use a raster of higher resolution than SmallBathy (see load_Bathy).

NamesIn

character vector of length 2 specifying the column names of Latitude and Longitude fields in the Input. Latitudes name must be given first, e.g.:

NamesIn=c('MyLatitudes','MyLongitudes').

Value

dataframe with the same structure as the Input with an additional depth column 'd'.

See Also

load_Bathy, create_Points, create_Stations, get_iso_polys.

Examples



#Generate a dataframe
MyData=data.frame(Lat=PointData$Lat,
Lon=PointData$Lon,
Catch=PointData$Catch)

#get depths of locations
MyDataD=get_depths(Input=MyData,Bathy=SmallBathy())
#View(MyDataD)
plot(MyDataD$d,MyDataD$Catch,xlab='Depth',ylab='Catch',pch=21,bg='blue')




CCAMLRGIS documentation built on Sept. 27, 2023, 9:09 a.m.