Package 'raadtools'

Title: Tools for Synoptic Environmental Spatial Data
Description: Tools for reading, plotting and manipulating spatial data, particularly from remote sensing and model output.
Authors: Michael D. Sumner [aut, cre], Ben Raymond [ctb]
Maintainer: Michael D. Sumner <[email protected]>
License: GPL-3
Version: 0.7.0
Built: 2024-09-19 04:30:18 UTC
Source: https://github.com/AustralianAntarcticDivision/raadtools

Help Index


R tools for spatial data, extensions using raster to read and extract

Description

Tools in R for reading, plotting and manipulating spatial data, originally used at the Australian Antarctic Division (AAD).

Details

read functions like readsst will read a data set by date-time vector, with a set of shared arguments that work the same and documented against this dummy function.

Author(s)

Michael D. Sumner [email protected]

Maintainer: Michael D. Sumner [email protected]


Load raw list of all files available to raadtools from the data repository.

Description

Raw list of all files.

Usage

allfiles(...)

Arguments

...

reserved for future use, currently ignored

Value

data.frame with columns fullname with all file paths


AMPS files

Description

AMPS files

Usage

amps_d1_icefiles(data.source = "", time.resolution = "12hourly", ...)

Arguments

data.source

ignored, reserved for future use

time.resolution

time resolution data to read, 6hourly only for now

...

reserved for future use, currently ignored


AMPS GRIB file metadata

Description

GRIB format metadata from the Antarctic Mesoscale Prediction System (AMPS) files.

Format

amps_metadata A data frame with 8 columns. The columns represent

Band the band number
GRIB_COMMENT the data measured
GRIB_ELEMENT the data name
GRIB_FORECAST_SECONDS forecast seconds
GRIB_REF_TIME text reference time
GRIB_SHORT_NAME short name
GRIB_UNIT text unit
GRIB_VALID_TIME text valid time

Examples

print(amps_metadata)
## u_wind_at_900 <- read  ## unfinished

Aurora Australis voyage track

Description

Voyage track data from the Aurora Australis

Format

aurora A data frame with 3 columns. The columns represent

LONGITUDE_DEGEAST Longitude values
LATITUDE_DEGNORTH Latitude values
DATE_TIME_UTC Date-time values (POSIXct)

Details

This is a sample of the "Aurora Australis Voyage 3 2012/13 Track and Underway Data".

References

http://gcmd.nasa.gov/KeywordSearch/Metadata.do?Portal=amd_au&MetadataView=Full&MetadataType=0&KeywordPath=&OrigMetadataNode=AADC&EntryId=201213030

Examples

## Not run: 
## These data were obtained like this
base <- "http://gcmd.gsfc.nasa.gov/KeywordSearch/RedirectAction.do?target"
b1 <-   "=F4t70bSf87FLsT1TNxR9TSPS74xbHAdheLQcH5Z5PMmgzJ9t%2Bi%2FEs1e8Fl61"
b2 <-   "MPhKjo9qxb2f9wyA%0D%0AoE1kjJ8AMcpFlMMRH7Z6umgNLsGMnWPeQdU7mZHMp%2"
b3 <-   "FtqMpahIrde%2F%2B9%2FZWAkIFrh2bhIiNfl4I9J%0D%0A5KBX9g5Wf7I9JdOgqY"
b4 <-   "bDdpj0iM1K%2BA%3D%3D"
aurora2013 <- read.csv(paste(base, b1, b2, b3, b4, collapse = ""), stringsAsFactors = FALSE)
aurora2013$DATE_TIME_UTC <- as.POSIXct(aurora2013$DATE_TIME_UTC, tz = "GMT")
## get a daily sample
aurora <- aurora2013[,c("LONGITUDE_DEGEAST", "LATITUDE_DEGNORTH", "DATE_TIME_UTC")]
aurora <- aurora[!duplicated(format( aurora$DATE_TIME_UTC, "%Y-%j")), ]
aurora <- aurora[order(aurora$DATE_TIME_UTC), ]
save(aurora, file = "aurora.rda")

## End(Not run)

Title

Description

Title

Usage

ccmp_files(time.resolution = "6hourly", ...)

Arguments

time.resolution

time resoution data to read, daily or monthly

...

passed in to brick, primarily for filename

Value

data frame of file paths

Examples

ccmp_files()

Ocean colour colours for chlorophyll-a.

Description

Ocean colour palette for chlorophyll-a.

Usage

chl.pal(x, palette = FALSE, alpha = 1)

Arguments

x

a vector of data values or a single number

palette

logical, if TRUE return a list with matching colours and values

alpha

value in 0,1 to specify opacity

Details

Flexible control of the chlorophyll-a palette. If x is a single number, the function returns that many colours evenly spaced from the palette. If x is a vector of multiple values the palette is queried for colours matching those values, and these are returned. If x is missing and palette is FALSE then a function is returned that will generate n evenly spaced colours from the palette, as per colorRampPalette.

Value

colours, palette, or function, see Details

References

Derived from http://oceancolor.gsfc.nasa.gov/DOCS/palette_chl_etc.txt.

Examples

## Not run: 
chl <- readchla(xylim = c(100, 110, -50, -40))
## just get a small number of evenly space colours
plot(chl, col = chl.pal(10))
## store the full palette and work with values and colours
pal <- chl.pal()
## the standard full palette
plot(chl, breaks = pal$breaks, col = pal$cols)
## a custom set of values with matching colours
plot(chl, col = chl.pal(pal$breaks[seq(1, length(pal$breaks), length = 10)]))
## any number of colours stored as a function
myfun <- chl.pal()
plot(chl, col = myfun(18))
## just n colours
plot(chl, col = chl.pal(18))

## End(Not run)

Chlorophyll-a

Description

Chlorophyll-a for the Southern Ocean

Usage

chlafiles(
  time.resolution = c("weekly", "monthly"),
  product = c("johnson", "oceancolor"),
  platform = c("MODISA", "SeaWiFS"),
  ...
)

Arguments

time.resolution

weekly (8day) or monthly

product

choice of chla product, see readchla

platform

(modisa or seawifs)

...

reserved for future use, currently ignored

Details

This function generates a list of available chlorophyll-a files, including SeaWiFS and MODIS.

Value

data.frame


Coast map

Description

Coastline data set as SpatialPolygons, currently not supported.

Usage

coastmap(
  map = c("world", "world2", "ant_coast", "ant_coast01", "ant_coast10",
    "Countries_hires", "world1", "world360", "cst00_polygon", "cst01_polygon",
    "cst10_polygon"),
  ...
)

Arguments

map

A named map source

...

arguments passed to worker functions

Details

This function reads and returns a coastline polygon data set, either from the source or serialized cache (.Rdata). Data source locations are controlled by options.

The following named data sets were available.

"world", "world2" - Atlantic and Pacific versions of maptools wrld_simpl ("world1", "world360" are aliases) "ant_coast", "ant_coast01", "ant_coast10" - AAD Antartic coast in full, "1 mill", and "10 mill" resolution ("cst00_polygon", "cst01_polygon", and "cst10_polygon" are aliases) "Countries_hires" - the "CIA" world map exported from the Manifold GIS data set

Value

SpatialPolygonsDataFrame or SpatialPolygons (world1/2)


This is a list of often used projections, in PROJ

Description

Each element can be looked up by name, see Examples

Usage

commonprojections

Format

An object of class list of length 4.

Warning

This should be use only for a convenient reference to look up the projection strings commonly in use. There's no guarantee that this would be appropriate and you should seek cartographic expertise.

References

http://www.spatialreference.org

See Also

projection, CRS, proj4string

Examples

names(commonprojections)
commonprojections[["polar"]]

Circumpolar ROMS files.

Description

Circumpolar ROMS files.

Usage

cpolarfiles(...)

Arguments

...

ignored

Value

data frame of fullname, date

Examples

cpolarfiles()

AVISO ocean currents files

Description

Load file names and dates of AVISO current data

Usage

currentsfiles(time.resolution = c("daily", "weekly"), ...)

Arguments

time.resolution

time resolution to load

...

reserved for future use, currently ignored

Details

A data.frame of file names and dates

Value

data.frame of file names and dates

See Also

readcurr


Load metadata and location of files of polar climatological and other summary environmental data

Description

This function loads the latest cache of stored files for these products, which are available from http://webdav.data.aad.gov.au/data/environmental/derived/antarctic/

Usage

derivaadcfiles(products, ...)

Arguments

