Repository 'obis_data'
hg clone https://toolshed.g2.bx.psu.edu/repos/ecology/obis_data

Changeset 0:1fcd81d65467 (2024-01-18)
Next changeset 1:5bae75c49f2e (2024-11-05)
Commit message:
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit b377ff767e3051f301c2f02cfe3e1a17b285ede4
added:
analyze.r
data.r
macro.xml
obisindicators.r
robis.r
robis.xml
test-data/Index.csv
test-data/occ_at.tabular
visualize.r
b
diff -r 000000000000 -r 1fcd81d65467 analyze.r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/analyze.r Thu Jan 18 09:33:52 2024 +0000
b
@@ -0,0 +1,72 @@
+#' Calculate Biodiversity Indicators, including ES50 (Hurlbert index)
+#'
+#' Calculate the expected number of marine species in a random sample of 50
+#' individuals (records)
+#'
+#' @param df data frame with unique species observations containing columns:
+#'   `cell`, `species`, `records`
+#' @param esn expected number of marine species
+#'
+#' @return Data frame with the following extra columns: - `n`: number of records
+#'   - `sp`: species richness - `shannon`: Shannon index - `simpson`: Simpson
+#'   index - `es`: Hurlbert index (n = 50), i.e. expected species from 50
+#'   samples ES(50) - `hill_1`: Hill number `exp(shannon)` - `hill_2`: Hill
+#'   number `1/simpson` - `hill_inf`: Hill number `1/maxp`
+#'
+#' @details The expected number of marine species in a random sample of 50
+#'  individuals (records) is an indicator on marine biodiversity richness. The
+#'  ES50 is defined in OBIS as the `sum(esi)` over all species of the following
+#'  per species calculation:
+#'
+#'  - when `n - ni >= 50 (with n as the total number of records in the cell and
+#'  ni the total number of records for the ith-species)
+#'    - `esi = 1 - exp(lngamma(n-ni+1) + lngamma(n-50+1) - lngamma(n-ni-50+1) - lngamma(n+1))`
+#'
+#'  - when `n >= 50` - `esi = 1`
+#'
+#'  - else - `esi = NULL`
+#'
+#'  Warning: ES50 assumes that individuals are randomly distributed, the sample
+#'  size is sufficiently large, the samples are taxonomically similar, and that
+#'  all of the samples have been taken in the same manner.
+#'
+#' @export
+#' @concept analyze
+#' @examples
+#' @importFrom gsl lngamma
+calc_indicators <- function(df, esn = 50) {
+
+  stopifnot(is.data.frame(df))
+  stopifnot(is.numeric(esn))
+  stopifnot(all(c("cell", "species", "records") %in% names(df)))
+
+  df %>%
+    dplyr::group_by(cell, species) %>%
+    dplyr::summarize(
+      ni = sum(records),
+      .groups = "drop_last") %>%
+    dplyr::mutate(n = sum(ni)) %>%
+    dplyr::group_by(cell, species) %>%
+    dplyr::mutate(
+      hi = -(ni / n * log(ni / n)),
+      si = (ni / n)^2,
+      qi = ni / n,
+      esi = dplyr::case_when(
+        n - ni >= esn ~ 1 - exp(gsl::lngamma(n - ni + 1) + gsl::lngamma(n - esn + 1) - gsl::lngamma(n - ni - esn + 1) - gsl::lngamma(n + 1)),
+        n >= esn ~ 1
+      )
+    ) %>%
+    dplyr::group_by(cell) %>%
+    dplyr::summarize(
+      n = sum(ni),
+      sp = dplyr::n(),
+      shannon = sum(hi),
+      simpson = sum(si),
+      maxp = max(qi),
+      es = sum(esi),
+      .groups = "drop") %>%
+    dplyr::mutate(
+      hill_1   = exp(shannon),
+      hill_2   = 1 / simpson,
+      hill_inf = 1 / maxp)
+}
b
diff -r 000000000000 -r 1fcd81d65467 data.r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data.r Thu Jan 18 09:33:52 2024 +0000
b
@@ -0,0 +1,125 @@
+#' OBIS occurrences, global sample of 1 million records
+#'
+#' Simple dataset of species and location for example purposes from 2022-04-04.
+#'
+#' @format A data frame with 1,000,000 rows and 4 variables:
+#' - `decimalLongitude`: unique x
+#' - `decimalLatitude`: unique y
+#' - `species`: unique species
+#' - `records`: number of records based on unique values of x, y, species
+#'
+#' @source \url{https://obis.org/data/access}
+#' @concept data
+"occ_1M"
+
+#' OBIS occurrences, South Atlantic full regional sample
+#'
+#' Simple dataset of species and location for example purposes from 2022-04-04.
+#'
+#' @format A data frame with 1,014,006 rows and 4 variables:
+#' - `decimalLongitude`: unique x
+#' - `decimalLatitude`: unique y
+#' - `species`: unique species
+#' - `records`: number of records based on unique values of x, y, species
+#'
+#' @source \url{https://obis.org/data/access}
+#' @concept data
+"occ_SAtlantic"
+
+#' OBIS occurrences, Florida Keys full regional sample
+#'
+#' Simple dataset of species and location for example purposes from 2022-04-04.
+#'
+#' @format A data frame with 1,014,006 rows and 4 variables:
+#' - `decimalLongitude`: unique x
+#' - `decimalLatitude`: unique y
+#' - `species`: unique species
+#' - `records`: number of records based on unique values of x, y, species
+#'
+#' @source \url{https://obis.org/data/access}
+#' @concept data
+"occ_fk"
+
+#' OBIS occurrences, temporal sample for the 1960s, limited to 1M records
+#'
+#' Simple dataset of species and location for example purposes from 2022-04-04.
+#'
+#' @format A data frame with 1,014,006 rows and 4 variables:
+#' - `decimalLongitude`: unique x
+#' - `decimalLatitude`: unique y
+#' - `species`: unique species
+#' - `records`: number of records based on unique values of x, y, species
+#'
+#' @source \url{https://obis.org/data/access}
+#' @concept data
+"occ_1960s"
+
+#' OBIS occurrences, temporal sample for the 1970s, limited to 1M records
+#'
+#' Simple dataset of species and location for example purposes from 2022-04-04.
+#'
+#' @format A data frame with 1,014,006 rows and 4 variables:
+#' - `decimalLongitude`: unique x
+#' - `decimalLatitude`: unique y
+#' - `species`: unique species
+#' - `records`: number of records based on unique values of x, y, species
+#'
+#' @source \url{https://obis.org/data/access}
+#' @concept data
+"occ_1970s"
+
+#' OBIS occurrences, temporal sample for the 1980s, limited to 1M records
+#'
+#' Simple dataset of species and location for example purposes from 2022-04-04.
+#'
+#' @format A data frame with 1,014,006 rows and 4 variables:
+#' - `decimalLongitude`: unique x
+#' - `decimalLatitude`: unique y
+#' - `species`: unique species
+#' - `records`: number of records based on unique values of x, y, species
+#'
+#' @source \url{https://obis.org/data/access}
+#' @concept data
+"occ_1980s"
+
+#' OBIS occurrences, temporal sample for the 1990s, limited to 1M records
+#'
+#' Simple dataset of species and location for example purposes from 2022-04-04.
+#'
+#' @format A data frame with 1,014,006 rows and 4 variables:
+#' - `decimalLongitude`: unique x
+#' - `decimalLatitude`: unique y
+#' - `species`: unique species
+#' - `records`: number of records based on unique values of x, y, species
+#'
+#' @source \url{https://obis.org/data/access}
+#' @concept data
+"occ_1990s"
+
+#' OBIS occurrences, temporal sample for the 2000s, limited to 1M records
+#'
+#' Simple dataset of species and location for example purposes from 2022-04-04.
+#'
+#' @format A data frame with 1,014,006 rows and 4 variables:
+#' - `decimalLongitude`: unique x
+#' - `decimalLatitude`: unique y
+#' - `species`: unique species
+#' - `records`: number of records based on unique values of x, y, species
+#'
+#' @source \url{https://obis.org/data/access}
+#' @concept data
+"occ_2000s"
+
+#' OBIS occurrences, temporal sample for the 2010s, limited to 1M records
+#'
+#' Simple dataset of species and location for example purposes from 2022-04-04.
+#'
+#' @format A data frame with 1,014,006 rows and 4 variables:
+#' - `decimalLongitude`: unique x
+#' - `decimalLatitude`: unique y
+#' - `species`: unique species
+#' - `records`: number of records based on unique values of x, y, species
+#'
+#' @source \url{https://obis.org/data/access}
+#' @concept data
+"occ_2010s"
b
diff -r 000000000000 -r 1fcd81d65467 macro.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/macro.xml Thu Jan 18 09:33:52 2024 +0000
b
@@ -0,0 +1,39 @@
+<macros>
+    <token name="@VERSION@">0.0.2</token>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="4.2.2">r-base</requirement>
+            <requirement type="package" version="3.4.0">r-ggplot2</requirement>
+            <yield />
+        </requirements>
+    </xml>
+    <xml name="obis_input">
+       <param name="input" type="data" format="tabular,csv,txt" label="Input table"/>
+       <param name="colnames" type="boolean" label="First line is a header line" checked="true"/>
+    </xml>
+    <xml name="obis_bibref">
+       <citations>
+            <citation type="bibtex">
+            @Manual{,
+            title = {obisindicators: Develop marine biodiversity indicators from OBIS data},
+            author = {Ben Ben and Pieter Provoost and Tylar Murray},
+            year = {2022},
+            note = {https://marinebon.org/obisindicators,
+            https://github.com/marinebon/obisindicators},
+            }
+            </citation>
+        </citations>
+    </xml>
+    <xml name="obis_doiref">
+        <citations>
+            <citation type="doi">DOI:10.5281/zenodo.6969395</citation>
+        </citations>
+    </xml>
+    <xml name="topic">
+        <edam_topics>
+           <edam_topic>topic_0610</edam_topic>
+           <edam_topic>topic_3050</edam_topic>
+        </edam_topics>
+    </xml>
+</macros>
+
b
diff -r 000000000000 -r 1fcd81d65467 obisindicators.r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/obisindicators.r Thu Jan 18 09:33:52 2024 +0000
[
@@ -0,0 +1,115 @@
+#Rscript
+
+###########################################
+##    Mapping alpha and beta diversity   ##
+###########################################
+
+#####Packages : obisindicators
+#               dplyr
+#               sf
+#               ggplot2
+#               rnaturalearth
+#               rnaturalearthdata
+#               viridis
+#               dggridr
+library(magrittr)
+
+## remotes::install_github("r-barnes/dggridR")
+#####Load arguments
+
+args <- commandArgs(trailingOnly = TRUE)
+
+# url for the S2 subset
+
+if (length(args) < 4) {
+    stop("This tool needs at least 4 argument : longitude, latitude, species and number of records")
+}else {
+    raster <- args[1]
+    hr <- args[2]
+    sep <- as.character(args[3])
+    longitude <- as.numeric(args[4])
+    latitude <- as.numeric(args[5])
+    spe <- as.numeric(args[6])
+    rec <- as.numeric(args[7])
+    crs <- as.numeric(args[8])
+    reso <- as.numeric(args[9])
+    source(args[10])
+    source(args[11])
+    source(args[12])
+}
+
+if (hr == "false") {
+  hr <- FALSE
+}else {
+  hr <- TRUE
+}
+
+if (sep == "t") {
+   sep <- "\t"
+}
+
+if (crs == "0") {
+   crs <- "+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
+}
+#####Import data
+occ <- read.table(raster, sep = sep, dec = ".", header = hr, fill = TRUE, encoding = "UTF-8") # occ_1M OR occ_SAtlantic
+occ <- na.omit(occ)
+#Get biological occurrences
+#Use the 1 million records subsampled from the full OBIS dataset
+colnames(occ)[longitude] <- c("decimalLongitude")
+colnames(occ)[latitude] <- c("decimalLatitude")
+colnames(occ)[spe] <- c("species")
+colnames(occ)[rec] <- c("records")
+
+#Create a discrete global grid
+#Create an ISEA discrete global grid of resolution 9 using the dggridR package:
+
+dggs <- dggridR::dgconstruct(projection = "ISEA", topology = "HEXAGON", res = reso)
+
+#Then assign cell numbers to the occurrence data
+occ$cell <- dggridR::dgGEO_to_SEQNUM(dggs, occ$decimalLongitude, occ$decimalLatitude)[["seqnum"]]
+
+#Calculate indicators
+#The following function calculates the number of records, species richness, Simpson index, Shannon index, Hurlbert index (n = 50), and Hill numbers for each cell.
+
+#Perform the calculation on species level data
+idx <- calc_indicators(occ)
+write.table(idx, file = "Index.csv", sep = ",", dec = ".", na = " ", col.names = TRUE, row.names = FALSE, quote = FALSE)
+
+#add cell geometries to the indicators table (idx)
+grid_idx <- sf::st_wrap_dateline(dggridR::dgcellstogrid(dggs, idx$cell))
+colnames(grid_idx) <- c("cell", "geometry")
+
+grid <- dplyr::left_join(grid_idx,
+    idx,
+    by = "cell")
+
+#Plot maps of indicators
+#Let’s look at the resulting indicators in map form.
+#Indice ES(50)
+es_50_map <- gmap_indicator(grid, "es", label = "ES(50)", crs = crs)
+es_50 <- ggplot2::ggsave("ES_50.png", es_50_map, scale = 0.38, width = 12, height = 7, units = "in", dpi = 300, limitsize = TRUE)
+
+# Shannon index
+shannon_map <- gmap_indicator(grid, "shannon", label = "Shannon index", crs = crs)
+shannon <- ggplot2::ggsave("Shannon_index.png", shannon_map, scale = 0.38, width = 12, height = 7, units = "in", dpi = 300, limitsize = TRUE)
+
+
+# Number of records, log10 scale, Geographic projection
+records_map <- gmap_indicator(grid, "n", label = "# of records", trans = "log10", crs = crs)
+records <- ggplot2::ggsave("Records.png", records_map, scale = 0.38, width = 12, height = 7, units = "in", dpi = 300, limitsize = TRUE)
+
+# Simpson index
+simpson_map <- gmap_indicator(grid, "simpson", label = "Simpson index", crs = crs)
+simpson <- ggplot2::ggsave("Simpson_index.png", simpson_map, scale = 0.38, width = 12, height = 7, units = "in", dpi = 300, limitsize = TRUE)
+
+# maxp
+maxp_map <- gmap_indicator(grid, "maxp", label = "maxp index", crs = crs)
+maxp <- ggplot2::ggsave("Maxp.png", maxp_map, scale = 0.38, width = 12, height = 7, units = "in", dpi = 300, limitsize = TRUE)
+
+#Mapping
+es_50
+shannon
+simpson
+maxp
+records
b
diff -r 000000000000 -r 1fcd81d65467 robis.r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/robis.r Thu Jan 18 09:33:52 2024 +0000
[
@@ -0,0 +1,57 @@
+#Rscript
+
+###########################################
+##     Retrieve Obis occurences data     ##
+###########################################
+
+##### Packages : robis
+# https://iobis.github.io/robis/articles/getting-started.html
+# Get args
+args <- commandArgs(trailingOnly = TRUE)
+
+if (length(args) < 1) {
+    stop("This tool needs at least 1 argument : longitude, latitude, species or taxonID")
+}else {
+    sname <- args[1]
+    taxid <- args[2]
+    lat_min <- args[3]
+    lat_max <- args[4]
+    long_min <- args[5]
+    long_max <- args[6]
+}
+
+if (lat_min == "0.0" & lat_max == "0.0" & long_min == "0.0" & long_max == "0.0") {
+lat_min <- ""
+lat_max <- ""
+long_min <- ""
+long_max <- ""
+}
+
+##### Import data
+# Get biological occurrences
+if (lat_min != "" & sname != "" & taxid != "") {
+my_occs <- robis::occurrence(scientificname = sname, taxonid = taxid, geometry = paste("POLYGON ((", long_min, lat_min,  ", ", long_min, lat_max, ", ", long_max, lat_min, ", ", long_max, lat_max, ", ", long_min, lat_min, "))"))
+}else if (lat_min != "" & sname != "" & taxid == "") {
+my_occs <- robis::occurrence(scientificname = sname, geometry = paste("POLYGON ((", long_min, lat_min,  ", ", long_min, lat_max, ", ", long_max, lat_min, ", ", long_max, lat_max, ", ", long_min, lat_min, "))"))
+}else if (lat_min != "" & sname == "" & taxid != "") {
+my_occs <- robis::occurrence(taxonid = taxid, geometry = paste("POLYGON ((", long_min, lat_min,  ", ", long_min, lat_max, ", ", long_max, lat_min, ", ", long_max, lat_max, ", ", long_min, lat_min, "))"))
+}else if (lat_min != "" & sname == "" & taxid == "") {
+my_occs <- robis::occurrence(geometry = paste("POLYGON ((", long_min, lat_min,  ", ", long_min, lat_max, ", ", long_max, lat_min, ", ", long_max, lat_max, ", ", long_min, lat_min, "))"))
+}else if (lat_min == "" & sname != "" & taxid != "") {
+my_occs <- robis::occurrence(scientificname = sname, taxonid = taxid)
+}else if (lat_min == "" & sname == "" & taxid != "") {
+my_occs <- robis::occurrence(taxonid = taxid)
+}else if (lat_min == "" & sname != "" & taxid == "") {
+my_occs <- robis::occurrence(scientificname = sname)
+}
+
+
+# Dispay results
+
+# If empty
+if(length(my_occs) == 0) {
+cat("\nNo occurrences found.\nLittle tip : Check your input typo, some databases are case sensitive : Genus species.\n")
+}
+
+
+write.table(file = "output.tab", my_occs, sep = "\t", dec = ".", na = "", row.names = FALSE, col.names = TRUE, quote = FALSE)
b
diff -r 000000000000 -r 1fcd81d65467 robis.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/robis.xml Thu Jan 18 09:33:52 2024 +0000
[
@@ -0,0 +1,98 @@
+<tool id="obis_data" name="OBIS occurences" version="@VERSION@" profile="20.01">
+    <description>retrieve data</description>
+    <macros>
+        <import>macro.xml</import>
+    </macros>
+    <expand macro="topic"/>
+    <expand macro="requirements">
+        <requirement type="package" version="2.11.3">r-robis</requirement>
+    </expand>
+    <required_files>
+        <include type="literal" path="robis.r"/>
+    </required_files>
+    <command detect_errors="exit_code"><![CDATA[
+        Rscript
+            '$__tool_directory__/robis.r'
+            '$species'
+            '$taxon'
+            '$lat_min'
+            '$lat_max'
+            '$long_min'
+            '$long_max'
+            '$output'
+        ]]>
+    </command>
+    <inputs>
+        <param name="species" type="text" label="Scientific name of the species" help="Genus species format, eg : Scomber scombrus">
+            <validator type="regex">^[A-Za-z ]*$</validator>
+        </param>
+        <param name="taxon" type="text" label="Taxon ID">
+            <validator type="regex">^[0-9]*$</validator>
+        </param>
+        <param name="lat_min" type="float" min="-90" max="90" value="0" label="Input latitude min (+north/-south):" optional="true"/>
+        <param name="lat_max" type="float" min="-90" max="90" value="0" label="Input latitude max (+north/-south):" optional="true"/>
+        <param name="long_min" type="float" min="-90" max="90" value="0" label="Input longitude min (+east/-west):" optional="true"/>
+        <param name="long_max" type="float" min="-90" max="90" value="0" label="Input longitude max (+east/-west):" optional="true"/>
+    </inputs>
+    <outputs>
+        <data name="output" format="tabular" from_work_dir="output.tab" label="Species occurences"/>
+    </outputs>
+    <tests>
+        <test expect_num_outputs="1">
+            <param name="species" value="Scomber scombrus"/>
+            <output name="output">
+                <assert_contents>
+                    <has_text text="Scombridae"/>
+                    <has_n_columns n="163"/>
+                </assert_contents>
+            </output>
+        </test>
+        <test expect_num_outputs="1">
+            <param name="lat_min" value="6"/>
+            <param name="lat_max" value="12"/>
+            <param name="long_min" value="40"/>
+            <param name="long_max" value="43"/>
+            <output name="output">
+                <assert_contents>
+                    <has_text text="basisOfRecord"/>
+                    <has_n_columns n="144"/>
+                </assert_contents>
+            </output>
+        </test>
+    </tests>
+    <help><![CDATA[
+===========================
+Get species occurences data
+===========================      
+**What it does**
+
+Search and retrieve species occurences across OBIS database.
+
+|
+
+**How to use it**
+
+Enter a species scientific name, be careful that the tool is case sensitive. Eg : Scomber scombrus.
+
+Or enter the latitude longitude of the area you want to retrieve data from.
+
+
+|
+
+**Output**
+
+The tool returns a table with the species observations available in OBIS database.
+
+Output file will have at least the following attributes : BasisOfRecords, longitude, latitude, species, individualcount.
+
+|
+
+**How it works**
+
+This tool use the robis R package.
+
+
+Includes functionality for retrieving species occurrence data, and combining those data.
+    ]]></help>
+    <expand macro="obis_doiref"/>
+</tool>
b
diff -r 000000000000 -r 1fcd81d65467 test-data/Index.csv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/Index.csv Thu Jan 18 09:33:52 2024 +0000
b
b'@@ -0,0 +1,1122 @@\n+cell,n,sp,shannon,simpson,maxp,es,hill_1,hill_2,hill_inf\n+33478,13,1,0,1,1, ,1,1,1\n+33890,2,1,0,1,1, ,1,1,1\n+33972,2,1,0,1,1, ,1,1,1\n+34219,1,1,0,1,1, ,1,1,1\n+34792,3,1,0,1,1, ,1,1,1\n+34874,2,1,0,1,1, ,1,1,1\n+35118,1,1,0,1,1, ,1,1,1\n+35119,1,1,0,1,1, ,1,1,1\n+35202,1,1,0,1,1, ,1,1,1\n+35494,1,1,0,1,1, ,1,1,1\n+35931,48,5,1.31474686520139,0.299479166666667,0.375, ,3.72380824048646,3.33913043478261,2.66666666666667\n+36263,2,1,0,1,1, ,1,1,1\n+36587,1,1,0,1,1, ,1,1,1\n+36831,1,1,0,1,1, ,1,1,1\n+36910,59,2,0.0859155013346631,0.966676242459064,0.983050847457627,1.84745762711864,1.08971424501542,1.03447251114413,1.01724137931034\n+36957,2,1,0,1,1, ,1,1,1\n+36993,1,1,0,1,1, ,1,1,1\n+36995,1,1,0,1,1, ,1,1,1\n+37072,1,1,0,1,1, ,1,1,1\n+37154,12,4,1.19884931291362,0.347222222222222,0.5, ,3.31629870427693,2.88,2\n+37316,1,1,0,1,1, ,1,1,1\n+37479,1,1,0,1,1, ,1,1,1\n+37562,2,1,0,1,1, ,1,1,1\n+37643,2,1,0,1,1, ,1,1,1\n+37644,3,1,0,1,1, ,1,1,1\n+37724,3,2,0.636514168294813,0.555555555555556,0.666666666666667, ,1.88988157484231,1.8,1.5\n+37726,8,2,0.376770161256437,0.78125,0.875, ,1.45756926498109,1.28,1.14285714285714\n+37807,1,1,0,1,1, ,1,1,1\n+37970,2,1,0,1,1, ,1,1,1\n+37971,6,4,1.242453324894,0.333333333333333,0.5, ,3.46410161513775,3,2\n+38130,2,2,0.693147180559945,0.5,0.5, ,2,2,2\n+38133,1,1,0,1,1, ,1,1,1\n+38216,6,4,1.242453324894,0.333333333333333,0.5, ,3.46410161513775,3,2\n+38292,1,1,0,1,1, ,1,1,1\n+38296,2,1,0,1,1, ,1,1,1\n+38387,55,3,0.759547391474863,0.570247933884298,0.727272727272727,2.99999971254133,2.13730863743501,1.7536231884058,1.375\n+38455,1,1,0,1,1, ,1,1,1\n+38550,2,1,0,1,1, ,1,1,1\n+38687,3,1,0,1,1, ,1,1,1\n+38698,2,2,0.693147180559945,0.5,0.5, ,2,2,2\n+38712,2,1,0,1,1, ,1,1,1\n+38778,15,2,0.244930026794635,0.875555555555556,0.933333333333333, ,1.27753191707406,1.14213197969543,1.07142857142857\n+38791,25,3,1.05492016798614,0.36,0.4, ,2.87174588749259,2.77777777777778,2.5\n+38859,21,4,1.10934824334884,0.401360544217687,0.571428571428571, ,3.0323813755077,2.49152542372881,1.75\n+38940,144,12,1.85305772249567,0.209008487654321,0.347222222222222,9.04114517452477,6.37929584724775,4.78449469312413,2.88\n+38941,4,2,0.693147180559945,0.5,0.5, ,2,2,2\n+38959,4,2,0.693147180559945,0.5,0.5, ,2,2,2\n+39020,2,1,0,1,1, ,1,1,1\n+39021,12,3,0.918427784993098,0.430555555555556,0.5, ,2.5053483456112,2.32258064516129,2\n+39102,2,1,0,1,1, ,1,1,1\n+39103,175,6,1.38596936755705,0.329632653061224,0.514285714285714,5.81658352234041,3.9987002369674,3.03368003962358,1.94444444444444\n+39182,1,1,0,1,1, ,1,1,1\n+39773,35,1,0,1,1, ,1,1,1\n+40341,1,1,0,1,1, ,1,1,1\n+40421,1,1,0,1,1, ,1,1,1\n+41076,25,2,0.673011667009257,0.52,0.6, ,1.96013170420779,1.92307692307692,1.66666666666667\n+41479,15,1,0,1,1, ,1,1,1\n+41640,156,3,0.495759437706612,0.71827744904668,0.833333333333333,2.5396661404715,1.64174456847229,1.39221967963387,1.2\n+42212,202,5,1.40190728568226,0.263944711302813,0.316831683168317,4.68189347763747,4.06294177225054,3.78867223769731,3.15625\n+42288,10,1,0,1,1, ,1,1,1\n+42375,12,3,1.01140426470735,0.388888888888889,0.5, ,2.74945927399721,2.57142857142857,2\n+42535,3,1,0,1,1, ,1,1,1\n+42540,5,1,0,1,1, ,1,1,1\n+42610,10,2,0.693147180559945,0.5,0.5, ,2,2,2\n+42854,31,1,0,1,1, ,1,1,1\n+42936,43,2,0.188112927414574,0.911303407247161,0.953488372093023, ,1.20696980763374,1.0973293768546,1.04878048780488\n+43025,5,1,0,1,1, ,1,1,1\n+43027,29,1,0,1,1, ,1,1,1\n+43265,37,1,0,1,1, ,1,1,1\n+43267,5,1,0,1,1, ,1,1,1\n+43349,1,1,0,1,1, ,1,1,1\n+43500,2,1,0,1,1, ,1,1,1\n+43668,2,1,0,1,1, ,1,1,1\n+43823,2,1,0,1,1, ,1,1,1\n+43828,2,1,0,1,1, ,1,1,1\n+43997,2,1,0,1,1, ,1,1,1\n+44068,1,1,0,1,1, ,1,1,1\n+44073,2,1,0,1,1, ,1,1,1\n+44082,1,1,0,1,1, ,1,1,1\n+44488,1,1,0,1,1, ,1,1,1\n+45451,1,1,0,1,1, ,1,1,1\n+46016,2,1,0,1,1, ,1,1,1\n+46022,2,1,0,1,1, ,1,1,1\n+46033,2,2,0.693147180559945,0.5,0.5, ,2,2,2\n+46092,1,1,0,1,1, ,1,1,1\n+46102,2,1,0,1,1, ,1,1,1\n+46106,1,1,0,1,1, ,1,1,1\n+46418,2,1,0,1,1, ,1,1,1\n+46743,1,1,0,1,1, ,1,1,1\n+46766,1,1,0,1,1, ,1,1,1\n+46992,1,1,0,1,1, ,1,1,1\n+47232,286,7,1.46495716140478,0.3232187393026'..b',2,1,0,1,1, ,1,1,1\n+130870,5,3,1.05492016798614,0.36,0.4, ,2.87174588749259,2.77777777777778,2.5\n+130950,4,2,0.693147180559945,0.5,0.5, ,2,2,2\n+131033,2,1,0,1,1, ,1,1,1\n+131035,1,1,0,1,1, ,1,1,1\n+131114,2,1,0,1,1, ,1,1,1\n+131128,2,1,0,1,1, ,1,1,1\n+131200,7,3,0.796311640173813,0.551020408163265,0.714285714285714, ,2.21734745227321,1.81481481481481,1.4\n+131280,2,1,0,1,1, ,1,1,1\n+131358,4,2,0.693147180559945,0.5,0.5, ,2,2,2\n+131683,1,1,0,1,1, ,1,1,1\n+131684,13,3,1.01233083910317,0.384615384615385,0.461538461538462, ,2.752008033188,2.6,2.16666666666667\n+131768,3,2,0.636514168294813,0.555555555555556,0.666666666666667, ,1.88988157484231,1.8,1.5\n+131846,1,1,0,1,1, ,1,1,1\n+131848,4,2,0.693147180559945,0.5,0.5, ,2,2,2\n+131940,13,4,1.26585675187274,0.301775147928994,0.384615384615385, ,3.54612958817451,3.31372549019608,2.6\n+132023,5,1,0,1,1, ,1,1,1\n+132332,7,1,0,1,1, ,1,1,1\n+132506,1,1,0,1,1, ,1,1,1\n+132668,30,1,0,1,1, ,1,1,1\n+132749,9,1,0,1,1, ,1,1,1\n+132750,3,1,0,1,1, ,1,1,1\n+132830,27,1,0,1,1, ,1,1,1\n+132836,1,1,0,1,1, ,1,1,1\n+132912,3,1,0,1,1, ,1,1,1\n+132999,1,1,0,1,1, ,1,1,1\n+133074,6,1,0,1,1, ,1,1,1\n+133079,1,1,0,1,1, ,1,1,1\n+133152,1,1,0,1,1, ,1,1,1\n+133156,5,1,0,1,1, ,1,1,1\n+133160,1,1,0,1,1, ,1,1,1\n+133237,3,1,0,1,1, ,1,1,1\n+133238,1,1,0,1,1, ,1,1,1\n+133318,3,1,0,1,1, ,1,1,1\n+133320,1,1,0,1,1, ,1,1,1\n+133400,15,1,0,1,1, ,1,1,1\n+133481,12,1,0,1,1, ,1,1,1\n+133482,3,1,0,1,1, ,1,1,1\n+133487,1,1,0,1,1, ,1,1,1\n+133562,15,1,0,1,1, ,1,1,1\n+133563,8,1,0,1,1, ,1,1,1\n+133645,1,1,0,1,1, ,1,1,1\n+133725,4,1,0,1,1, ,1,1,1\n+133807,7,1,0,1,1, ,1,1,1\n+133887,9,1,0,1,1, ,1,1,1\n+133888,11,1,0,1,1, ,1,1,1\n+133968,6,1,0,1,1, ,1,1,1\n+133972,18,4,0.973648923197263,0.487654320987654,0.666666666666667, ,2.64758769910591,2.05063291139241,1.5\n+134049,1,1,0,1,1, ,1,1,1\n+134050,3,1,0,1,1, ,1,1,1\n+134052,1,1,0,1,1, ,1,1,1\n+134131,1,1,0,1,1, ,1,1,1\n+134212,3,1,0,1,1, ,1,1,1\n+134213,6,1,0,1,1, ,1,1,1\n+134374,6,1,0,1,1, ,1,1,1\n+134375,5,1,0,1,1, ,1,1,1\n+134456,3,1,0,1,1, ,1,1,1\n+134537,7,1,0,1,1, ,1,1,1\n+134618,5,1,0,1,1, ,1,1,1\n+134620,6,1,0,1,1, ,1,1,1\n+134700,18,1,0,1,1, ,1,1,1\n+134701,4,1,0,1,1, ,1,1,1\n+134774,1,1,0,1,1, ,1,1,1\n+134781,2,1,0,1,1, ,1,1,1\n+134782,6,1,0,1,1, ,1,1,1\n+134862,4,1,0,1,1, ,1,1,1\n+134864,10,1,0,1,1, ,1,1,1\n+134946,8,1,0,1,1, ,1,1,1\n+135024,4,1,0,1,1, ,1,1,1\n+135108,3,1,0,1,1, ,1,1,1\n+135109,43,1,0,1,1, ,1,1,1\n+135187,2,1,0,1,1, ,1,1,1\n+135190,12,1,0,1,1, ,1,1,1\n+135270,24,1,0,1,1, ,1,1,1\n+135271,32,1,0,1,1, ,1,1,1\n+135343,21,2,0.664528438654915,0.528344671201814,0.619047619047619, ,1.94357379093538,1.89270386266094,1.61538461538462\n+135349,3,1,0,1,1, ,1,1,1\n+135352,72,1,0,1,1,1,1,1,1\n+135433,21,1,0,1,1, ,1,1,1\n+135509,7,2,0.682908104700472,0.510204081632653,0.571428571428571, ,1.97962633005252,1.96,1.75\n+135511,6,1,0,1,1, ,1,1,1\n+135512,1,1,0,1,1, ,1,1,1\n+135514,2,1,0,1,1, ,1,1,1\n+135594,3,1,0,1,1, ,1,1,1\n+135673,2,1,0,1,1, ,1,1,1\n+135674,5,1,0,1,1, ,1,1,1\n+135676,9,1,0,1,1, ,1,1,1\n+135755,40,3,1.02965301406457,0.38,0.5, ,2.80009407285383,2.63157894736842,2\n+135756,16,4,1.21231388026715,0.328125,0.4375, ,3.3612531987896,3.04761904761905,2.28571428571429\n+135836,4,1,0,1,1, ,1,1,1\n+135837,8,4,1.25548232517875,0.3125,0.375, ,3.50953070120665,3.2,2.66666666666667\n+135838,6,1,0,1,1, ,1,1,1\n+135918,3,1,0,1,1, ,1,1,1\n+135919,6,1,0,1,1, ,1,1,1\n+136000,6,1,0,1,1, ,1,1,1\n+137787,4,1,0,1,1, ,1,1,1\n+137789,4,1,0,1,1, ,1,1,1\n+137790,12,1,0,1,1, ,1,1,1\n+137791,11,1,0,1,1, ,1,1,1\n+137793,13,1,0,1,1, ,1,1,1\n+137795,6,1,0,1,1, ,1,1,1\n+137796,3,1,0,1,1, ,1,1,1\n+137869,9,1,0,1,1, ,1,1,1\n+137871,3,1,0,1,1, ,1,1,1\n+137872,9,1,0,1,1, ,1,1,1\n+137874,9,1,0,1,1, ,1,1,1\n+137949,4,1,0,1,1, ,1,1,1\n+137953,19,1,0,1,1, ,1,1,1\n+137956,8,1,0,1,1, ,1,1,1\n+138032,8,1,0,1,1, ,1,1,1\n+138033,1,1,0,1,1, ,1,1,1\n+138035,4,1,0,1,1, ,1,1,1\n+138113,9,1,0,1,1, ,1,1,1\n+138115,15,1,0,1,1, ,1,1,1\n+138195,11,1,0,1,1, ,1,1,1\n+138196,1,1,0,1,1, ,1,1,1\n+138277,1,1,0,1,1, ,1,1,1\n+138278,1,1,0,1,1, ,1,1,1\n+138357,2,1,0,1,1, ,1,1,1\n+138439,4,1,0,1,1, ,1,1,1\n+138440,1,1,0,1,1, ,1,1,1\n'
b
diff -r 000000000000 -r 1fcd81d65467 test-data/occ_at.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/occ_at.tabular Thu Jan 18 09:33:52 2024 +0000
b
b'@@ -0,0 +1,6930 @@\n+decimalLongitude\tdecimalLatitude\tspecies\tdate_year\trecords\n+-66.1350021362305\t-50.5466651916504\tAndreella uncifera\t \t3\n+-62.7333335876465\t-43.283332824707\tAndreella uncifera\t \t1\n+-60.9383316040039\t-45.281665802002\tAndreella uncifera\t \t1\n+-60.4266662597656\t-40.281665802002\tAndreella uncifera\t \t1\n+-59.2483329772949\t-40.033332824707\tAndreella uncifera\t \t2\n+-60.9049987792969\t-41.6966667175293\tAndreella uncifera\t \t1\n+-61.9150009155273\t-42.2849998474121\tAndreella uncifera\t \t1\n+-60.5633316040039\t-50.6916656494141\tAndreella uncifera\t \t1\n+-61.935001373291\t-48.5550003051758\tAndreella uncifera\t \t1\n+-61.6033325195312\t-45.1150016784668\tAndreella uncifera\t \t1\n+-61.5133323669434\t-42.6633338928223\tAndreella uncifera\t \t1\n+-63.6083335876465\t-41.4516677856445\tAndreella uncifera\t \t1\n+-63.5683326721191\t-50.8549995422363\tAndreella uncifera\t \t1\n+-59.2449989318848\t-40.3666648864746\tAndreella uncifera\t \t1\n+-5.9980001449585\t-49\tRhizosolenia styliformis\t1992\t1\n+-56.632999420166\t-51.9669990539551\tLeitoscoloplos kerguelensis\t1963\t1\n+-24.8080005645752\t-55.8419990539551\tUmbellula magniflora\t1963\t2\n+-38.6669998168945\t-53.867000579834\tSerolella pagenstecheri\t1986\t1\n+18.5\t-12.5\tEchinolittorina punctata\t \t1\n+18.5833339691162\t-34.1333351135254\tZeus faber\t \t1\n+-57.3333015441895\t-50.5833015441895\tCyamiocardium crassilabrum\t1928\t1\n+-12.2917003631592\t-37.0750007629395\tEatoniella trochiformis\t1938\t3\n+13.0500001907349\t-30.2483005523682\tPronucula benguelana\t1957\t1\n+-34.9333000183105\t-6.81669998168945\tEleotris pisonis\t \t1\n+-41.6500015258789\t-2.86669993400574\tEleotris pisonis\t \t1\n+-43.86669921875\t-22.8999996185303\tEleotris pisonis\t \t1\n+-52.0833015441895\t-32.1666984558105\tEleotris pisonis\t \t1\n+-44.4166984558105\t-2.53329992294312\tEleotris pisonis\t \t1\n+-44\t-23.1667003631592\tEleotris pisonis\t \t1\n+-50.11669921875\t-30\tEleotris pisonis\t \t1\n+-47.9166984558105\t-25\tEleotris pisonis\t \t1\n+-44.4500007629395\t-2.5\tEleotris pisonis\t \t1\n+-38.7000007629395\t-12.6999998092651\tEleotris pisonis\t \t1\n+-44.4333000183105\t-2.70000004768372\tSciades parkeri\t \t1\n+-46.3166999816895\t-23.9832992553711\tMycteroperca acutirostris\t \t1\n+-48.5499992370605\t-25.86669921875\tMycteroperca acutirostris\t \t1\n+-52.6666984558105\t-33\tMycteroperca acutirostris\t \t1\n+-44.4500007629395\t-2.5\tSciades parkeri\t \t1\n+-48.4000015258789\t-25.5\tMycteroperca acutirostris\t \t1\n+-50.7999992370605\t-0.71670001745224\tSciades parkeri\t \t1\n+-35.7832984924316\t-9.60000038146973\tSciades parkeri\t \t1\n+-38.7000007629395\t-12.6999998092651\tSciades parkeri\t \t1\n+-44.5\t-2.56669998168945\tSciades parkeri\t \t1\n+-35.7832984924316\t-9.60000038146973\tLutjanus griseus\t \t1\n+-43.86669921875\t-22.8999996185303\tLutjanus griseus\t \t1\n+-48.5499992370605\t-25.86669921875\tLutjanus griseus\t \t1\n+-34.8166999816895\t-7.56669998168945\tSciades parkeri\t \t1\n+-37.7667007446289\t-4.43330001831055\tLutjanus griseus\t \t1\n+-52.0833015441895\t-32.1666984558105\tMycteroperca acutirostris\t \t1\n+-34.8166999816895\t-7.56669998168945\tLutjanus griseus\t \t1\n+-48.4000015258789\t-25.5\tLutjanus griseus\t \t1\n+-40.1623916625977\t-20.0403251647949\tCodium spongiosum\t1982\t1\n+-40.1623916625977\t-20.0403251647949\tCodium spongiosum\t1973\t1\n+-40.4356536865234\t-20.641393661499\tCodium spongiosum\t2000\t1\n+-40.1335868835449\t-19.967830657959\tDictyota dichotoma\t1986\t1\n+-65.3333358764648\t-55.3333320617676\tAustrocidaris spinulosa\t \t2\n+-64.8833312988281\t-54.9833335876465\tAustrocidaris spinulosa\t \t2\n+-66.7799987792969\t-55.1399993896484\tAustrocidaris spinulosa\t \t2\n+-56.61669921875\t-54.7167015075684\tAustrocidaris spinulosa\t \t2\n+-39.0099983215332\t-55.6749992370605\tAntholoba achates\t \t1\n+17.4500007629395\t-33.2832984924316\tDiastobranchus capensis\t1997\t1\n+-41.7999992370605\t-22.7667007446289\tOctopus hubbsorum\t2001\t1\n+-66.2249984741211\t-55.4383316040039\tCtenocidaris (Eurocidaris) nutrix\t \t2\n+-36.9160003662109\t-54.0830001831055\tCtenocidaris (Eurocidaris) nutrix\t \t2\n+-37.25\t-54\tCtenocidaris (Eurocidaris) nutrix\t \t2\n+-36.5\t-54.1669998168945\tCtenocidaris (Eurocidaris) nutrix\t \t1\n+-38.9165992736816\t-14.8083000183105\tAmaryl'..b'.1166648864746\tUlva lactuca\t1813\t1\n+-66.3858337402344\t-53.2702331542969\tTrophon coulmanensis\t2006\t1\n+-58.5\t-30.6669998168945\tParalichthys orbignyanus\t \t2\n+-36.4166984558105\t-54.2999992370605\tAmauropsis anderssoni\t1951\t1\n+-36.36669921875\t-54.4000015258789\tAmauropsis anderssoni\t1902\t1\n+-57.6833000183105\t-51.6666984558105\tAmauropsis anderssoni\t1902\t1\n+-36.4667015075684\t-54.2832984924316\tAmauropsis anderssoni\t1902\t1\n+-36.2999992370605\t-54.1833000183105\tAmauropsis anderssoni\t1902\t1\n+-57.5332984924316\t-54.4166984558105\tTurritella algida\t1903\t1\n+-36.4667015075684\t-54.2832984924316\tAmauropsis anderssoni\t1908\t1\n+-36.4667015075684\t-54.2167015075684\tAmauropsis anderssoni\t1908\t1\n+-66.6699981689453\t-55.1199989318848\tTurritella algida\t1994\t1\n+18.4655990600586\t-33.9105987548828\tChelon richardsonii\t2004\t3\n+-38.4669990539551\t-54.2830009460449\tEchiurus antarcticus\t1986\t1\n+-35.7330017089844\t-9.66699981689453\tPseudosquillisma oculata\t1899\t1\n+-40.9070014953613\t-53.6279983520508\tAustrodecus kelpi\t2006\t3\n+-26\t-32\tSolmissus faberi\t \t1\n+-33.7599983215332\t-3.83833003044128\tNeogonodactylus minutus\t1967\t1\n+4.68833017349243\t-18.3050003051758\tMomedossa longipedis\t \t1\n+-33.7999992370605\t-3.86666655540466\tClathrina zelinhae\t2011\t1\n+-48.5447006225586\t-27.9374008178711\tCiocalypta alba\t \t1\n+-34.8333320617676\t-9.08333301544189\tCharacella aspera\t1873\t2\n+-62.3333015441895\t-43.6666984558105\tIllex argentinus\t \t1\n+-62.2832984924316\t-50.9166984558105\tIllex argentinus\t \t1\n+-58.8333015441895\t-52.8333015441895\tIllex argentinus\t \t1\n+-60.5833015441895\t-49.0499992370605\tIllex argentinus\t \t1\n+-60.7832984924316\t-47.3166999816895\tIllex argentinus\t \t1\n+-59.9166984558105\t-49.5332984924316\tIllex argentinus\t \t1\n+-60.0499992370605\t-49.25\tIllex argentinus\t \t1\n+-60.4333000183105\t-48.7832984924316\tIllex argentinus\t \t1\n+-60.7999992370605\t-47.3499984741211\tIllex argentinus\t \t1\n+-61.1500015258789\t-49.75\tIllex argentinus\t \t1\n+-60.9333000183105\t-47.9333000183105\tIllex argentinus\t \t1\n+-58.0332984924316\t-51.0833015441895\tIllex argentinus\t \t1\n+-65.2332992553711\t-48.5\tIllex argentinus\t \t1\n+-62.0167007446289\t-50.5499992370605\tIllex argentinus\t \t1\n+-60.5833015441895\t-46.5666007995605\tIllex argentinus\t \t1\n+-45.4091987609863\t-23.7591991424561\tDerbesia tenuissima\t1984\t2\n+-46.8264007568359\t-24.2061004638672\tDerbesia tenuissima\t1985\t6\n+-45.4091987609863\t-23.7591991424561\tDerbesia tenuissima\t1983\t4\n+-45.2811012268066\t-23.5716991424561\tWilsonosiphonia howei\t1953\t4\n+-46.2667007446289\t-24.0074996948242\tDerbesia tenuissima\t1986\t2\n+-45.4091987609863\t-23.7591991424561\tDerbesia tenuissima\t1982\t2\n+-45.2008018493652\t-23.520299911499\tWilsonosiphonia howei\t1957\t6\n+-45.1110992431641\t-23.5186004638672\tWilsonosiphonia howei\t1962\t4\n+-45.4536018371582\t-23.8216991424561\tWilsonosiphonia howei\t1951\t2\n+4.6933331489563\t-18.3141670227051\tMomedossa longipedis\t \t1\n+18.4336109161377\t-34.1580543518066\tGrania cryptica\t2011\t1\n+5.61700010299683\t-1.39999997615814\tPseudosquillisma oculata\t1965\t1\n+9\t-14\tAsperarca nodulosa\t1971\t1\n+12\t-7\tCoelorinchus polli\t2000\t1\n+-52.1730003356934\t-32.2060012817383\tDinophysis caudata\t2016\t1\n+18.4407997131348\t-34.187198638916\tUlva lactuca\t1987\t7\n+14.539400100708\t-22.8430995941162\tCodium decorticatum\t1992\t2\n+14.5249996185303\t-22.6667003631592\tCodium decorticatum\t1957\t2\n+14.5249996185303\t-22.6667003631592\tUlva lactuca\t1990\t1\n+14.542200088501\t-22.8166999816895\tCodium decorticatum\t1992\t1\n+18.6833000183105\t-34.0833015441895\tUlva lactuca\t1985\t4\n+18.4500007629395\t-34.13330078125\tUlva lactuca\t \t1\n+18.4599990844727\t-34.1194000244141\tUlva lactuca\t1930\t1\n+17.9500007629395\t-33.0167007446289\tUlva lactuca\t2001\t1\n+18.8999996185303\t-34.36669921875\tPhloiocaulon squamulosum\t1983\t1\n+18.3805999755859\t-34.25\tUlva lactuca\t1954\t1\n+14.960000038147\t-26.3066997528076\tRhodymenia linearis\t1992\t1\n+18.8332996368408\t-34.38330078125\tUlva lactuca\t1990\t3\n+18.4407997131348\t-34.187198638916\tUlva lactuca\t2001\t1\n+14.9167003631592\t-25.8999996185303\tRhodymenia linearis\t1990\t1\n+18.0333003997803\t-33.13330078125\tUlva lactuca\t1985\t1\n+\n+\n+\n+\n+\n'
b
diff -r 000000000000 -r 1fcd81d65467 visualize.r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/visualize.r Thu Jan 18 09:33:52 2024 +0000
[
@@ -0,0 +1,56 @@
+#' Statically map indicators using ggplot
+#'
+#' @param grid spatial features, e.g. hexagons, to plot; requires a geometry
+#'   spatial column
+#' @param column column name with indicator; default="shannon"
+#' @param label label to show on legend
+#' @param crs coordinate reference system; see `sf::st_crs()`
+#' @param trans For continuous scales, the name of a transformation object or
+#'   the object itself. Built-in transformations include "asn", "atanh",
+#'   "boxcox", "date", "exp", "hms", "identity" (default), "log", "log10", "log1p",
+#'   "log2", "logit", "modulus", "probability", "probit", "pseudo_log",
+#'   "reciprocal", "reverse", "sqrt" and "time". See `ggplot2::continuous_scale`
+#'
+#' @return ggplot2 plot
+#' @concept visualize
+#' @export
+#' @import rnaturalearth viridis ggplot2
+#'
+#' @examples
+gmap_indicator <- function(
+    grid, column = "shannon", label = "Shannon index", trans = "identity",
+    crs = "+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs") {
+
+  world <- rnaturalearth::ne_countries(scale = "medium", returnclass = "sf")
+  bb <- sf::st_bbox(
+    sf::st_transform(grid, crs))
+
+  ggplot2::ggplot() +
+    ggplot2::geom_sf(
+      data = grid, ggplot2::aes_string(
+        fill = column, geometry = "geometry"), lwd = 0) +
+    viridis::scale_color_viridis(
+      option = "inferno", na.value = "white",
+      name = label, trans = trans) +
+    viridis::scale_fill_viridis(
+      option = "inferno", na.value = "white",
+      name = label, trans = trans) +
+    ggplot2::geom_sf(
+      data = world, fill = "#dddddd", color = NA) +
+    ggplot2::theme(
+      panel.grid.major.x = ggplot2::element_blank(),
+      panel.grid.major.y = ggplot2::element_blank(),
+      panel.grid.minor.x = ggplot2::element_blank(),
+      panel.grid.minor.y = ggplot2::element_blank(),
+      panel.background = ggplot2::element_blank(),
+      axis.text.x = ggplot2::element_blank(),
+      axis.text.y = ggplot2::element_blank(),
+      axis.ticks = ggplot2::element_blank(),
+      axis.title.x = ggplot2::element_blank(),
+      axis.title.y = ggplot2::element_blank()) +
+    ggplot2::xlab("") + ggplot2::ylab("") +
+    ggplot2::coord_sf(
+      crs  = crs,
+      xlim = bb[c("xmin", "xmax")],
+      ylim = bb[c("ymin", "ymax")])
+}