Eliminate boundaries that do not have any data in them or are duplicates

filter_boundaries(y, boundaries)

Arguments

y

A vector of y-axis coordinates, i.e., latitude. Coordinates should be in real values whether that is decimal degrees or m it does not matter but they cannot be character values.

boundaries

TODO document

Value

A data frame with two columns (i.e., upper and lower) is returned, where the bad areas are removed. If the input vectors are named, then the resulting rows of the returned data frame will also be named.

Details

Sometimes boundaries can be exactly equal and therefore do not need to be included in a set. Other times a boundary was initially valid but because there were no observations in the southern or northern limits the truncated boundary makes the area become exactly equal to another boundary. This can often be the case when there are no southern observations and a boundary becomes equal to the coastwide boundary. Sometimes a northern boundary is further south than the southern boundary, which essentially is a negative area. The opposite can also happen. All of the above constitute bad boundaries.

Users often input perfectly fine boundaries but it is the truncation to only positive tows, which is in effort to not predict to areas without observations that leads to the boundary being bad.

Examples

# Removes OR because there are only observations in WA and CA
filter_boundaries(y = c(34, 48), boundaries = boundaries_data)
#>                              upper    lower
#> Coastwide                 48.00000 34.00000
#> WA                        48.00000 46.00000
#> CA                        42.00000 34.00000
#> North of Point Conception 48.00000 34.45000
#> South of Point Conception 34.45000 34.00000
#> North of Cape Mendocino   48.00000 40.16667
#> South of Cape Mendocino   40.16667 34.00000
#> North of Monterey Bay     48.00000 36.00000
#> South of Monterey Bay     36.00000 34.00000
# Shrinks northern borders and removes WA because no observations in WA
filter_boundaries(y = c(45.5, 34), boundaries = boundaries_data)
#>                              upper    lower
#> Coastwide                 45.50000 34.00000
#> OR                        45.50000 42.00000
#> CA                        42.00000 34.00000
#> North of Point Conception 45.50000 34.45000
#> South of Point Conception 34.45000 34.00000
#> North of Cape Mendocino   45.50000 40.16667
#> South of Cape Mendocino   40.16667 34.00000
#> North of Monterey Bay     45.50000 36.00000
#> South of Monterey Bay     36.00000 34.00000