products

which derived product

...

reserved for future use, currently ignored

Value

data.frame of file and date

See Also

readderivaadc and derivaadcproducts

Examples

(prods <- derivaadcproducts())
readderivaadc(sample(prods, 1L))

List all derived data products available through readderivaadc

Description

List all derived data products available through readderivaadc

Usage

derivaadcproducts()

Value

character vector of product names

See Also

readderivaadc and derivaadcfiles


Load metadata and location of files of derived sea ice data products.

Description

This function loads the latest cache of stored files for ice products, currently only daily NSIDC southern hemisphere is available.

Usage

derivicefiles(product = "time_since_melt", ...)

Arguments

product

which derived product

...

reserved for future use, currently ignored

Value

data.frame of file and date


Distance to a sea ice 'edge'.

Description

Calculate the shortest distance (metres) to a threshold sea ice contour. If in doubt use distance_to_ice_edge, the definition of the edge is not straightforward, especially so for the higher resolution products and near the coast. distance_to_ice_edge computes a single "main" edge at continental scale distance_to_ice computes all distances to any ice at threshold concentration

Usage

distance_to_ice_edge(
  date,
  threshold = 15,
  xylim = NULL,
  hemisphere = "south",
  returnfiles = FALSE,
  inputfiles = NULL,
  latest = TRUE,
  ...
)

distance_to_ice(
  date,
  threshold = 15,
  xylim = NULL,
  hemisphere = "south",
  returnfiles = FALSE,
  inputfiles = NULL,
  latest = TRUE,
  ...
)

Arguments

date

date or dates of data to read, see Details

threshold

the sea ice concentration threshold to contour at

xylim

spatial extents to crop from source data, can be anything accepted by extent

hemisphere

"north" or "south", default is "south"

returnfiles

ignore options and just return the file names and dates

inputfiles

input the files data base to speed up initialization

latest

if TRUE and date input is missing, return the latest time available otherwise the earliest

...

passed to brick, primarily for filename

Details

The distance is always positive, use readice in the usual way to determine if a location is inside or out of the ice field itself. (If inside means zero distance to ice for you then set it explicitly based on the concentration a point is in.) Future work may generalize this to other data sources.

Value

raster layer with distances to this date's sea ice edge

Note

beware that any queried location outside of this layer's range will be undetermined, and the external boundary of this layer is not constant with respect to the pole, and that in general a location may be closer to ice in the opposite hemisphere.

The argument hemisphere may be north or south (default is south), but this will only work if your locations are on the actual map, so it's not possible to request the distance to ice in both poles for any point.

Examples

plot(distance_to_ice(latest = TRUE))
plot(distance_to_ice_edge(latest = TRUE))
a = extract(distance_to_ice, aurora[17:25, ])
extract(distance_to_ice, aurora[17:25, ], hemisphere = "south")
# library(trip)
# extract(distance_to_ice_edge, walrus818[seq(50, 400, by = 20), ], hemisphere = "north")

extract

Description

Extract methods for raadtools read functions

Usage

## S4 method for signature ''function',data.frame'
extract(x, y, ctstime = FALSE, fact = NULL, verbose = TRUE, ...)

Arguments

x

A raadtools read function.

y

Object to use for querying from the raadtools read functions, such as a vector of character, Date, or POSIXt values, data.frame, trip, etc.

ctstime

specify whether to find the nearest value in time (FALSE), or interpolate between slices (TRUE)

fact

integer. Aggregation factor expressed as number of cells in each direction (horizontally and vertically). Or two integers (horizontal and vertical aggregation factor). See Details in aggregate

verbose

report on progress or keep quiet

...

Additional arguments passed to the read function.

Details

Extract data from read functions in various ways.

Value

data values extracted by the read functions

See Also

readsst and extract

Examples

a <- structure(list(x = c(174, 168, 156, 111, 99, 64, 52, 46, -4,
-15, -30, -38, -47, -62, -87, -127, -145, -160, -161), y = c(-72,
-39, -50, -58, -35, -38, -48, -60, -48, -35, -37, -51, -68, -72,
-69, -54, -40, -49, -54)), .Names = c("x", "y"), row.names = c(NA,
-19L), class = "data.frame")

a$time <- structure(c(5479, 5479, 5479, 5479, 5479, 5479, 5479, 5479, 5479,
5479, 5479, 5489, 5529, 5529, 5529, 5579, 5579, 5579, 5579), class = "Date")
extract(readsst, a)
extract(readsst, a, method = "bilinear")
a$time <-  sort(as.Date("2005-01-01") + sample(c(0, 0, 0, 8, 20, 50), nrow(a), replace = TRUE))
extract(readsst, a)

Fast ice files

Description

Provided by Alex Fraser

Usage

fraser_fasticefiles(...)

Arguments

...

ignored

Details

This function wraps a raadfiles function fasticefiles, but expands the file list out to individual bands.

Value

RasterLayer

Examples

fraser_fasticefiles()

Fronts map data for the Southern Ocean

Description

Load spatial map of fronts data.

Usage

frontsmap(map = c("orsi"))

Arguments

map

name of map to load

Details

Currently ORSI is the only supported layer.

"orsi" - the ORSI fronts derived from the files provided by the WOCE Atlas, see References

Value

SpatialLinesDataFrame

References

http://woceatlas.tamu.edu/Sites/html/atlas/SOA_DATABASE_DOWNLOAD.html


GHRSST L4 files

Description

Data frame of file names and dates.

Usage

ghrsstfiles()

Value

data.frame


Load metadata and location of files of sea ice data products.

Description

This function loads the latest cache of stored files for ice products.

Usage

icefiles(
  time.resolution = "daily",
  product = "nsidc",
  hemisphere = c("south", "north"),
  ...
)

Arguments

time.resolution

daily or monthly files?

product

choice of sea ice product, see readice

hemisphere

north or south

...

reserved for future use, currently ignored

Details

The 'fullname' is the path to the raw NSIDC binary file, 'vrt_dsn' a VRT string describing the fullname as a GDAL DSN string.

Value

data.frame of file and date

Examples

## Not run: 
icf <- icefiles()
icf[nrow(icf), ]

## End(Not run)

Maps of places

Description

Read map images.

Usage

imagemap(map = c("ibcso_background_hq"), fact = 1L)

Arguments

map

name of the map to load

fact

resize factor, see aggregate

Details

The ancient lost art of cartography.

ibcso_background: The IBCSO RGB-map rasterlayer in high resolution

Value

RasterBrick, with R G B bands

References

http://www.ibcso.org/data.html


Nuyina underway track

Description

Voyage track data from the Nuyina

Format

aurora A data frame with 9 columns. The columns represent longitude latitude date_time_utc air_pressure port_longwave_irradiance port_air_temperature precipitation_rate sea_water_salinity sea_water_temperature

Details

This is a sample of the Nuyina underway in 2023.

References

see data-raw for extraction

Examples

range(nuyina$date_time_utc)

Derived ocean colour files

Description

For L3 bin derived products.

Usage

oc_sochla_files(time.resolution = c("daily"), product = c("MODISA", "SeaWiFS"))

Arguments

time.resolution

temporal resolution (base is daily)

product

which product

Value

data frame


Load metadata and location of files of ocean colour data products.

Description

This function loads the latest cache of stored files for NASA ocean colour products.

Usage

ocfiles(
  time.resolution = c("daily", "weekly", "monthly", "weekly32"),
  product = c("MODISA", "SeaWiFS", "VIIRS"),
  varname = c("CHL", "RRS", "POC", "KD490", "NPP_PAR", "SNPP_CHL", "SNPP_RRS"),
  type = c("L3m", "L3b"),
  bz2.rm = TRUE,
  ext = c("nc", "main"),
  ...
)

Arguments

time.resolution

daily or monthly files?

product

choice of ocean colour sensor

varname

which variable (or set of variables)

type

which level of data

bz2.rm

ignore files that are compressed

ext

which extension, e.g. "nc" or "main"

...

reserved for future use, currently ignored

Value

data.frame of file and date


Polar map

Description

Spatial lines in the standard (71S) South Polar projection. Data is the 'rnaturalearth ne_coastline' at 'scale = 10'.

Usage

polar_map(crs = commonprojections$polar)

Arguments

crs

PROJ.4 string

Details

Use 'crs' to modify the projection, or set to 'NA' to leave in longlat.

Value

SpatialLinesDataFrame

Examples

plot(polar_map())

Create a query grid

Description

