Title: | Southern Ocean maps |
---|---|
Description: | Create publication-quality Southern Ocean maps in a simple manner with multiple management layer options. Future versions will have the option of adding extra rounded legends for other layers. |
Authors: | Dale Maschette [aut, cre], Michael Sumner [aut], Ben Raymond [aut] |
Maintainer: | Dale Maschette <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.6.2.9005 |
Built: | 2024-11-19 05:45:11 UTC |
Source: | https://github.com/AustralianAntarcticDivision/SOmap |
Bathymetric data reprocessed from the GEBCO_2014 Grid data set.
data(Bathy)
data(Bathy)
An object of class "RasterLayer"
The GEBCO_2014 Grid, version 20150318
Example sea ice concentration data from the Southern Ocean (2018-10-15). (See "data-raw/ice.R").
## Not run: ll <- "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" xy <- coordinates(spTransform(as(SOmap_data$fronts_orsi, "SpatialPoints"), ll)) ## just because you can doesn't mean you should ... SOmap_auto(xy[,1], xy[,2], bathy = ice, input_points = FALSE, levels = c(15, 30, 60, 90)) ## End(Not run)
## Not run: ll <- "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" xy <- coordinates(spTransform(as(SOmap_data$fronts_orsi, "SpatialPoints"), ll)) ## just because you can doesn't mean you should ... SOmap_auto(xy[,1], xy[,2], bathy = ice, input_points = FALSE, levels = c(15, 30, 60, 90)) ## End(Not run)
used in SOleg to test color palettes
is.discrete(x)
is.discrete(x)
x |
Object to test for is it discrete |
returns true false
Latitude mask for polar projections; written by M.D. Sumner and part of the spex package.
latmask(x, latitude = 0, southern = TRUE)
latmask(x, latitude = 0, southern = TRUE)
x |
A raster layer. |
latitude |
maximum latitude (effectively a minimum latitude if southern = FALSE) |
southern |
flag for whether south-polar context is used, default is TRUE |
## Not run: ## assumes that you have already defined a raster object called 'ice' plot(latmask(ice, -60)) ## End(Not run)
## Not run: ## assumes that you have already defined a raster object called 'ice' plot(latmask(ice, -60)) ## End(Not run)
Reproject a SOmap object by specifying a 'target' projection string (PROJ4)
## S3 method for class 'SOmap' reproj(x, target, ..., source = NULL) ## S3 method for class 'SOmap_auto' reproj(x, target, ..., source = NULL) ## S3 method for class 'SOmap_management' reproj(x, target, ..., source = NULL) ## S3 method for class 'SOmap_legend' reproj(x, target, ..., source = NULL) ## S3 method for class 'BasicRaster' reproj(x, target, ..., source = NULL) ## S3 method for class 'Spatial' reproj(x, target, ..., source = NULL) ## S3 method for class 'sf' reproj(x, target, ..., source = NULL) ## S3 method for class 'sfc' reproj(x, target, ..., source = NULL)
## S3 method for class 'SOmap' reproj(x, target, ..., source = NULL) ## S3 method for class 'SOmap_auto' reproj(x, target, ..., source = NULL) ## S3 method for class 'SOmap_management' reproj(x, target, ..., source = NULL) ## S3 method for class 'SOmap_legend' reproj(x, target, ..., source = NULL) ## S3 method for class 'BasicRaster' reproj(x, target, ..., source = NULL) ## S3 method for class 'Spatial' reproj(x, target, ..., source = NULL) ## S3 method for class 'sf' reproj(x, target, ..., source = NULL) ## S3 method for class 'sfc' reproj(x, target, ..., source = NULL)
x |
coordinates |
target |
target specification (PROJ.4 string or epsg code) |
... |
arguments passed to the underlying projection engine, see |
source |
source specification (PROJ.4 string or epsg code) |
See reproj::reproj()
for details.
So many ...
## Not run: set.seed(27) amap <- SOmap_auto() reproj(amap, "+proj=moll") reproj(amap, "+proj=laea +lat_0=-55 +lon_0=154 +datum=WGS84") bmap <- SOmap(trim = -35) ## works great! reproj(bmap, "+proj=stere +lat_0=-90 +lon_0=147 +lat_ts=-71 +datum=WGS84") ## these aren't exactly ideal reproj(bmap, "+proj=ortho +lat_0=-70") reproj(bmap, "+proj=laea +lat_0=-55 +lon_0=154 +datum=WGS84") ## End(Not run)
## Not run: set.seed(27) amap <- SOmap_auto() reproj(amap, "+proj=moll") reproj(amap, "+proj=laea +lat_0=-55 +lon_0=154 +datum=WGS84") bmap <- SOmap(trim = -35) ## works great! reproj(bmap, "+proj=stere +lat_0=-90 +lon_0=147 +lat_ts=-71 +datum=WGS84") ## these aren't exactly ideal reproj(bmap, "+proj=ortho +lat_0=-70") reproj(bmap, "+proj=laea +lat_0=-55 +lon_0=154 +datum=WGS84") ## End(Not run)
SOmap
and similar objects contain all of the data and code required to draw a map. This information is embedded in SO_plotter
objects within the SOmap
object.
SO_plotter(plotfun, plotargs = NULL, name = NULL)
SO_plotter(plotfun, plotargs = NULL, name = NULL)
plotfun |
function or string: either the name of a function to use, or the function itself |
plotargs |
list: arguments to pass to the function |
name |
string: optional name for this element |
An object of class SO_plotter
SOmap
## Not run: p <- SOmap() ## replace the `box` element with different plotting code p$box <- SO_plotter(plotfun = "graphics::box", plotargs = list(col = "red")) ## you can also specify multiple plotting instructions for a single graphical element ## of a map p$box <- c(SO_plotter(plotfun = "graphics::box", plotargs = list(col = "red")), SO_plotter(plotfun = "graphics::box", plotargs = list(lwd = 2))) ## End(Not run)
## Not run: p <- SOmap() ## replace the `box` element with different plotting code p$box <- SO_plotter(plotfun = "graphics::box", plotargs = list(col = "red")) ## you can also specify multiple plotting instructions for a single graphical element ## of a map p$box <- c(SO_plotter(plotfun = "graphics::box", plotargs = list(col = "red")), SO_plotter(plotfun = "graphics::box", plotargs = list(lwd = 2))) ## End(Not run)
Reproject and crop Spatial and sf objects to SOmap objects
SOauto_crop(layer, x, sp = TRUE)
SOauto_crop(layer, x, sp = TRUE)
layer |
: an |
x |
: a SOmap or SOauto_map object |
sp |
logical: if |
If successful, a reprojected and cropped version of layer
. If the reprojection or cropping operations fail, the returned object will be of class try-error
. If the cropping operations return an empty object (i.e. no parts of layer
lie within the bounds of x
) then the returned object will either be NULL
(if sp = TRUE
) or an sf
object with no features if sp = FALSE
.
## Not run: a <- SOmap_auto(c(0, 50), c(-70, -50)) x <- SOauto_crop(SOmap_data$fronts_orsi, a) plot(a) plot(x, add = TRUE) a <- SOmap(trim = -60) x <- SOauto_crop(SOmap_data$EEZ, a) plot(a) plot(x, add = TRUE) ## End(Not run)
## Not run: a <- SOmap_auto(c(0, 50), c(-70, -50)) x <- SOauto_crop(SOmap_data$fronts_orsi, a) plot(a) plot(x, add = TRUE) a <- SOmap(trim = -60) x <- SOauto_crop(SOmap_data$EEZ, a) plot(a) plot(x, add = TRUE) ## End(Not run)
Creates a raster density layer from a set of points.
SObin( x, y = NULL, baselayer = NULL, ..., col = hcl.colors(26, "Viridis"), dim = c(512, 512), add = TRUE, target = NULL, source = NULL, data.frame = FALSE )
SObin( x, y = NULL, baselayer = NULL, ..., col = hcl.colors(26, "Viridis"), dim = c(512, 512), add = TRUE, target = NULL, source = NULL, data.frame = FALSE )
x |
longitudes |
y |
latitudes |
baselayer |
optional spatial layer to get extent from |
... |
passed to plot if |
col |
colours to use if |
dim |
dimensions of raster to bin to |
add |
if |
target |
target projection passed to SOproj |
source |
source projection of data projection passed to SOproj |
data.frame |
if true return a data frame instead of a raster. |
A raster. If add = TRUE
, it is returned invisibly.
## Not run: SOmap_auto() pts <- cbind(lon = runif(1e6, min = -180, max = 180), lat = runif(1e6, min = -90, max = 90)) bin <- SObin(pts[, 1], pts[, 2], add = TRUE) ## End(Not run)
## Not run: SOmap_auto() pts <- cbind(lon = runif(1e6, min = -180, max = 180), lat = runif(1e6, min = -90, max = 90)) bin <- SObin(pts[, 1], pts[, 2], add = TRUE) ## End(Not run)
This is thoroughly experimental!
SOcode(x, data_object_name = "SOmap_data")
SOcode(x, data_object_name = "SOmap_data")
x |
: a map object as returned by SOmap, SOmanagement, SOleg, or SOgg |
data_object_name |
string: the name to use for the object that will hold the map data. See Examples, below |
A list with two elements: code
contains R code that will draw the map, and SOmap_data
(or whatever was passed as the data_object_name
argument) contains any data required by that code
## Not run: p <- SOmap() mapcode <- SOcode(p, data_object_name = "SOmap_data") ## write this code to a file my_R_file <- tempfile(fileext = ".R") writeLines(mapcode$code, con = my_R_file) ## you can edit the code in that file if desired ## save the data my_data_file <- tempfile(fileext = ".rds") saveRDS(mapcode$SOmap_data, my_data_file) ## later on, we can re-load the data and execute the code SOmap_data <- readRDS(my_data_file) source(my_R_file) ## or just to show that this works, evaluate the returned code directly against its data with(mapcode, for (codeline in code) eval(parse(text = codeline))) ## End(Not run)
## Not run: p <- SOmap() mapcode <- SOcode(p, data_object_name = "SOmap_data") ## write this code to a file my_R_file <- tempfile(fileext = ".R") writeLines(mapcode$code, con = my_R_file) ## you can edit the code in that file if desired ## save the data my_data_file <- tempfile(fileext = ".rds") saveRDS(mapcode$SOmap_data, my_data_file) ## later on, we can re-load the data and execute the code SOmap_data <- readRDS(my_data_file) source(my_R_file) ## or just to show that this works, evaluate the returned code directly against its data with(mapcode, for (codeline in code) eval(parse(text = codeline))) ## End(Not run)
Set or return the coordinate system currently in use.
SOcrs(crs = NULL)
SOcrs(crs = NULL)
crs |
provide PROJ string to set the value |
If argument crs
is NULL, the function returns the current value (which may be NULL
).
## Not run: SOmap() SOcrs() ## End(Not run)
## Not run: SOmap() SOcrs() ## End(Not run)
Note: this function is still experimental! Use at your own risk.
SOgg(...)
SOgg(...)
... |
: one or more objects as returned by |
An object of class "SOmap_gg", "SOmanagement_gg", or "SOmap_auto_gg". Printing or plotting this object will cause it to generate a ggplot2 object, which will be returned to the user. If this object is printed or plotted (e.g. to the console) then it will be displayed in the current graphics device as is usual for ggplot2 objects.
## Not run: ## generate a SOmap object p <- SOmap2(trim = -45, iwc = TRUE, iwc_labels = TRUE, graticules = TRUE, fronts = TRUE, mpa = TRUE, mpa_labels = TRUE) ## convert this to a ggplot2-based representation pg <- SOgg(p) ## display it pg ## we can see that this object has a bunch of ggplot code embedded inside of it str(pg) ## and that code can be modified if desired ## e.g. change the bathymetry colours pg$scale_fill[[1]]$plotargs$colours <- topo.colors(21) ## plot it pg ## If we want to change the legend breaks we can add breaks to the plotting arguments. pg$scale_fill[[1]]$plotargs$breaks <- c(0,500,1000,4000) ## when the print or plot method is called on pg, it creates an actual ggplot2 ## object, which we can capture and modify pg_gg <- plot(pg) class(pg_gg) ## modifying this is done in the same way any other ggplot object is modified ## e.g. add a new scale_fill_gradientn to override the existing one pg_gg + ggplot2::scale_fill_gradientn(colours = heat.colors(21)) ## End(Not run)
## Not run: ## generate a SOmap object p <- SOmap2(trim = -45, iwc = TRUE, iwc_labels = TRUE, graticules = TRUE, fronts = TRUE, mpa = TRUE, mpa_labels = TRUE) ## convert this to a ggplot2-based representation pg <- SOgg(p) ## display it pg ## we can see that this object has a bunch of ggplot code embedded inside of it str(pg) ## and that code can be modified if desired ## e.g. change the bathymetry colours pg$scale_fill[[1]]$plotargs$colours <- topo.colors(21) ## plot it pg ## If we want to change the legend breaks we can add breaks to the plotting arguments. pg$scale_fill[[1]]$plotargs$breaks <- c(0,500,1000,4000) ## when the print or plot method is called on pg, it creates an actual ggplot2 ## object, which we can capture and modify pg_gg <- plot(pg) class(pg_gg) ## modifying this is done in the same way any other ggplot object is modified ## e.g. add a new scale_fill_gradientn to override the existing one pg_gg + ggplot2::scale_fill_gradientn(colours = heat.colors(21)) ## End(Not run)
Text size in base graphics is generally specified via cex
values, which are multipliers applied to the device pointsize. SOgg_cex
is a convenience function that converts a cex value into a size
value as used by ggplot2 geometries.
SOgg_cex(cex)
SOgg_cex(cex)
cex |
numeric: character expansion, see |
The corresponding 'size' value to use in ggplot calls
Rounded legends for SOmap
SOleg( x = NULL, position = "topright", col = NULL, ticks = NULL, tlabs = NULL, breaks = NULL, trim = -45, type = "discrete", label = "", ladj = 0.5, lsrt = 0, lcex = 0.75, tadj = 0.5, tcex = 1, rnd = NULL, border_width = 2 )
SOleg( x = NULL, position = "topright", col = NULL, ticks = NULL, tlabs = NULL, breaks = NULL, trim = -45, type = "discrete", label = "", ladj = 0.5, lsrt = 0, lcex = 0.75, tadj = 0.5, tcex = 1, rnd = NULL, border_width = 2 )
x |
numeric: object to obtain min and max values from for |
position |
string: where you want the legend ("topleft", "topright", "bottomleft", or "bottomright"). |
col |
character: colours to use. |
ticks |
numeric: number of ticks to include on the legend. Only used with |
tlabs |
character: tick labels. Required for |
breaks |
numeric: vector of tick positions for |
trim |
numeric: |
type |
string: type of legend ("discrete" or "continuous"). |
label |
string: legend label. |
ladj |
numeric: distance to adjust the tick labels from the ticks. |
lsrt |
numeric: angle of the tick labels. |
lcex |
numeric: size of the tick labels. |
tadj |
numeric: distance to adjust the title from the ticks. |
tcex |
numeric: size of the title text. |
rnd |
numeric: optional rounding factor for continuous legends using the |
border_width |
numeric: thickness (in degrees of latitude) of the border. |
An object of class "SOmap_legend". Printing or plotting this object will cause it to be added to the SOmap in the current graphics device.
## Not run: SOmap() ## Discrete Legend SOleg(position = "topleft", col = hcl.colors(5, "Viridis"), tlabs = c("a", "b", "c", "d", "e"), trim = -45, label = "Species") ## Continuous Legend SOleg(x = runif(100), position = "topright", col = hcl.colors(80, "Viridis"), breaks = c(0.1, 0.2, 0.5, 0.9), trim = -45, label = "Species", rnd = 1, type = "continuous") ## End(Not run)
## Not run: SOmap() ## Discrete Legend SOleg(position = "topleft", col = hcl.colors(5, "Viridis"), tlabs = c("a", "b", "c", "d", "e"), trim = -45, label = "Species") ## Continuous Legend SOleg(x = runif(100), position = "topright", col = hcl.colors(80, "Viridis"), breaks = c(0.1, 0.2, 0.5, 0.9), trim = -45, label = "Species", rnd = 1, type = "continuous") ## End(Not run)
Function for adding management layers to SOmap
SOmanagement( ccamlr = FALSE, ccamlr_labels = FALSE, ssru = FALSE, ssru_labels = FALSE, ssmu = FALSE, ssmu_labels = FALSE, rb = FALSE, rb_labels = FALSE, sprfmorb = FALSE, trim = -45, eez = FALSE, eez_labels = FALSE, mpa = FALSE, mpa_labels = FALSE, iwc = FALSE, iwc_labels = FALSE, domains = FALSE, domains_labels = FALSE, rb_col = "green", sprfmo_col = "grey50", ccamlr_col = "red", ssru_col = "grey50", ssmu_col = "grey70", eez_col = "maroon", mpa_col = "yellow", iwc_col = "blue", domains_col = "magenta", basemap )
SOmanagement( ccamlr = FALSE, ccamlr_labels = FALSE, ssru = FALSE, ssru_labels = FALSE, ssmu = FALSE, ssmu_labels = FALSE, rb = FALSE, rb_labels = FALSE, sprfmorb = FALSE, trim = -45, eez = FALSE, eez_labels = FALSE, mpa = FALSE, mpa_labels = FALSE, iwc = FALSE, iwc_labels = FALSE, domains = FALSE, domains_labels = FALSE, rb_col = "green", sprfmo_col = "grey50", ccamlr_col = "red", ssru_col = "grey50", ssmu_col = "grey70", eez_col = "maroon", mpa_col = "yellow", iwc_col = "blue", domains_col = "magenta", basemap )
ccamlr |
logical: if |
ccamlr_labels |
logical: if |
ssru |
logical: if |
ssru_labels |
logical: if |
ssmu |
logical: if |
ssmu_labels |
logical: if |
rb |
logical: if |
rb_labels |
logical: if |
sprfmorb |
logical: if |
trim |
numeric: latitude to trim the map to. Set this to -10 for effectively no trim. |
eez |
logical: if |
eez_labels |
logical: if |
mpa |
logical: if |
mpa_labels |
logical: if |
iwc |
logical: if |
iwc_labels |
logical: if |
domains |
logical: if |
domains_labels |
logical: if |
rb_col |
character: colour for CCAMLR research blocks. |
sprfmo_col |
character: colour for SPRFMO toothfish research blocks |
ccamlr_col |
character: colour for CCAMLR boundaries |
ssru_col |
character: colour for CCAMLR small scale research units. |
ssmu_col |
character: colour for CCAMLR small scale management units. |
eez_col |
character: colour for Exclusive Economic Zone boundaries. |
mpa_col |
character: colour for CCAMLR Marine Protected Areas. |
iwc_col |
character: colour for IWC boundaries. |
domains_col |
character: colour for the CCAMLR planning domains boundaries. |
basemap |
SOmap or SOmap_auto: optional map object to extract extent, projection, and other information from. |
An object of class "SOmap_management" containing the requested management layers. Printing or plotting this object will display those layers on the current map (note that an SOmap
object needs to have been plotted first)
## Not run: tfile <- tempfile("SOmap", fileext = ".png") png(tfile, width=22, height=20, units='cm', res=600) SOmap(trim = -45) SOmanagement(ccamlr = TRUE, ccamlr_labels = TRUE, trim=-45) dev.off() unlink(tfile) ## map with non-default latitudinal extent SOmap(trim = -55) ## either provide the same extent via 'trim' SOmanagement(ccamlr = TRUE, ccamlr_labels = TRUE, trim = -55) ## or equivalently, pass the basemap to SOmanagement x <- SOmap(trim = -55) plot(x) SOmanagement(ccamlr = TRUE, ccamlr_labels = TRUE, basemap = x) ## End(Not run)
## Not run: tfile <- tempfile("SOmap", fileext = ".png") png(tfile, width=22, height=20, units='cm', res=600) SOmap(trim = -45) SOmanagement(ccamlr = TRUE, ccamlr_labels = TRUE, trim=-45) dev.off() unlink(tfile) ## map with non-default latitudinal extent SOmap(trim = -55) ## either provide the same extent via 'trim' SOmanagement(ccamlr = TRUE, ccamlr_labels = TRUE, trim = -55) ## or equivalently, pass the basemap to SOmanagement x <- SOmap(trim = -55) plot(x) SOmanagement(ccamlr = TRUE, ccamlr_labels = TRUE, basemap = x) ## End(Not run)
Function for creating round Southern Ocean maps.
SOmap( bathy_legend = TRUE, border = TRUE, trim = -45, graticules = FALSE, straight = FALSE, land = TRUE, land_col = "black", ice = TRUE, ice_col = "black", fronts = FALSE, fronts_col = c("hotpink", "orchid", "plum"), border_col = c("white", "black"), border_width = 2, graticules_col = "grey70" )
SOmap( bathy_legend = TRUE, border = TRUE, trim = -45, graticules = FALSE, straight = FALSE, land = TRUE, land_col = "black", ice = TRUE, ice_col = "black", fronts = FALSE, fronts_col = c("hotpink", "orchid", "plum"), border_col = c("white", "black"), border_width = 2, graticules_col = "grey70" )
bathy_legend |
logical: if |
border |
logical: if |
trim |
numeric: latitude to trim the map to. Set this to -10 for effectively no trim. |
graticules |
logical: if |
straight |
logical: if |
land |
logical: if |
land_col |
character: colour to use for coastline. |
ice |
logical: if |
ice_col |
character: colour to use for ice features. |
fronts |
logical or string: if |
fronts_col |
character: colours for fronts. |
border_col |
character: colours for longitude border. |
border_width |
numeric: thickness (in degrees of latitude) of the border. |
graticules_col |
string: colour for graticule grid. |
An object of class "SOmap", which represents a polar-stereographic map of the southern hemisphere. Printing or plotting this object will cause it to be displayed in the current graphics device.
## Not run: tfile <- tempfile("SOmap", fileext = ".png") png(tfile, width = 22, height = 20, units = "cm", res = 600) SOmap(trim = -45, graticules = TRUE) dev.off() unlink(tfile) SOmap(trim = -45, graticules = TRUE) ## End(Not run)
## Not run: tfile <- tempfile("SOmap", fileext = ".png") png(tfile, width = 22, height = 20, units = "cm", res = 600) SOmap(trim = -45, graticules = TRUE) dev.off() unlink(tfile) SOmap(trim = -45, graticules = TRUE) ## End(Not run)
Given some minimal input information, SOmap_auto
will attempt to guess an appropriate extent and projection to use. For demonstration purposes, run the function without any inputs at all and it will use random location data.
SOmap_auto( x, y, centre_lon = NULL, centre_lat = NULL, target = "stere", dimXY = c(512, 512), bathy = TRUE, land = TRUE, land_col = "black", ice = TRUE, ice_col = "black", input_points = TRUE, input_lines = TRUE, graticule = TRUE, expand = 0.05, contours = FALSE, levels = c(-500, -1000, -2000), ppch = 19, pcol = 2, pcex = 1, bathyleg = FALSE, llty = 1, llwd = 1, lcol = 1, gratlon = NULL, gratlat = NULL, gratpos = "all", ... )
SOmap_auto( x, y, centre_lon = NULL, centre_lat = NULL, target = "stere", dimXY = c(512, 512), bathy = TRUE, land = TRUE, land_col = "black", ice = TRUE, ice_col = "black", input_points = TRUE, input_lines = TRUE, graticule = TRUE, expand = 0.05, contours = FALSE, levels = c(-500, -1000, -2000), ppch = 19, pcol = 2, pcex = 1, bathyleg = FALSE, llty = 1, llwd = 1, lcol = 1, gratlon = NULL, gratlat = NULL, gratpos = "all", ... )
x |
optional input data longitudes. |
y |
optional input data latitudes |
centre_lon |
optional centre longitude (of the map projection, also used to for plot range if |
centre_lat |
as per |
target |
optional projection family (default is |
dimXY |
dimensions of background bathmetry (if used), a default is provided |
bathy |
logical: if |
land |
logical: if |
land_col |
character: colour to use for plotting the coastline |
ice |
logical: if |
ice_col |
character: colour to use for ice features |
input_points |
add points to plot (of x, y) |
input_lines |
add lines to plot (of x, y) |
graticule |
flag to add a basic graticule |
expand |
fraction to expand plot range (default is 0.05, set to zero for no buffer, may be negative) |
contours |
logical: add contours? |
levels |
numeric: contour levels to use if |
ppch |
set point character (default=19) |
pcol |
set point color (default=19) |
pcex |
set point cex (default=1) |
bathyleg |
optional bathymetry legend (default=FALSE) |
llty |
set line type |
llwd |
set line width |
lcol |
set line color |
gratlon |
longitude values for graticule meridians |
gratlat |
latitude values for graticule parallels |
gratpos |
positions (sides) of graticule labels |
... |
reserved, checked for defunct and deprecated usage |
To input your data, use input locations as x
(longitude) and y
(latitude) values. There must be at least two locations. The x
input object can also be provided as a Raster
or Spatial
object, in which case the extent of x
will be used for the map, but note that the contents of x
will not be plotted automatically (use SOplot
to do so).
Try target
families such as 'lcc', 'laea', 'gnom', 'merc', 'aea' if feeling adventurous.
An object of class SOmap_auto, containing the data and other details required to generate the map. Printing or plotting the object will cause it to be plotted.
## Not run: SOmap_auto(c(0, 50), c(-70, -50)) SOmap_auto(runif(10, 130, 200), runif(10, -80, -10)) SOplot(c(147, 180), c(-42, -60), pch = 19, cex = 2,col = "firebrick") SOmap_auto(runif(10, 130, 200), runif(10, -85, -60)) ## save the result to explore later! protomap <- SOmap_auto(runif(10, 60, 160), runif(10, -73, -50)) SOmap_auto(runif(50, 40, 180), runif(50, -73, -10), family = "laea", centre_lat = -15, input_lines = FALSE) ## End(Not run)
## Not run: SOmap_auto(c(0, 50), c(-70, -50)) SOmap_auto(runif(10, 130, 200), runif(10, -80, -10)) SOplot(c(147, 180), c(-42, -60), pch = 19, cex = 2,col = "firebrick") SOmap_auto(runif(10, 130, 200), runif(10, -85, -60)) ## save the result to explore later! protomap <- SOmap_auto(runif(10, 60, 160), runif(10, -73, -50)) SOmap_auto(runif(50, 40, 180), runif(50, -73, -10), family = "laea", centre_lat = -15, input_lines = FALSE) ## End(Not run)
Various spatial datasets that are commonly used on Southern Ocean maps.
data(SOmap_data)
data(SOmap_data)
A list containing the following elements:
CCAMLR_MPA
Description: current marine protected areas
Source: CCAMLR
URL: https://data.ccamlr.org/dataset/marine-protected-areas
License: not specified
CCAMLR_research_blocks
Description: A defined spatial area in which research fishing on toothfish is conducted under a research plan agreed by the Commission
Source: CCAMLR
URL: https://data.ccamlr.org/dataset/research-blocks
License: Not specified
CCAMLR_SSMU
Description: Small-scale management units (SSMUs) are designed to be used as a basis for subdividing the precautionary catch limit for krill in Subareas 48.1, 48.2, 48.3 and 48.4, and in developing management procedures for the krill fishery that can adequately account for localised effects on krill predators (SC-CAMLR-XXI, paragraphs 3.16 to 3.18). The boundaries of the SSMUs are based on predator foraging ranges (refer SC-CAMLR-XXI, Annex 4 and Trathan et al, 2008).
Source: CCAMLR
URL: https://data.ccamlr.org/dataset/small-scale-management-units
License: Not specified
CCAMLR_SSRU
Description: Small-scale research units (SSRUs) are designed to be used as a basis for subdividing the precautionary catch limit for toothfish in exploratory fisheries, and in condcuting research fishing and developing stock assessments. The boundaries of the SSRUs are defined in Conservation Measure 41-01 (2013). CCAMLR Secretariat (2013).
Source: CCAMLR
URL: https://data.ccamlr.org/dataset/small-scale-research-units
License: Not specified
CCAMLR_statistical_areas
Description: Statistical areas, subareas and divisions are used globally for the purpose of reporting fishery statistics. CCAMLR's Convention Area in the Southern Ocean is divided, for statistical purposes, into Area 48 (Atlantic Antarctic) between 70W and 30E, Area 58 (Indian Ocean Antarctic) between 30 and 150E, and Area 88 (Pacific Antarctic) between 150E and 70W. These areas, which are further subdivided into subareas and divisions, are managed by CCAMLR.
Source: CCAMLR
URL: https://data.ccamlr.org/dataset/statistical-areas-subareas-and-divisions
License: Public domain
CCAMLR_VME_polygons
Description: Defined areas of registered vulnerable marine ecosystems as defined under CM 22-09.
Source: CCAMLR
URL: https://gis.ccamlr.org/geoserver/ows?service=wfs&version=1.0.0&request=GetCapabilities
License: Not specified
CCAMLR_VME_fsr
Description: Vulnerable marine ecosystem fine-scale rectangles identified under CM 22-07.
Source: CCAMLR
URL: https://gis.ccamlr.org/geoserver/ows?service=wfs&version=1.0.0&request=GetCapabilities
License: Not specified
CCAMLR_VME_risk_areas
Description: Vulnerable marine ecosystem risk areas declared under CM 22-07.
Source: CCAMLR
URL: https://gis.ccamlr.org/geoserver/ows?service=wfs&version=1.0.0&request=GetCapabilities
License: Not specified
CCAMLR_planning_domains
Description: Nine planning domains were defined during the 2011 CCAMLR workshop on marine protected areas (SC-CAMLR-XXX, Annex 6). These planning domains provide comprehensive coverage of bioregions in the Southern Ocean and may be used as reporting and auditing units for work related to the development of MPAs and as a means to organise future activities related to this effort.
Source: CCAMLR
URL: https://gis.ccamlr.org/geoserver/ows?service=wfs&version=1.0.0&request=GetCapabilities
License: Not specified
continent
Description: Coastline, details TBA
Source: TBA
URL: TBA
License: TBA
EEZ
Description: An exclusive economic zone (EEZ) is a sea zone prescribed by the United Nations Convention on the Law of the Sea over which a state has special rights regarding the exploration and use of marine resources.
Source: Flanders Marine Institute (2020). Union of the ESRI Country shapefile and the Exclusive Economic Zones (version 3). https://doi.org/10.14284/403
URL: https://www.marineregions.org/
License: CC-BY
fronts_orsi
Description: Southern Ocean fronts as defined by Orsi et al. 1995
Source: orsifronts
URL: https://github.com/AustralianAntarcticDivision/orsifronts
License: see orsifronts
seaice_feb and seaice_oct
Description: median October and February sea ice extent
Source: Fetterer, F., K. Knowles, W. Meier, M. Savoie, and A. K. Windnagel. 2017, updated daily. Sea Ice Index, Version 3. Boulder, Colorado USA. NSIDC: National Snow and Ice Data Center
URL: https://doi.org/10.7265/N5K072F8
License: Please cite
mirounga_leonina
Description: Example elephant seal Argos tracking data
Source: Data were sourced from the Integrated Marine Observing System (IMOS) - IMOS is supported by the Australian Government through the National Collaborative Research Infrastructure Strategy and the Super Science Initiative
URL: https://github.com/ianjonsen/bsam
License: Please cite
ADD_coastline_med
Description: Medium-resolution coastline data from the SCAR Antarctic Digital Database. This coastline only covers continental Antarctica: see the GSHHS_i_L1 data for the remainder of the southern hemisphere
Source: SCAR
URL: https://add.data.bas.ac.uk/repository/entry/show?entryid=f477219b-9121-44d6-afa6-d8552762dc45
License: CC-BY. Citation: SCAR Antarctic Digital Database (2018)
GSHHS_i_L1
Description: Coastline data (excluding Antarctica) from the Global Self-consistent, Hierarchical, High-resolution Geography Database. Only southern hemisphere, level 1 (boundary between land and ocean, except Antarctica), intermediate resolution data are included here
Source: Wessel P, Smith WHF (1996) A Global Self-consistent, Hierarchical, High-resolution Shoreline Database. J. Geophys. Res. 101:8741-8743
URL: http://www.soest.hawaii.edu/wessel/gshhg/
License: LGPL
fronts_park
Description: Altimetry-derived Antarctic Circumpolar Current fronts
Source: Park Young-Hyang, Durand Isabelle (2019). Altimetry-drived Antarctic Circumpolar Current fronts. SEANOE.
URL: https://doi.org/10.17882/59800
License: CC-BY-4.0, please cite in full as at DOI
text
, that passes x[[labelcol]]
to text
as the labels
parameterHelper function for labels
This is basically a thin wrapper around text
, that passes x[[labelcol]]
to text
as the labels
parameter
SOmap_text(x, labelcol, ...)
SOmap_text(x, labelcol, ...)
x |
data.frame, Spatial data.frame, or sfc: data to pass to |
labelcol |
string: name of the column in |
... |
other plot arguements |
as for text
Removed from SOmap
default_somap(...) SOauto_map(...)
default_somap(...) SOauto_map(...)
... |
all arguments passed to new function |
Function for creating round Southern Ocean maps with inbuild base layers.
SOmap2( bathy_legend = TRUE, land = TRUE, ice = TRUE, ccamlr = FALSE, ccamlr_labels = FALSE, ssru = FALSE, ssru_labels = FALSE, ssmu = FALSE, ssmu_labels = FALSE, rb = FALSE, rb_labels = FALSE, sprfmorb = FALSE, border = TRUE, trim = -45, graticules = FALSE, eez = FALSE, eez_labels = FALSE, mpa = FALSE, mpa_labels = FALSE, domains = FALSE, domains_labels = FALSE, iwc = FALSE, iwc_labels = FALSE, straight = FALSE, fronts = FALSE, fronts_col = c("hotpink", "orchid", "plum"), land_col = "black", ice_col = "black", rb_col = 3, sprfmo_col = "grey50", ccamlr_col = 2, ssru_col = "grey50", ssmu_col = "grey70", eez_col = "maroon", mpa_col = "yellow", border_col = c("white", "black"), graticules_col = "grey70", iwc_col = "blue", domains_col = "magenta" )
SOmap2( bathy_legend = TRUE, land = TRUE, ice = TRUE, ccamlr = FALSE, ccamlr_labels = FALSE, ssru = FALSE, ssru_labels = FALSE, ssmu = FALSE, ssmu_labels = FALSE, rb = FALSE, rb_labels = FALSE, sprfmorb = FALSE, border = TRUE, trim = -45, graticules = FALSE, eez = FALSE, eez_labels = FALSE, mpa = FALSE, mpa_labels = FALSE, domains = FALSE, domains_labels = FALSE, iwc = FALSE, iwc_labels = FALSE, straight = FALSE, fronts = FALSE, fronts_col = c("hotpink", "orchid", "plum"), land_col = "black", ice_col = "black", rb_col = 3, sprfmo_col = "grey50", ccamlr_col = 2, ssru_col = "grey50", ssmu_col = "grey70", eez_col = "maroon", mpa_col = "yellow", border_col = c("white", "black"), graticules_col = "grey70", iwc_col = "blue", domains_col = "magenta" )
bathy_legend |
logical: if |
land |
logical: if |
ice |
logical: if |
ccamlr |
logical: if |
ccamlr_labels |
logical: if |
ssru |
logical: if |
ssru_labels |
logical: if |
ssmu |
logical: if |
ssmu_labels |
logical: if |
rb |
logical: if |
rb_labels |
logical: if |
sprfmorb |
logical: if |
border |
logical: if |
trim |
numeric: latitude to trim the map to. Set this to -10 for effectively no trim. |
graticules |
logical: if |
eez |
logical: if |
eez_labels |
logical: if |
mpa |
logical: if |
mpa_labels |
logical: if |
domains |
logical: if |
domains_labels |
logical: if |
iwc |
logical: if |
iwc_labels |
logical: if |
straight |
logical: if |
fronts |
logical or string: if |
fronts_col |
character: colours to use for fronts. |
land_col |
character: colour to use for coastline. |
ice_col |
character: colour to use for ice features. |
rb_col |
character: colour for CCAMLR research blocks. |
sprfmo_col |
character: colour for SPRFMO toothfish research blocks |
ccamlr_col |
character: colour for CCAMLR boundaries |
ssru_col |
character: colour for CCAMLR small scale research units. |
ssmu_col |
character: colour for CCAMLR small scale management units. |
eez_col |
character: colour for Exclusive Economic Zone boundaries. |
mpa_col |
character: colour for CCAMLR Marine Protected Areas. |
border_col |
character: colours for longitude border. |
graticules_col |
character: colour for graticule grid. |
iwc_col |
character: colour for IWC boundaries. |
domains_col |
character: colour for the CCAMLR planning domains boundaries. |
An object of class "SOmap", which represents a polar-stereographic map of the southern hemisphere, with the chosen management layers added. Printing or plotting this object will cause it to be displayed in the current graphics device.
## Not run: SOmap2(ccamlr = TRUE, mpa = TRUE, trim = -45) ## End(Not run)
## Not run: SOmap2(ccamlr = TRUE, mpa = TRUE, trim = -45) ## End(Not run)
The inputs must contain exactly one object of class SOmap
.
SOmerge(..., reproject = TRUE)
SOmerge(..., reproject = TRUE)
... |
: one or more objects of class |
reproject |
logical: if |
Note that objects of class SOmap_auto
are not yet supported.
A single object of class SOmap
.
## Not run: mymap <- SOmap(bathy_legend = "space") mylegend <- SOleg(x = runif(100), position = "topright", col = hcl.colors(80, "Viridis"), breaks = c(0.1, 0.2, 0.5, 0.9), trim = -45, label = "Thing", rnd = 1, type = "continuous") mymgmt <- SOmanagement(eez = TRUE, basemap = mymap) merged <- SOmerge(mymap, mymgmt, mylegend) plot(merged) ## note that you need to take some care in constructing the component objects ## to ensure their visual consistency ## e.g. this will work, but the EEZ layers will extend beyond the map bounds mymap <- SOmap(trim = -55) mymgmt <- SOmanagement(eez = TRUE, trim = -45) ## note different trim plot(SOmerge(mymap, mymgmt)) ## better to do mymap <- SOmap(trim = -55) mymgmt <- SOmanagement(eez = TRUE, basemap = mymap) plot(SOmerge(mymap, mymgmt)) ## SOmerge will reproject objects on the fly if needed sw_atlantic <- SOmap_auto(c(-70, -20), c(-65, -45), input_points = FALSE, input_lines = FALSE) mymap_auto$projection ## the EEZs within this region sw_atlantic_mgmt <- SOmanagement(eez = TRUE, basemap = sw_atlantic) mymap <- SOmap() mymap$projection ## sw_atlantic_mgmt lies within the bounds of mymap, so we might want to combine them ## even though their projections are different merged <- SOmerge(mymap, sw_atlantic_mgmt) plot(merged) ## End(Not run)
## Not run: mymap <- SOmap(bathy_legend = "space") mylegend <- SOleg(x = runif(100), position = "topright", col = hcl.colors(80, "Viridis"), breaks = c(0.1, 0.2, 0.5, 0.9), trim = -45, label = "Thing", rnd = 1, type = "continuous") mymgmt <- SOmanagement(eez = TRUE, basemap = mymap) merged <- SOmerge(mymap, mymgmt, mylegend) plot(merged) ## note that you need to take some care in constructing the component objects ## to ensure their visual consistency ## e.g. this will work, but the EEZ layers will extend beyond the map bounds mymap <- SOmap(trim = -55) mymgmt <- SOmanagement(eez = TRUE, trim = -45) ## note different trim plot(SOmerge(mymap, mymgmt)) ## better to do mymap <- SOmap(trim = -55) mymgmt <- SOmanagement(eez = TRUE, basemap = mymap) plot(SOmerge(mymap, mymgmt)) ## SOmerge will reproject objects on the fly if needed sw_atlantic <- SOmap_auto(c(-70, -20), c(-65, -45), input_points = FALSE, input_lines = FALSE) mymap_auto$projection ## the EEZs within this region sw_atlantic_mgmt <- SOmanagement(eez = TRUE, basemap = sw_atlantic) mymap <- SOmap() mymap$projection ## sw_atlantic_mgmt lies within the bounds of mymap, so we might want to combine them ## even though their projections are different merged <- SOmerge(mymap, sw_atlantic_mgmt) plot(merged) ## End(Not run)
Reproject and add an object to an existing SOmap
or SOmap_auto
.
SOplot(x, y = NULL, target = NULL, ..., source = NULL, add = TRUE)
SOplot(x, y = NULL, target = NULL, ..., source = NULL, add = TRUE)
x |
: longitude vector, or an object with coordinates |
y |
: latitude vector, or missing if x is an object |
target |
: target projection. If not provided, it will default to the projection of the current map, and if that is not set it will use the default SOmap polar stereographic projection |
... |
: other parameters passed to the |
source |
: if |
add |
logical: if |
## Not run: x <-c (-70, -60,-50, -90) y <-c (-50, -75, -45, -60) map <- SOmap_auto(x, y, input_lines = FALSE) ## plot the map, with the x, y points already added map ## re-plot the points in a different colour and marker SOplot(x = x, y = y, pch = 0, cex = 2, col = 6) ## End(Not run)
## Not run: x <-c (-70, -60,-50, -90) y <-c (-50, -75, -45, -60) map <- SOmap_auto(x, y, input_lines = FALSE) ## plot the map, with the x, y points already added map ## re-plot the points in a different colour and marker SOplot(x = x, y = y, pch = 0, cex = 2, col = 6) ## End(Not run)
Function for reprojecting data.
SOproj(x, y = NULL, target = NULL, data, ..., source = NULL)
SOproj(x, y = NULL, target = NULL, data, ..., source = NULL)
x |
longitude vector, or object with coordinates |
y |
latitude vector |
target |
target projection (default = stereo) |
data |
optional data to be included |
... |
arguments passed to |
source |
starting projection (default = longlat) |
Reprojects the given data object to polar projection. Works with Points, spatial, raster, SOmap, sf and sfc objects.
## Not run: lat <- c(-70, -60,-50, -90) lon <- c(-50, -75, -45, -60) pnts <- SOproj(x = lon, y = lat) SOmap2(CCAMLR = TRUE) plot(pnts, pch = 19, col = 3, add = TRUE) ## End(Not run)
## Not run: lat <- c(-70, -60,-50, -90) lon <- c(-50, -75, -45, -60) pnts <- SOproj(x = lon, y = lat) SOmap2(CCAMLR = TRUE) plot(pnts, pch = 19, col = 3, add = TRUE) ## End(Not run)