Nothing
# ============================ #
# The case study #
# ============================ #
#' Marine heatwave cumulative intensity in the Mediterranean Sea
#'
#' @title Marine heatwave cumulative intensity in the Mediterranean Sea
#' @description Cumulative intensity of marine heatwaves in the Mediterranean
#' Sea over the 0 to 250 m layer, on fifteen measured depths, as the case
#' study of the package, at an eighth of a degree.
#' @format A [vol_field()]: a list whose `values` element is a numeric array of
#' 15 depths by 127 latitudes by 339 longitudes, with `NA` where the water
#' column ends or the domain does. The other elements are `lon` and `lat`, the
#' coordinate vectors at an eighth of a degree; `depth`, the fifteen measured
#' levels 0, 12.5, 25, 37.5, 50, 62.5, 75, 87.5, 100, 125, 150, 175, 200, 225
#' and 250 m; `name` and `unit`; `mask`, the land points; and `source`, the
#' provenance, including a SHA-256 of each of the fifteen arrays the field was
#' built from and `step`, the decimation of the native grid.
#' @details Cumulative intensity accumulates the temperature anomaly over the
#' days a marine heatwave lasts, in degree Celsius days, under the definition
#' of Hobday et al. (2016), against a 1993 to 2022 reference period. Coverage
#' falls from 37.4 % of the box at the surface to 29.5 % at 250 m, as the sea
#' floor rises to meet the level.
#'
#' The study computed the field on a grid of a twenty-fourth of a degree,
#' 1016 by 380 points. This object keeps every third point in longitude and
#' latitude, which brings it to 1.6 MB compressed, so that the package stays
#' within the size of a CRAN package; the values at the points kept are the
#' values of the study, not averages.
#'
#' [vol_example_payload()] is the field at the native grid, already written as
#' a payload of 1.5 MB, for the picture at the resolution of the study. The
#' script `data-raw/med_mhw.R` of the package source repository rebuilds this
#' object from the source arrays, and its `--step 1` option gives the native
#' field.
#' @source Copernicus Marine Service, Mediterranean Sea physical reanalysis,
#' product MEDSEA_MULTIYEAR_PHY_006_004,
#' \doi{10.25423/CMCC/MEDSEA_MULTIYEAR_PHY_006_004_E3R1}. The marine heatwave
#' metric was computed from that reanalysis at the Instituto de Ciencias
#' Marinas de Andalucia, CSIC.
#' @references Escudier, R., Clementi, E., Cipollone, A., Pistoia, J., Drudi, M.,
#' Grandi, A., Lyubartsev, V., Lecci, R., Aydogdu, A., Delrosso, D., Omar, M.,
#' Masina, S., Coppini, G., & Pinardi, N. (2021). A high resolution reanalysis
#' for the Mediterranean Sea. *Frontiers in Earth Science*, 9, 702285.
#' \doi{10.3389/feart.2021.702285}
#'
#' Hobday, A. J., Alexander, L. V., Perkins, S. E., Smale, D. A., Straub,
#' S. C., Oliver, E. C. J., Benthuysen, J. A., Burrows, M. T., Donat, M. G.,
#' Feng, M., Holbrook, N. J., Moore, P. J., Scannell, H. A., Sen Gupta, A., &
#' Wernberg, T. (2016). A hierarchical approach to defining marine heatwaves.
#' *Progress in Oceanography*, 141, 227-238.
#' \doi{10.1016/j.pocean.2015.12.014}
#' @examples
#' data(med_mhw)
#' med_mhw
#' plot(med_mhw, depth = 50)
#'
#' p <- vol_payload(med_mhw, tempfile("payload"))
#' vol_standalone(p, path = file.path(tempdir(), "med.html"))
#'
#' # The field at the native grid, already built
#' vol_standalone(vol_example_payload(), path = file.path(tempdir(), "med2.html"))
#' @seealso [vol_example_payload()] for the same field already written as a
#' payload,
#' [vol_field()] for the class, [vol_payload()] and [vol_standalone()] for the
#' two artefacts built from it, [shinyVolumr()] for the application that opens
#' on this field, [plot.vol_field()] for the views of it.
"med_mhw"
#' The case study at its native resolution
#'
#' @title The case study at its native resolution
#' @description Gives the path of the browser payload the package ships for the
#' case study, already written at the native grid of a twenty-fourth of a
#' degree, 1016 by 380 by 21.
#' @return A path to a payload directory, suitable for [vol_standalone()] and
#' [vol_widget()].
#' @details This is the case study put through [vol_payload()] at the native
#' grid of the study, three times finer in each horizontal direction than
#' [med_mhw], with the display settings of the figures of the study (a colour
#' scale from 15 to 60 degree Celsius days on the `matter` table). The payload
#' is 1.5 MB, since its values travel in 8 bits and its images compress.
#'
#' Use it whenever the picture at full resolution is what matters. Build a
#' payload from [med_mhw] instead when the display settings, the transfer or
#' the depth grid need to be something other than these.
#' @examples
#' dir <- vol_example_payload()
#' list.files(dir)
#' out <- vol_standalone(dir, path = file.path(tempdir(), "med.html"))
#' if (interactive()) utils::browseURL(out)
#' @seealso [med_mhw] for the field at an eighth of a degree, [vol_standalone()]
#' for the single-file build, [vol_widget()] to render it in \pkg{shiny} or R
#' Markdown, [vol_payload()] to write a payload of your own.
#' @export
vol_example_payload <- function() {
system.file("extdata", "med_payload", package = "volumr", mustWork = TRUE)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.