Create a grid of query values for of longitude, latitude, and date.

Usage

query_grid(lon, lat, date)

Arguments

lon

vector of longitudes in the grid

lat

vector of latitudes in the grid

date

vector of dates in the grid

Details

This be used as the second argument to extract() for general 'point-in-time' value extraction.

The ouput is a data frame of the grid expanded, a row for every combination of longitude, latitude, date - so can be quite large (!) so be careful with very fine resolution or long series.

Examples

lon <- c(100, 110, 120)
lat <-seq(-60, -40, by = 5)
dts <- seq(as.Date("2002-03-03"), by = "5 days", length.out = 10)
qd <- query_grid(lon = lon, lat = lat, date = dts)
## use bilinear to ensure we get an interpolate value in the grid
qd$sst <- extract(readsst, qd, method = "bilinear")
## ssha
qd$ssha <- extract(readssh, qd, ssha = TRUE, method = "bilinear")
qd$wind_mag <- extract(readwind, qd, magonly = TRUE, method = "bilinear")

raadtools

Description

Dummy function

Usage

raadtools(
  date,
  time.resolution = "daily",
  lon180 = TRUE,
  setNA = TRUE,
  latest = FALSE,
  returnfiles = FALSE,
  ...
)

Arguments

date

date or dates of data to read,

time.resolution

time resoution data to read, daily or monthly

lon180

defaults to TRUE, to "rotate" Pacific view 0, 360 data to Atlantic view -180, 180

setNA

mask out land values (only applies to monthly time.resolution)

latest

if TRUE (and date not supplied) return the latest time available

returnfiles

ignore options and just return the file names and dates

...

passed in to brick, primarily for filename

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

inputfiles

input the files data base to speed up initialization


Load metadata and location of files of Rapid Response imagery.

Description

This function loads the latest cache of stored files for rapid response products.

Usage

rapid_responsefiles(product = c("aqua", "terra"), ...)

Arguments

...

reserved for future use, currently ignored

Details

We acknowledge the use of Rapid Response imagery from the Land Atmosphere Near-real time Capability for EOS (LANCE) system operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) with funding provided by NASA/HQ.

Value

data.frame of file and date

Examples

## Not run: 
rf <- rapid_responsefiles()
range(rf$date)

## End(Not run)

Altimetry products.

Description

Functions read_sla_daily and so on for "ugosa, adt, ugos, sla, vgos, vgosa, err".

Usage

