SOmap
The goal of this package is to make publication quality round Southern Ocean maps in polar projections with little effort.
https://github.com/AustralianAntarcticDivision/SOmap
Category: Cryosphere
Sub Category: Sea Ice
Last synced: about 11 hours ago
JSON representation
Repository metadata
Southern Ocean round maps
- Host: GitHub
- URL: https://github.com/AustralianAntarcticDivision/SOmap
- Owner: AustralianAntarcticDivision
- Fork: true (Maschette/SOmap)
- Created: 2018-10-28T23:06:11.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-02-24T05:23:54.000Z (2 months ago)
- Last Synced: 2025-03-22T19:02:37.576Z (about 1 month ago)
- Language: R
- Homepage: https://australianantarcticdivision.github.io/SOmap/
- Size: 346 MB
- Stars: 26
- Watchers: 7
- Forks: 7
- Open Issues: 16
- Releases: 0
-
Metadata Files:
- Readme: README.Rmd
- Code of conduct: CODE_OF_CONDUCT.md
README.Rmd
--- output: github_document editor_options: chunk_output_type: console --- [](https://github.com/AustralianAntarcticDivision/SOmap/actions/workflows/R-CMD-check.yaml) ```{r setup, include = FALSE} knitr::opts_chunk$set(collapse = TRUE, comment = "#>", warning = FALSE, fig.path = "man/figures/README-", fig.height = 8, fig.width = 8, dpi = 300, out.width = "100%") ``` # SOmapThe goal of SOmap is to make publication quality round Southern Ocean maps in polar projections with little effort. This package is still very much a work in progress contact me with any questions or suggestions. ## Installation The development version from [GitHub](https://github.com/AustralianAntarcticDivision/SOmap) with: ```{r eval = FALSE} install.packages("SOmap", repos = c(SCAR = "https://scar.r-universe.dev", CRAN = "https://cloud.r-project.org")) ## or ## install.packages("remotes") ## if needed remotes::install_github("AustralianAntarcticDivision/SOmap") ``` ## Example To make a simple map you can use the following function; use `? SOmap` to see all the options for modifying layers. ```{r examplemap, message = FALSE, warning = FALSE} library(SOmap) SOmap() ``` There is also `SOmanagement()` which provides management layers for the Southern Ocean and `SOleg()` which gives custom rounded legends for added map layers. ```{r management} ## custom colours spiritedMedium <- colorRampPalette(c("#4D4140", "#596F7E", "#168B98", "#ED5B67", "#E27766", "#DAAD50", "#EAC3A6")) spirited <- spiritedMedium(80) SOmap(trim = -40) ## add an example sea ice raster, which is bundled with SOmap plot(ice, col = spirited, add = TRUE, legend = FALSE, alpha = 0.95) SOleg(ice, position = "topright", col = spirited, ticks = 6, tlabs = c("0", "20", "40", "60", "80", "100"), trim = -40, label = "Sea Ice", type = "continuous") ## add the exclusive economic zones management layer SOmanagement(eez = TRUE) ``` Curved legends can be either continuous (as above) or discrete. ```{r, echo=FALSE} centroids<-data.frame(pop = structure(1:8, .Label = c("1", "2", "3","4", "5", "6", "7", "8"), class = "factor"), lon = c(7.36921794861538, 76.0083253690476, 88.1945661849315, 134.966444407778, -178.009759,-164.882487618519, -80.8082988510345, -30.1700251934884), lat = c(-63.6191794892308,-53.1358253619048, -65.0577956330822, -65.0150925555556, -72.891637562451, -63.3747530640741, -68.9245057482759, -60.3177015502326)) coordinates(centroids)<-c("lon", "lat") projection(centroids)<- "+proj=longlat +datum=WGS84" centroids<-spTransform(centroids,CRS(projection(SOmap::Bathy))) ``` ```{r SOleg} spirited8 <- spiritedMedium(8) SOmap() plot(centroids, col=spirited8, add=TRUE, pch=19) SOleg(centroids,position = "topright", col = spirited8, ticks = 8, tlabs =1:8, label = "Centroids", type = "discrete") ``` An **automatic** plot function `SOmap_auto()` will take any data in the form of longitude and latitude vectors and create a guess at a map. ```{r automap, fig.height = 5, fig.width = 5} ellie <- SOmap_data$mirounga_leonina ## construct and plot the map SOmap_auto(ellie$lon, ellie$lat) ``` The `SOmap_auto()`, `SOmap()`, and `SOmap2()` functions return the data used to make the map so that further customization can be made. Plotting or printing the returned object will cause the map to be displayed in the graphics device. ```{r automap2, fig.height = 5, fig.width = 5} data("albatross", package = "adehabitatLT") ## convert the albatross data to a single matrix of lon, lat points albatrack <- do.call(rbind, lapply(albatross, function(z) terra::project(rbind(as.matrix(z[, c("x", "y")]), NA), from = "+proj=utm +zone=42 +south +datum=WGS84", to = "EPSG:4326"))) ## construct the map and return it, but don't plot it alb_map <- SOmap_auto(albatrack[, 1], albatrack[, 2]) ``` Modifying this map object is currently a rather experimental process (proceed at your own risk!) but, for example, if we wished to change the points to be blue rather than red: ```{r automap3, fig.height = 5, fig.width = 5} alb_map$pcol <- "blue" ## plot it alb_map ``` We could also decide we want a reversed bathymetry color and cyan lines between the dots. ```{r automap4, fig.height = 5, fig.width = 5} # change the line color alb_map$lcol <- "cyan" # reverse the bathymetry alb_map$bathy_palette<-rev(alb_map$bathy_palette) ## plot it alb_map ``` Objects from `sf`, `sp`, or `raster` can also be used, but note that they will be used for their extents only and will not automatically be plotted. But we can plot them easily with `SOplot`: ```{r automap-spatial, fig.height = 5, fig.width = 5} ## use the bundled fronts data as an example mydata <- SOmap_data$fronts_orsi SOmap_auto(mydata, target = "laea", centre_lon = 147) SOplot(mydata, col = 2) ``` ## Easy projections `SOmap` goes with the philosophy "we actually rather like ourselves, and care about our experience" and so there are some easy ways to work with projections, and
just map it!. ```{r auto-setup} set.seed(1) amap <- SOmap_auto(input_points = FALSE, input_lines = FALSE) amap ``` To add data to this plot we can just do so. ```{r just-map-it} amap SOplot(SOmap_data$seaice_oct, lwd = 3, col = "blue", lty = 2) ``` `SOplot()` will add data by default, and can take spatial objects or even raw longitude and latitude values (we like you). When a plot is set up the *coordinate reference system* used is recorded so that we can use it again. The projection *currently in use* is always available by running `SOcrs()`. ```{r} SOcrs() ``` Many objects can be reprojected with `SOproj()`, including the map objects themselves. ```{r raster} prj <- "+proj=laea +lat_0=-90 +lon_0=147 +datum=WGS84" ## reproject a raster SOproj(ice, target = prj) ## reproject a SOmap SOproj(amap, target = prj) ``` Note that we must assume raw input is "longitude/latitude", and the function will issue a warning. --- Please note that the SOmap project is released with a [Contributor Code of Conduct](https://australianantarcticdivision.github.io/SOmap/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
Owner metadata
- Name: Australian Antarctic Division
- Login: AustralianAntarcticDivision
- Email:
- Kind: organization
- Description:
- Website:
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/8952518?v=4
- Repositories: 55
- Last ynced at: 2024-04-08T07:45:52.605Z
- Profile URL: https://github.com/AustralianAntarcticDivision
GitHub Events
Total
- Issues event: 6
- Watch event: 2
- Issue comment event: 9
- Push event: 7
- Pull request event: 2
- Fork event: 1
- Create event: 1
Last Year
- Issues event: 6
- Watch event: 2
- Issue comment event: 9
- Push event: 7
- Pull request event: 2
- Fork event: 1
- Create event: 1
Committers metadata
Last synced: 7 days ago
Total Commits: 602
Total Committers: 3
Avg Commits per committer: 200.667
Development Distribution Score (DDS): 0.513
Commits in past year: 19
Committers in past year: 2
Avg Commits per committer in past year: 9.5
Development Distribution Score (DDS) in past year: 0.263
Name | Commits | |
---|---|---|
Ben Raymond | b****d@a****u | 293 |
Michael Sumner | m****r@g****m | 168 |
Dale Maschette | d****e@a****u | 141 |
Committer domains:
- aad.gov.au: 2
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 94
Total pull requests: 16
Average time to close issues: 5 months
Average time to close pull requests: 24 days
Total issue authors: 14
Total pull request authors: 4
Average comments per issue: 4.18
Average comments per pull request: 1.25
Merged pull request: 12
Bot issues: 0
Bot pull requests: 0
Past year issues: 5
Past year pull requests: 2
Past year average time to close issues: 3 months
Past year average time to close pull requests: about 2 hours
Past year issue authors: 4
Past year pull request authors: 1
Past year average comments per issue: 2.6
Past year average comments per pull request: 0.5
Past year merged pull request: 2
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- Maschette (49)
- raymondben (22)
- mdsumner (11)
- jspmccain (2)
- janjansen86 (1)
- ryanreisinger (1)
- lidefi87 (1)
- DorienA (1)
- KimBaldry (1)
- grwhumphries (1)
- caseyschine (1)
- jessm93 (1)
- Julie-M (1)
- NeMaVo (1)
Top Pull Request Authors
- mdsumner (11)
- Maschette (3)
- raymondben (1)
- KimBaldry (1)
Top Issue Labels
- enhancement (20)
- bug (5)
- help wanted (2)
Top Pull Request Labels
Dependencies
- actions/checkout v2 composite
- r-lib/actions/check-r-package v1 composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v1 composite
- r-lib/actions/setup-r-dependencies v1 composite
- actions/checkout v2 composite
- r-lib/actions/setup-r v1 composite
- r-lib/actions/setup-r-dependencies v1 composite
- R >= 3.6.0 depends
- raster * depends
- sp * depends
- assertthat * imports
- dplyr * imports
- ggplot2 * imports
- glue * imports
- graticule * imports
- methods * imports
- proj4 * imports
- reproj >= 0.4.0 imports
- rgdal * imports
- rlang * imports
- sf >= 0.7 imports
- spbabel * imports
- spex >= 0.6.0 imports
- stars * imports
- tabularaster * imports
- terra * imports
- tibble * imports
- uuid * imports
- vapour >= 0.8.5 imports
- adehabitatLT * suggests
- covr * suggests
- ggnewscale * suggests
- knitr * suggests
- maps * suggests
- maptools * suggests
- palr * suggests
- rgeos * suggests
- rmarkdown * suggests
- testthat >= 2.1.0 suggests
- vdiffr * suggests
Score: 4.836281906951478