read_ugosa_daily(
  date,
  xylim = NULL,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

read_ugos_daily(
  date,
  xylim = NULL,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

read_sla_daily(
  date,
  xylim = NULL,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

read_vgos_daily(
  date,
  xylim = NULL,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

read_vgosa_daily(
  date,
  xylim = NULL,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

read_err_daily(
  date,
  xylim = NULL,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read,

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

latest

if TRUE (and date not supplied) return the latest time available

returnfiles

ignore options and just return the file names and dates

...

passed in to brick, primarily for filename

inputfiles

input the files data base to speed up initialization

Details

sla is sea level anomaly, for the raw files see raadfiles::altimetry_daily_files

Value

a raster layer

Examples

a <- read_adt_daily(sort(Sys.Date() - 1:50),
xylim = extent(100, 150, -70, -40))
## Not run: 
animate(a, pause = 0,
col = colorRampPalette(c("dodgerblue", "white", "firebrick"))(21),
breaks = c(seq(min(cellStats(a, min)), 0, length = 11),
           seq(0.001, max(cellStats(a, max)), length = 10)))

## End(Not run)

Read AMSR sea ice data.

Description

Both eras are available in the same series, scaling is applied to the first series to ensure the data is always in percentage (0, 100).

Usage

read_amsr_ice(
  date,
  xylim = NULL,
  latest = TRUE,
  ...,
  returnfiles = FALSE,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read, see Details

xylim

spatial extents to crop from source data, can be anything accepted by extent

latest

if TRUE and date input is missing, return the latest time available otherwise the earliest

...

passed to brick, primarily for filename

returnfiles

ignore options and just return the file names and dates

inputfiles

input the files data base to speed up initialization

Details

This function relies on the file-listing of raadfiles::amsr_daily_files()

See Also

raadfiles::amsr_daily_files read_cersat_ice readice


Read AMSR2 sea ice data (3km.

Description

Using the TIF files (these are 2012 onwards)

Usage

read_amsr2_3k_ice(
  date,
  xylim = NULL,
  latest = TRUE,
  ...,
  setNA = TRUE,
  returnfiles = FALSE,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read, see Details

xylim

spatial extents to crop from source data, can be anything accepted by extent

latest

if TRUE and date input is missing, return the latest time available otherwise the earliest

...

passed to brick, primarily for filename

setNA

mask zero and values greater than 100 as NA

returnfiles

ignore options and just return the file names and dates

inputfiles

input the files data base to speed up initialization

Details

This function relies on the file-listing of raadfiles::amsr2_3k_daily_files()

See Also

raadfiles::amsr2_3k_daily_files read_amsr2_ice


Read AMSR2 sea ice data (6km)

Description

Using the TIF files (these are 2012 onwards)

Usage

read_amsr2_ice(
  date,
  xylim = NULL,
  latest = TRUE,
  ...,
  setNA = TRUE,
  returnfiles = FALSE,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read, see Details

xylim

spatial extents to crop from source data, can be anything accepted by extent

latest

if TRUE and date input is missing, return the latest time available otherwise the earliest

...

passed to brick, primarily for filename

setNA

mask zero and values greater than 100 as NA

returnfiles

ignore options and just return the file names and dates

inputfiles

input the files data base to speed up initialization

Details

This function relies on the file-listing of raadfiles::amsr2_daily_files().

See Also

raadfiles::amsr2_daily_files


Read AMSRE sea ice data (6km)

Description

Using the TIF files (these are 2012 onwards)

Usage

read_amsre_ice(
  date,
  xylim = NULL,
  latest = TRUE,
  ...,
  returnfiles = FALSE,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read, see Details

xylim

spatial extents to crop from source data, can be anything accepted by extent

latest

if TRUE and date input is missing, return the latest time available otherwise the earliest

...

passed to brick, primarily for filename

returnfiles

ignore options and just return the file names and dates

inputfiles

input the files data base to speed up initialization

Details

This function relies on the file-listing of raadfiles::amsre_daily_files().

See Also

raadfiles::amsre_daily_files read_amsr2_ice


Read CCMP wind files, from the RSS Cross-Calibrated Multi-Platform Ocean Surface Wind Project

Description

RSS CCMP_RT V2.1 derived surface winds (Level 3.0)

Usage

read_ccmp(
  date,
  time.resolution = c("6hourly"),
  xylim = NULL,
  lon180 = FALSE,
  magonly = FALSE,
  dironly = FALSE,
  uonly = FALSE,
  vonly = FALSE,
  nobsonly = FALSE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read, see Details

time.resolution

time resolution (6hourly)

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

magonly

return just the magnitude from the U and V components

dironly

return just the direction from the U and V, in degrees N=0, E=90, S=180, W=270

uonly

return just the U component of velocity

vonly

return just the V component of velocity components, in degrees (0 north, 90 east, 180 south, 270 west)

latest

if TRUE (and date not supplied) return the latest time available, otherwise the earliest

returnfiles

ignore options and just return the file names and dates

...

passed to brick, primarily for filename

Details

CCMP wind data is read from files managed by ccmp_files. Dates are matched to file names by finding the nearest match in time within a short duration. By default only one time step is returned with both U and V components. Multiple dates can be returned for magnitude or direction, U or V only or N-obs only.

This is the " RSS VAM 6-hour analyses starting from the NCEP GFS wind analyses"

See References.

References

http://www.remss.com

See Also

icefiles for details on the repository of data files, raster for the return value

Examples

## read a single time slice, direction only
x <- read_ccmp(dironly = TRUE)


## get a local extent for a zoom plot and plot the directions [0,360) as an image with arrows
e <- extent(projectExtent(raster(extent(130, 150, -50, -30), crs = "+proj=longlat"), projection(x)))
x <- crop(read_ccmp(), e)
crds <- coordinates(x)
scale <- 0.05
vlen <- function(x) sqrt(x[[1]]^2 + x[[2]]^2)
plot(vlen(crop(x, e)))
x1 <- crds[,1]
y1 <- crds[,2]
x2 <- crds[,1] + values(x[[1]]) * scale
y2 <- crds[,2] + values(x[[2]]) * scale
arrows(x1, y1, x2, y2, length = 0.02)

## faster if we get the file list first
ccfiles <- ccmp_files()
earliest <- read_ccmp(ccfiles$date[1:16], xylim = e, magonly = TRUE, inputfiles = ccfiles)
plot(earliest, col = hcl.colors(64), zlim = c(0, 20))

Read CERSAT daily sea ice data.

Description

This is southern hemisphere daily 12.5km SSM/I since 1991.

Usage

read_cersat_ice(
  date,
  xylim = NULL,
  latest = TRUE,
  setNA = TRUE,
  ...,
  returnfiles = FALSE,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read, see Details

xylim

spatial extents to crop from source data, can be anything accepted by extent

latest

if TRUE and date input is missing, return the latest time available otherwise the earliest

setNA

mask zero and values greater than 100 as NA

...

passed to brick, primarily for filename

returnfiles

ignore options and just return the file names and dates

inputfiles

input the files data base to speed up initialization

Details

This function relies on the file-listing of raadfiles::cersat_daily_files()

See Also

raadfiles::cersat_daily_files read_amsr_ice


Read Earth Gravitation Model

Description

Global 2.5 Minute Geoid Undulations, a big raster from multiple files. We just create a temporary virtual raster from the source files, and return as a RasterLayer.

Usage

read_geoid(xylim = NULL, force = FALSE)

Arguments

xylim

an extent, in longlat, or an object that provides one

force

if TRUE ignore cached virtual saved file, and recompute (try this if it otherwise fails)

Details

Each file is an ESRI GRID raster data set of 2.5-minute geoid undulation values covering a 45 x 45 degree area. Each raster file has a 2.5-minute cell size and is a subset of the global 2.5 x 2.5-minute grid of pre-computed geoid undulation point values found on the EGM2008-WGS 84 Version web page. This ESRI GRID format represents a continuous surface of geoid undulation values where each 2.5-minute raster cell derives its value from the original pre-computed geoid undulation point value located at the SW corner of each cell.

Value

RasterLayer, longitude latitue grid of geoid level

Examples

## Not run: 
geoid <- read_geoid()

## End(Not run)

Relative lead frequencies for the polar oceans

Description

Average Lead-Frequency for the Arctic for winter months November-April 2002/03-2018/19 based on daily lead composites as derived from MOD/MYD-29 IST 5 min granules

Usage

read_leads_clim_south(xylim = NULL)

read_leads_clim_north(xylim = NULL)

read_leads_clim(hemisphere = c("south", "north"), xylim = NULL, ...)

References

F. Reiser, S. Willmes, G. Heinemann (2020), A new algorithm for daily sea ice lead identification in the Arctic and Antarctic winter from thermal-infrared satellite imagery, Data subm.

Examples

read_leads_clim()
read_leads_clim_north(xylim = extent(c(-1, 1, -1, 1) * 50000))
south <- read_leads_clim_south()

## hone in on Mawson
pt <- reproj::reproj_xy(cbind(62 + 52/60, -(67 +  36/60)), projection(south), source = "+proj=longlat")
lead <- read_leads_clim_south(xylim = extent(pt[1] + c(-1, 1) * 250000, pt[2] + c(-1, 1) * 250000))
plot(lead, col = grey.colors(100))
abline(v = pt[1], h = pt[2])

Southern Ocean Chlorophyll-a

Description

Read Southern Ocean Chlorophyll-a in L3 bin form.

Usage

read_oc_sochla(
  date,
  time.resolution = c("daily"),
  bins = NULL,
  product = c("MODISA", "SeaWiFS"),
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date/s to read

time.resolution

daily for now

latest

return only the latest day if date intput missing, otherwise the earliest

returnfiles

give the files instead of the data

...

ignored

inputfiles

speed up the read by inputting the files

xylim

extent in longitude latitude using 'raster::extent'

Details

relies on processing done here https://github.com/AustralianAntarcticDivision/ocean_colour

Value

tibble of the values in L3 bin form


Read PAR from NASA ocean colour.

Description

Currently using MODISA 4km Mapped L2m, see raadfiles::par_files() for the actual source files.

Usage

read_par(
  date,
  time.resolution = "8D",
  xylim = NULL,
  lon180 = FALSE,
  nobsonly = FALSE,
  latest = TRUE,
  returnfiles = FALSE,
  inputfiles = NULL,
  ...
)

Arguments

date

date or dates of data to read,

time.resolution

'8D' currently, use the NASA tokens for time period

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

lon180

defaults to TRUE, to "rotate" Pacific view 0, 360 data to Atlantic view -180, 180

latest

if TRUE (and date not supplied) return the latest time available

returnfiles

ignore options and just return the file names and dates

inputfiles

input the files data base to speed up initialization

...

passed in to brick, primarily for filename

Value

raster object

Examples

read_par(latest = FALSE)

Read SOSE Southern Ocean State Estimate

Description

Model data read from files managed by sose_monthly_files. Dates are matched to file names by finding the nearest match in time within a short duration. If date is greater than length 1 then the sorted set of unique matches is returned.

Usage

read_sose(
  date,
  time.resolution = c("monthly"),
  varname = "",
  level = 1L,
  setNA = TRUE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

varname

variable to return from the data files, default is whatever first value from sose_monthly_varnames()

level

defaults to 1L - there are 52

Details

This function doesn't support xylim, lon180, or more than one date being read.

Value

raster object

Examples

## Not run: 
read_sose(varname = "Uvel", level = 1)
read_sose(varname = "SeaIceArea", level = 1, latest = FALSE)
read_sose(varname = "Chl", level = 10, latest = FALSE)


## End(Not run)

read AMPS data

Description

Read from The Antarctic Mesoscale Prediction System (AMPS) files. readamps_d1wind reads the "d1" level wind (defaults to 1).

Usage

readamps_d1wind(
  date,
  time.resolution = "4hourly",
  xylim = NULL,
  magonly = FALSE,
  dironly = FALSE,
  uonly = FALSE,
  vonly = FALSE,
  latest = TRUE,
  returnfiles = FALSE,
  level = 1,
  ...,
  inputfiles = NULL
)

Details

readamps reads the band (defaults to 1).

See amps_metadata for a description of the bands.

Data http://www2.mmm.ucar.edu/rt/amps/wrf_grib/, and contain gridded forecast data from the AMPS-WRF model. The 'd1' (domain 1) files are on a 30km grid, while the 'd2' (domain 2) files are on a 10km grid. The grid domains are shown at http://polarmet.osu.edu/AMPS/ - d2 extends out to southern Australia and the tip of South America, and d1 covers just Antarctica (including Davis) and parts of the Southern Ocean. There are two forecast cycles, starting at 00UT and 12UT daily. Forecasts are for +00, +03, +06, +09, +12 and +15 hours. These steps can be used to see how the wind field is forecast as changing, and to obtain two different data sets each 3 hour timestep (e.g. the +15h forecast for the 00UT run is at the same time as the +03h forecast from the 12UT run). The 00UT and 12UT runs contain fewer parameters that the +03h and later forecasts

An example file date is "2015-10-25 UTC"
gdalinfo 2015102512_WRF_d1_f000.grb

uonly is

Band 5 Block=329x1 Type=Float64, ColorInterp=Undefined
Description = 10[m] HTGL (Specified height level above ground)
Metadata:
  GRIB_COMMENT=u-component of wind [m/s]
  GRIB_ELEMENT=UGRD
  GRIB_FORECAST_SECONDS=0 sec
  GRIB_REF_TIME=  1445774400 sec UTC
  GRIB_SHORT_NAME=10-HTGL
  GRIB_UNIT=[m/s]
  GRIB_VALID_TIME=  1445774400 sec UTC

vonly is
Band 27 Block=329x1 Type=Float64, ColorInterp=Undefined
Description = 10[m] HTGL (Specified height level above ground)
Metadata:
  GRIB_COMMENT=v-component of wind [m/s]
GRIB_ELEMENT=VGRD
GRIB_FORECAST_SECONDS=0 sec
GRIB_REF_TIME=  1445774400 sec UTC
GRIB_SHORT_NAME=10-HTGL
GRIB_UNIT=[m/s]
GRIB_VALID_TIME=  1445774400 sec UTC

Value

Raster

Examples

af <- amps_d1files()
w <- readamps_d1wind(latest = TRUE, inputfiles = af)
#w <- readamps_d2wind(latest = TRUE)
vlen <- function(a, b) sqrt(a * a + b * b)
plot(vlen(w[[1]], w[[2]]))

## arrow jigger
arr <- function(x, sub = seq(ncell(x[[1]])), scale = 1) {
 cr <- coordinates(x[[1]]); cr1 <- cr;
 cr1[,1] <- cr[,1] + values(x[[1]])*scale;
 cr1[,2] <- cr1[,2] + values(x[[2]]*scale);
 segments(cr[sub,1], cr[sub,2], cr1[sub,1], cr1[sub,2])
}
arr(w, sample(ncell(w), 10000), scale = 15000)

Read 'cafe' MODIS monthly data

Description

Files are found with raadfiles::cafe_monthly_files().

Usage

readcafe(
  date,
  time.resolution = c("monthly"),
  xylim = NULL,
  lon180 = TRUE,
  setNA = TRUE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read,

time.resolution

time resoution data to read, daily or monthly

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

lon180

defaults to TRUE, to "rotate" Pacific view 0, 360 data to Atlantic view -180, 180

setNA

mask out land values (only applies to monthly time.resolution)

latest

if TRUE (and date not supplied) return the latest time available

returnfiles

ignore options and just return the file names and dates

...

Arguments passed on to raadtools

inputfiles

input the files data base to speed up initialization

Examples

readcafe(date = "2010-01-15")

Read Chlorophyll-a, NASA algorithm

Description

Ocean colour Chlorophyll-a data, provide an input of daily dates and these will be averaged into one layer.

Usage

readCHL_month(
  date,
  xylim = NULL,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL,
  latest = TRUE
)

readchla(
  date,
  product = c("MODISA", "SeaWiFS", "VIIRS"),
  xylim = NULL,
  algorithm = c("nasa"),
  latest = TRUE,
  grid = NULL
)

Arguments

date

date or dates of data to read, see Details

xylim

spatial extents to crop from source data, can be anything accepted by extent, ignored if grid is provided @param algorithm nasa only

latest

if TRUE (and date not supplied) return the latest time available, otherwise the earliest Note that reaCHL_month reads the NASA algorith L3m products.

product

choice of product, see Details

grid

template raster object for output

Value

raster object

See Also

readCHL_month

chlafiles for details on the repository of data files, raster for the return value

Examples

readCHL_month()
## Not run: 
d <- readchla(c("2003-01-01", c("2003-06-01")),
         xylim = extent(100, 150, -70, -30))

## End(Not run)

Read AVISO ocean current data

Description

Current data is read from files managed by currentsfiles. Dates are matched to file names by finding the nearest match in time within a short duration. By default only one time step is returned with both U and V components. Multiple dates can be returned for magnitude or direction, U or V only.

Usage

readcurr(
  date,
  time.resolution = c("daily"),
  xylim = NULL,
  lon180 = TRUE,
  magonly = FALSE,
  dironly = FALSE,
  uonly = FALSE,
  vonly = FALSE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read, see Details

time.resolution

time resolution to read

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

lon180

defaults to TRUE, to "rotate" Pacific view 0, 360 data to Atlantic view -180, 180

magonly

return just the magnitude from the U and V components

dironly

return just the direction from the U and V, in degrees N=0, E=90, S=180, W=270

uonly

return just the U component of velocity

vonly

return just the V component of velocity components, in degrees (0 north, 90 east, 180 south, 270 west)

latest

if TRUE (and date not supplied) return the latest time available, otherwise the earliest

returnfiles

ignore options and just return the file names and dates

...

passed to brick, primarily for filename

Details

This is the "DT merged all satellites Global Ocean Gridded SSALTO/DUACS Sea Surface Height L4 product and derived variables" See References.

Value

raster object with the "U" (meridional/horizontal/X) and "V" (zonal/vertical/Y) components of velocity in m/s. Setting either of the (mutually exclusive) magonly and dironly arguments returns the magnitude (in m/s) or direction (in degrees relative to North) of the velocity vectors.

Note

These data for daily files are stored in longitude/latitude projection on the sphere between longitudes in the Pacific view [0, 360], the default behaviour is to reset this to Atlantic view [-180, 180] with lon180.

References

http://marine.copernicus.eu

See Also

icefiles for details on the repository of data files, raster for the return value

Examples

## read a single time slice, and plot the directions [0,360) as an image with arrows
x <- readcurr(dironly = TRUE)
## get a local extent for a zoom plot
e <- extent(projectExtent(raster(extent(130, 150, -50, -30), crs = "+proj=longlat"), projection(x)))
x <- crop(readcurr(), e)
crds <- coordinates(x)
scale <- 1.5
vlen <- function(x) sqrt(x[[1]]^2 + x[[2]]^2)
plot(vlen(crop(x, e)))
x1 <- crds[,1]
y1 <- crds[,2]
x2 <- crds[,1] + values(x[[1]]) * scale
y2 <- crds[,2] + values(x[[1]]) * scale
arrows(x1, y1, x2, y2, length = 0.03)

Read data from polar climatological and other summary environmental data

Description

Derived data are read from files managed by derivaadcfiles.

Usage

readderivaadc(products, xylim = NULL, returnfiles = FALSE, ...)

Arguments

products

choice of products, see derivaadcproducts for available products

xylim

spatial extents to crop from source data, can be anything accepted by extent

returnfiles

ignore options and just return the file names

...

passed to brick, primarily for filename

Value

raster object

References

http://data.aad.gov.au/aadc/metadata/metadata.cfm?entry_id=Polar_Environmental_Data

See Also

derivaadcfiles for details on the repository of data files, raster for the return value

Examples

## Not run: 
prods <- c("bathymetry","chl_summer_climatology")
x <- readderivaadc(prods)

## End(Not run)

Read data from derived sea ice data products.

Description

Derived sea ice data is read from files managed by derivicefiles.

Usage

readderivice(
  date,
  time.resolution = c("daily"),
  product = c("time_since_melt"),
  xylim = NULL,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read, see Details

time.resolution

time resoution data to read, daily or monthly

product

choice of sea ice product, see Details

xylim

spatial extents to crop from source data, can be anything accepted by extent

latest

if TRUE and date input missing, return the latest time available, otherwise the earliest

returnfiles

ignore options and just return the file names and dates

...

passed to brick, primarily for filename

inputfiles

input the file set to avoid rescanning that (for extract point-in-time)

Details

Currently available products are

Dates are matched to file names by finding the nearest match in time within a short duration. If date is greater than length 1 then the sorted set of unique matches is returned.

time_since_melt

32767 (treated as missing data)

32766 = land

32765 = open-ocean zone

-32768 = ice that hasn't melted during the data period

In terms of missing data 32767, in the nc file, so should be NA once read into R): these are either open water in the sea ice zone that hasn't re-frozen during the data period, or missing sea ice data that couldn't be interpolated.

Value

raster object

See Also

derivicefiles for details on the repository of data files, raster for the return value


Fast ice data

Description

Fast ice data

Usage

readfastice(
  date,
  product = c("circum_fast_ice", "binary_fast_ice"),
  xylim = NULL,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates to read (can be character, POSIXt, or Date)

product

'circum_fast_ice' or 'binary_fast_ice'

xylim

extent in native space of the grid

returnfiles

return the file details only

...

reserved for future use, currently ignored

time.resolution

fixed, the underlying time step is 15 days

Details

High-resolution mapping of circum-Antarctic landfast sea ice distribution, 2000–2018.

Fast ice data on original polar stereographic grid, the product "circum_fast_ice" is 1000m resolution published in Alex Fraser et al. (2020).

Value

RasterBrick see Details

Circumpolar product from 2020

Classified surface type:

  • 0: pack ice or ocean

  • 1: continent

  • 2: islands

  • 3: ice shelf

  • 4: fast ice

  • 5: manual fast ice edge

  • 6: auto fast ice edge

Old binary product

  • 0: Southern Ocean, pack ice or icebergs, corresponding to light blue in the PNG files.

  • 1: Antarctic continent (including ice shelves), as defined using the Mosaic of Antarctica product, corresponding to white in the PNG files.

  • 2: Fast ice, as classified from a single 20-day MODIS composite image, corresponding to dark blue in the PNG files

  • 3: Fast ice, as classified using a single 20-day AMSR-E composite image, corresponding to yellow in the PNG files

  • 4: Fast ice, as classified using the previous or next 20-day MODIS composite images, corresponding to red in the PNG files

http://data.aad.gov.au/aadc/metadata/metadata.cfm?entry_id=modis_20day_fast_ice

Examples

## read a particular date, it's circumpolar grid with 7 discrete numerc classes
fice <- readfastice("2015-10-01")
## hone in on Davis
ex <- c(1742836L, 3315135L, 129376L, 1136611L)
davis_ice <- crop(fice, extent(c(1742836L, 3315135L, 129376L, 1136611L)))
plot(davis_ice >= 4) #, col = c("brown", "white", grey(c(0.2, 0.5, 0.8))), breaks = c(0, 1, 3, 4, 5, 6))

## compare 5 years change
davis_ice2 <- crop(readfastice("2010-10-01"), extent(ex))
par(mfrow = c(2, 1))
plot(davis_ice >= 4)
plot(davis_ice2 >= 4)

Read data from the Sokolov/Rintoul Southern Ocean fronts analysis.

Description

Sokolov Rintoul

Usage

readfronts(
  date,
  time.resolution = c("weekly"),
  product = c("sokolov"),
  xylim = NULL,
  lon180 = TRUE,
  setNA = FALSE,
  trim = TRUE,
  returnfiles = FALSE,
  RAT = TRUE,
  ...
)

Arguments

date

date or dates of data to read, see Details

time.resolution

time resoution data to read, daily or monthly

product

choice of product, see Details

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

lon180

if TRUE, data originally in Pacific view will be returned in Atlantic view (-180:180)

setNA

is TRUE NaN values are replaced with NA

trim

if TRUE the map is cropped to no contiguous margins of missing data

returnfiles

ignore options and just return the file names and dates

RAT

if TRUE data is returned with region names as a raster attribute table on the gridded data, see ratify

...

reserved for future use, currently ignored

Value

raster object

Examples

## Not run: 
b <- readfronts(c("1993-01-01", "2005-01-02"), lon180 = FALSE)

## End(Not run)

Backward-in-time Finite-Size Lyapunov Exponents

Description

Daily files

Usage

readfsle(
  date,
  time.resolution = c("daily"),
  xylim = NULL,
  latest = TRUE,
  varname = c("fsle_max", "theta_max"),
  returnfiles = FALSE,
  verbose = TRUE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read, see Details

time.resolution

time resolution to read (only daily)

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

latest

if TRUE and input date is missing return the latest time available, otherwise the earliest

varname

either fsle_max or 'theta_max“

returnfiles

ignore options and just return the file names and dates

verbose

print messages on progress etc.

...

passed to brick, primarily for filename

inputfiles

input the files data base to speed up initialization

Value

data.frame


Read GHRSST

Description

SST in Kelvin

Usage

readghrsst(
  date,
  time.resolution = c("daily"),
  xylim = NULL,
  lon180 = TRUE,
  varname = c("analysed_sst", "analysis_error", "mask", "sea_ice_fraction"),
  setNA = TRUE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

datetime

time.resolution

daily

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

lon180

currently ignored

varname

one of "analysed_sst", "analysis_error", "mask", "sea_ice_fraction"

setNA

ignored

latest

if TRUE (and date not supplied) return the latest time available

returnfiles

ignore options and just return the file names and dates

...

arguments passed to raster brick

inputfiles

input the files data base to speed up initialization

Value

RasterStack or RasterLayer


Read from NSIDC 25km polar sea ice.

Description

Sea ice at 25km for either hemisphere.

Usage

readice_daily(
  date,
  time.resolution = "daily",
  product = "nsidc",
  hemisphere = c("south", "north", "both"),
  xylim = NULL,
  setNA = TRUE,
  rescale = FALSE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL,
  resample = "bilinear"
)

readice(
  date,
  time.resolution = "daily",
  product = "nsidc",
  hemisphere = c("south", "north", "both"),
  xylim = NULL,
  setNA = TRUE,
  rescale = FALSE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL,
  resample = "bilinear"
)

readice_monthly(
  date,
  time.resolution = "monthly",
  product = "nsidc",
  hemisphere = c("south", "north"),
  xylim = NULL,
  setNA = TRUE,
  rescale = TRUE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read, see Details

time.resolution

time resoution data to read, daily or monthly

product

choice of sea ice product, see Details

hemisphere

north or south (or both, if 'both' xylim should be an actual raster or terra grid)

xylim

spatial extents to crop from source data, can be anything accepted by extent

setNA

mask zero and values greater than 100 as NA

rescale

rescale values from integer range?

latest

if TRUE and date input is missing, return the latest time available otherwise the earliest

returnfiles

ignore options and just return the file names and dates

...

passed to brick, primarily for filename

inputfiles

input the files data base to speed up initialization

resample

warper resampling method used when 'xylim' is a full grid

extension

default for product "amsr" is "hdf" but can be "tif" , extension = "hdf"

Details

This function relies on the file-listing of icfiles().

Currently available products are

'nsidc'

daily or monthly NSIDC concentration data, processed by the SMMR/SSMI NASA Team

Dates are matched to file names by finding the nearest match in time within a short duration. If date is greater than length 1 then the sorted set of unique matches is returned.

For NSIDC data a ratifyied raster is returned if setNA and rescale are both set to FALSE. Use levels(x) to return the data.frame of values and levels (there's no straight-through rule, all numeric values are explicit along with special values like "Unused"). The values used are documented here http://nsidc.org/data/docs/daac/nsidc0051_gsfc_seaice.gd.html

If 'both' is specified for hemisphere or if 'xylim' is a full raster grid, the warper is applied to VRT versions of the NSIDC files, which allows them to be combined in one reprojection step. In this case 'xylim' can be specified, to give a projected grid of any form. ' If not supplied (when hemisphere = 'both') then longlat raster at 0.25 degrees is assumed. ('xylim' can be specified as ' a target grid and with only north or south hemisphere applied). When the warper is used, 'setNA' and 'resample' behave the same ' way, though exact results will be different depending on the value of 'resample'.

Value

raster object

See Also

icefiles for details on the repository of data files, raster for the return value

Examples

library(raadtools)
 
ice <- readice(latest = TRUE)

## can read one or other hemisphere in native projection
readice(hemisphere = "south")
readice(hemisphere = "north")
## or we can read both, and get longlat by default
readice(hemisphere = "both")
## or set our own grid and read to that
## spex::buffer_extent(extent(c(-.5, .5, -1, 1)* rad * pi), 25000)
tm_ex <- c(-.5, .5, -1, 1) * 20025000 
tm_template <- raster(extent(tm_ex), res = 25000, crs = "+proj=tmerc")
readice(hemisphere = "both", xylim = tm_template)

## this means we can run extract on global ice, and get 0 in the middle
## extract(readice, data.frame(176, c(-72, 84), as.Date("2020-04-03") + c(0, 100)))
## [1]  80 NA
## extract(readice, data.frame(176, c(-72, 84), as.Date("2020-04-03") + c(0, 100)), hemisphere = "both")
 ## [1]  78.0 94.4  ## it's interpolated from the original data

Area of pixels in sea ice

Description

Read the NSIDC pixel-area files for either hemisphere. Only 25km product is supported. Tool name "psn25area_v3.dat and pss25area_v3.dat": http://nsidc.org/data/polar-stereo/tools_geo_pixel.html#pixel_area.

Usage

readice_area(product = "nsidc", hemisphere = "south", ...)

Arguments

product

"nsidc" the 25km NSIDC passive microwave

hemisphere

south (default) or north

...

ignored

Value

raster with the area of the cells in m^2

See Also

readice

Examples

readice_area()
readice_area(hemisphere = "north")

Mixed Layer Depth

Description

Read the Sall?e Mixed layer depth climatology.

Usage

readmld(date, xylim = NULL, returnfiles = FALSE, ...)

Arguments

date

date to extract, can only be a climatology month

xylim

extent specification

returnfiles

return the file details only

...

ignored

Details

Information from JB Sallee (2013-06-06) is below, and an example to read and display it in R. A recently updated dataset using the most recent Southern Ocean observation, with updated gridding analysis so it should be better and have appropriate land mask: ftp://ftp.nerc-bas.ac.uk/jbsall/MLfitted_SO.mat This is a compilation of ocean observations: a compilation of 225389 profiles from the Argo program and 106682 profiles from all kind of different ships and PIs. This is not model evaluation. This is likely the best estimate of monthly MLD , because it uses the largest number of observations. There is no observational products with time variability because the Southern Ocean only started to be observed (at basin scale) in this last decade. No observation product can give a temporal evolution at basin scale. Model estimate could be use, but model are known to perform particularly badly in the surface layer so the mixed-layer is always problematic from model. Another possibility could be to use some reanalysis product like that Met-Office product (http://www.metoffice.gov.uk/hadobs/en3/data/EN3_v2a/download_EN3_v2a.html), but this is an objective analysis of available observation, so in the southern Ocean before 2002 (when Argo started), there is not much, so the results will be strongly dominated by the climatology (World ocean Atlas). Unfortunately there is no good answer for time variability of MLD.

Value

RasterBrick


MODIS Rapid Response images

Description

Read MODIS Rapid Response RGB images

Usage

readrapid_response(
  date,
  product = c("aqua", "terra"),
  latest = TRUE,
  returnfiles = FALSE,
  ...
)

Arguments

date

date of image to load

latest

if TRUE and date input is missing return the latest time available, otherwise the earliest

returnfiles

return just the list of files

...

other arguments for brick

Details

MODIS Rapid Response, Antarctica


Read SMAP sea surface salinity data

Description

SMAP surface salinity data read from files managed by salfiles.

Usage

readsal(
  date,
  time.resolution = c("daily"),
  xylim = NULL,
  lon180 = TRUE,
  varname = c("sss_smap", "nobs", "sss_ref", "gland", "gice", "surtep"),
  setNA = TRUE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read,

time.resolution

time resoution data to read, daily or monthly

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

lon180

defaults to TRUE, to "rotate" Pacific view 0, 360 data to Atlantic view -180, 180

varname

variable to return from the data files, default is "sss_smap", also available is "nobs", "sss_ref", "gland", "gice", "surtep"

setNA

mask out land values (only applies to monthly time.resolution)

latest

if TRUE (and date not supplied) return the latest time available

returnfiles

ignore options and just return the file names and dates

...

Arguments passed on to raadtools

inputfiles

input the files data base to speed up initialization

readall

FALSE by default

Value

raster object


read SSH/A

Description

Sea surface height/anomaly

Usage

readssh(
  date,
  time.resolution = c("daily"),
  xylim = NULL,
  lon180 = TRUE,
  ssha = FALSE,
  latest = TRUE,
  returnfiles = FALSE,
  verbose = TRUE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read, see Details

time.resolution

time resolution to read

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

lon180

defaults to TRUE, to "rotate" Pacific view 0, 360 data to Atlantic view -180, 180 components, in degrees (0 north, 90 east, 180 south, 270 west)

ssha

logical, to optionally return anomaly or height

latest

if TRUE and date input is missing return the latest time available, otherwise the earliest

returnfiles

ignore options and just return the file names and dates

verbose

print messages on progress etc.

...

passed to brick, primarily for filename

inputfiles

input the files data base to speed up initialization

Details

Details

Value

data.frame


Read OISST sea surface temperature data

Description

SST data read from files managed by sstfiles. Dates are matched to file names by finding the nearest match in time within a short duration. If date is greater than length 1 then the sorted set of unique matches is returned. see Details in raadtools

Usage

readsst(
  date,
  time.resolution = c("daily", "monthly"),
  xylim = NULL,
  lon180 = TRUE,
  varname = c("sst", "anom", "err", "ice"),
  setNA = TRUE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read,

time.resolution

time resoution data to read, daily or monthly

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

lon180

defaults to TRUE, to "rotate" Pacific view 0, 360 data to Atlantic view -180, 180

varname

variable to return from the data files, default is "sst" or "anom", "err", "ice"

setNA

mask out land values (only applies to monthly time.resolution)

latest

if TRUE (and date not supplied) return the latest time available

returnfiles

ignore options and just return the file names and dates

...

Arguments passed on to raadtools

inputfiles

input the files data base to speed up initialization

readall

FALSE by default

Value

raster object

See Also

icefiles for details on the repository of data files, raster for the return value

Examples

## Not run: 
## read one time slice and plot it up in preparation for reading a time series
d <- readsst()
plot(d)
## this step is interactive, draw a boundary on the plot
ext <- drawExtent()
## these can be created manually with xmin,xmax,ymin,ymax
## ext <- extent(-100, 150, -75, -30)
## now read a big chunk of data for this small region
dts <- seq(as.Date("2001-01-03"), by = "1 week", length = 100)
sst <- readsst(dts, xylim = ext)

## End(Not run)

Topography data

Description

Functions to provide topographic (bathymetry and/or topography) data.

Usage

readtopo(
  topo = c("gebco_23", "gebco_08", "ibcso", "etopo1", "etopo2", "kerguelen",
    "smith_sandwell", "gebco_14", "macrie1100m", "macrie2100m", "cryosat2",
    "lake_superior", "ramp", "ibcso_is", "ibcso_bed", "rema_1km", "rema_200m",
    "rema_100m", "rema_8m", "gebco_19", "gebco_21"),
  polar = FALSE,
  lon180 = TRUE,
  xylim = NULL,
  returnfiles = FALSE,
  ...,
  resample = "bilinear"
)

readbathy(
  topo = c("gebco_23", "gebco_08", "ibcso", "etopo1", "etopo2", "kerguelen",
    "smith_sandwell", "gebco_14", "macrie1100m", "macrie2100m", "cryosat2",
    "lake_superior", "ramp", "ibcso_is", "ibcso_bed", "rema_1km", "rema_200m",
    "rema_100m", "rema_8m", "gebco_19", "gebco_21"),
  polar = FALSE,
  lon180 = TRUE,
  xylim = NULL,
  returnfiles = FALSE,
  ...,
  resample = "bilinear"
)

topofile(
  topo = c("gebco_23", "gebco_08", "ibcso", "etopo1", "etopo2", "kerguelen",
    "smith_sandwell", "gebco_14", "macrie1100m", "macrie2100m", "cryosat2",
    "lake_superior", "ramp", "ibcso_is", "ibcso_bed", "rema_1km", "rema_200m",
    "rema_100m", "rema_8m", "gebco_19", "gebco_21"),
  polar = FALSE,
  lon180 = TRUE,
  ...
)

read_rema_tiles(...)

Arguments

topo

Data source, see Details.

polar

Flag for returning the polar version of the IBCSO data.

lon180

Flag for returning data in Atlantic -180, 180 rather than Pacific 0, 360 view.

xylim

spatial extents or raster grid to crop from source data, see Details

returnfiles

Return just the relevant file name

...

reserved for future use, ignored currently

resample

method to use for GDAL warper resampling (currently via terra), the 'method' argument to 'project()'

Details

Use readtopo (or its alias readbathy) to read data from the chosen data set. The function topofile is used to find the full file name.

readtopo() and readbathy() accept terra::ext or raster::extent or just numeric objects for 'xylim'. Alternatively these can be a terra SpatRaster or a raster BasicRaster (RasterLayer, RasterBrick, or RasterStack) as a template target raster for crop and resize, or reprojection to new raster grid. The 'resample' argument controls the kind of sampling when regridded or warped. (i.e. if xylim is extent, you get crop(), if it's a grid, it is remodelled to the grid. extent doesn't need crs, grid does). The following data sets are available using the argument topo.

gebco_23

The GEBCO grid, 2023 version "ice surface"

gebco_08

The GEBCO_08 Grid, a global 30 arc-second grid largely generated by combining quality-controlled ship depth soundings with interpolation between sounding points guided by satellite-derived gravity data. http://www.gebco.net/data_and_products/gridded_bathymetry_data/

ibcso

IBCSO bathymetry data, resolution 1min, use argument polar = TRUE to return the projected version (polar stereographic with true scale at 71S, WGS84), 500m resolution. http://www.ibcso.org/data.html. Default is Ice Surface 'ibcso_is', use 'ibcso_bed' for Bedrock.

etopo1

ETOPO1 is a 1 arc-minute global relief model of Earth's surface that integrates land topography and ocean bathymetry. http://www.ngdc.noaa.gov/mgg/global/global.html

etopo2

Historic and deprecated prior version of ETOPO1. http://www.ngdc.noaa.gov/mgg/global/etopo2.html

kerguelen

Kerguelen Plateau Bathymetric Grid, https://data.gov.au/dataset/ds-ga-a05f7893-007f-7506-e044-00144fdd4fa6/details?q=

george_v_terre_adelie

A bathymetric Digital Elevation Model (DEM) of the George V and Terre Adelie continental shelf and margin - 100, 250, and 500 metre resolution. http://data.aad.gov.au/aadc/metadata/metadata_redirect.cfm?md=AMD/AU/GVdem_2008

smith_sandwell

Global seafloor topography from satellite altimetry and ship depth soundings. http://topex.ucsd.edu/WWW_html/mar_topo.html

cryosat2

Antarctica CryoSat-2 Digital Elevation Model (DEM). https://earth.esa.int/web/guest/missions/esa-operational-eo-missions/cryosat

lake_superior

Bathymetry of Lake Superior https://www.ngdc.noaa.gov/mgg/greatlakes/superior.html

ramp

Radarsat Antarctic digital elevation model V2 https://github.com/AustralianAntarcticDivision/blueant#radarsat-antarctic-digital-elevation-model-v2

ga_srtm

Digital Elevation Model (DEM) of Australia with 1 Second Grid

rema_1km, rema_200m, rema_100m, rema_8m

Reference Elevation Model of Antartica (REMA) for the peninsula, see read_rema_tiles for the index

gebco_19

GEBCO_2019 Grid https://www.gebco.net/data_and_products/gridded_bathymetry_data/gebco_2019/gebco_2019_info.html

Value

topofile returns a character string of the full path to a file name

readtopo and readbathy return the requested data as a RasterLayer (these are aliases)


readwind

Description

Read wind

Usage

readwind(
  date,
  time.resolution = c("6hourly"),
  xylim = NULL,
  lon180 = TRUE,
  magonly = FALSE,
  dironly = FALSE,
  uonly = FALSE,
  vonly = FALSE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read,

time.resolution

time resoution data to read, daily or monthly

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

lon180

defaults to TRUE, to "rotate" Pacific view 0, 360 data to Atlantic view -180, 180

magonly

return just the magnitude from the U and V components

dironly

return just the direction from the U and V, in degrees N=0, E=90, S=180, W=270

uonly

return just the horizontal component of velocity, U

vonly

return just the vertical component of velocity, V

latest

if TRUE (and date not supplied) return the latest time available

returnfiles

ignore options and just return the file names and dates

...

Arguments passed on to raadtools

setNA

mask out land values (only applies to monthly time.resolution)

inputfiles

input the files data base to speed up initialization

Details

Read wind data

The inputfiles argument may be used to speed up individual reads, see the examples. Note that this must then ignore the time.resolution argument, which is also set by windfiles - and no warning is given. If using this argument you must give the same time.resolution as was used to create the files data.frame.

Value

raster object

Examples

# Speed up individual read calls. 
ff <- windfiles(time.resolution = "6hourly")
t1 <- system.time({readwind(max(ff$date))})
t2 <- system.time({readwind(max(ff$date), inputfiles = ff)})
## Not run: 
 dts <- seq(as.Date("2000-01-01"), by = "1 days", length = 350)
 library(animation)
 ani.start(ani.width = 800, ani.height = 800)
 for (i in seq_along(dts)) {
    x <- readwind(dts[i]);
    if (i == 1L) crds <- coordinates(x[[1]])
    plot(sqrt(x[[1]]^2 + x[[2]]^2), xlim = c(40, 180), ylim = c(-90, -20));
x1 <- crds[,1]
y1 <- crds[,2]
x2 <- crds[,1] + values(x[[1]])/4
y2 <- crds[,2] + values(x[[2]])/4
    arrows(x1, y1, x2, y2, length = 0.06);
    plot(m, add = TRUE)
}
ani.stop()




## End(Not run)

SMAP sea surface temperature files

Description

Load file names and dates of SMAP sea surface salinity

Usage

salfiles(time.resolution = c("daily"), ...)

Arguments

time.resolution

time resolution read

...

reserved for future use, currently ignored

Details

A data frame of file names and dates.

Only a short period of daily data is available, from '2015-03-27' to '2018-10-21'.

Value

data.frame of file names and dates


Set the file system locations where data are stored

Description

This is a convenience wrapper around the corresponding admin functions in the raadfiles package, so that most users will not need to use those functions directly. This function tells raadtools where to look for its data files, (by default) will build the necessary file list cache if it does not exist, and loads that cache into memory so that raadtools can use it.

Usage

set_data_roots(..., build_cache_if_missing = TRUE, refresh_cache = FALSE)

get_data_roots()

Arguments

...

strings: one or more paths to directories containing data

build_cache_if_missing

logical: raadtools maintains a cache that lists all of files in each data collection. If build_cache_if_missing is TRUE, a cache will be built if it does not exist

refresh_cache

logical: for each path, should the file collection be re-scanned and the cache rebuilt? (May be slow)

Value

TRUE (invisibly) on success

Examples

## Not run: 
## assume that we have downloaded some data files to c:/my/data
library(raadtools)
set_data_roots("c:/my/data")
## see the README/vignette for more detail

## End(Not run)

SOSE varnames

Description

Available variable names from SOSE.

Usage

sose_monthly_varnames(iteration = "")

Details

These varnames can be used in read_sose(varname = ).

Value

chacter vector

Examples

sose_monthly_varnames()

AVISO sea surface height / anomaly files

Description

Load file names and dates of AVISO SSH/SSHA data

Usage

sshfiles(time.resolution = c("daily"), ...)

Arguments

time.resolution

set to daily only

...

reserved for future use, currently ignored

Details

A data.frame of file names and dates

Value

data.frame of file names and dates

See Also

readssh


SST colours

Description

SST colours

Usage

sst.pal(x, palette = FALSE, alpha = 1)

Arguments

x

a vector of data values or a single number

palette

logical, if TRUE return a list with matching colours and values

alpha

value in 0,1 to specify opacity

Value

colours, palette, or function, see Details

References

Derived from "http://oceancolor.gsfc.nasa.gov/DOCS/palette_sst.txt.


OISST sea surface temperature files

Description

Load file names and dates of OISST sea surface temperature data

Usage

sstfiles(time.resolution = c("daily", "monthly"), ...)

Arguments

time.resolution

time resolution read

...

reserved for future use, currently ignored

Details

A data frame of file names and datres

Value

data.frame of file names and dates


Stations locations

Description

In polar stereographic, with longitude and latitude and name as attributes.

Details

Obtained with antanym

Examples

plot(readice())
plot(stations, add = TRUE)

Read surface currents as table

Description

Read meridional and zonal components of surface currents (m/s) from altimetry products. Input is optional, with date and xylim. As with the grid reading functions read_ugos_daily and read_vgos_daily this by default will return the latest data available and for the entire world.

Usage

table_uvgos(
  date,
  xylim = NULL,
  ...,
  xy = TRUE,
  cell = FALSE,
  na.rm = TRUE,
  latest = TRUE,
  res = NULL
)

Arguments

date

dates to read

xylim

extent of data to read

...

arguments passed to read functions (only lon180 relevant)

xy

include coordinates of cell in the output, TRUE by default

cell

include cell index in the output, FALSE by default

na.rm

by default missing values are removed, set to FALSE to keep all

Details

Please note that the coordinates are in longitude latitude, but the velocity components are in m/s. You cannot meaningfully transform the x,y coordinates and use the velocity components without taking into account rotation in the transformation (we might write some helpers for this ...).

Argument lon180 may be used to specify Pacific or Atlantic orientation.

Value

data frame of u, v, x,y (longitude,latitude), cell, and date

Examples

uv <- table_uvgos("2001-01-01", xylim = extent(60, 120, -60, -10))
plot(range(uv$x), range(uv$y), type = "n", asp = 1.1)
scal <- function(x) (x - min(x, na.rm = TRUE))/diff(range(x, na.rm = TRUE))
nn <- 56
arrows(uv$x, uv$y, uv$x + uv$u, uv$y + uv$v, col = grey.colors(nn)[scal(sqrt(uv$u^2 + uv$v^2)) * (nn-1) + 1], length = 0)

Stable conversion to POSIXct from character and Date

Description

Conversion to POSIXct ensuring no local time zone applied. Currently supported is character, Date and anything understood by as.POSIXct.

Usage

timedateFrom(x, ...)

Arguments

x

input date-time stamp, character, Date or other supported type.

...

ignored

Value

the vector x converted (if necessary) to POSIXct


Files containing NCEP2 wind vector data

Description

NCEP2 wind files

Usage

windfiles(data.source = "", time.resolution = c("6hourly"), ...)

Arguments

data.source

ignored, reserved for future use

time.resolution

time resolution data to read, 6hourly only for now

...

reserved for future use, currently ignored

Details

Files containing NCEP2 wind vector data

Value

data.frame of file names and dates