Sea ice at 25km for either hemisphere.

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"

Value

raster object

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'.

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")
#> class      : RasterLayer 
#> dimensions : 332, 316, 104912  (nrow, ncol, ncell)
#> resolution : 25000, 25000  (x, y)
#> extent     : -3950000, 3950000, -3950000, 4350000  (xmin, xmax, ymin, ymax)
#> crs        : +proj=stere +lat_0=-90 +lat_ts=-70 +lon_0=0 +x_0=0 +y_0=0 +a=6378273 +rf=298.279411123061 +units=m +no_defs 
#> source     : memory
#> names      : layer 
#> values     : 0.4, 100  (min, max)
#> time       : 2023-02-01 11:00:00 
#> 
readice(hemisphere = "north")
#> class      : RasterLayer 
#> dimensions : 448, 304, 136192  (nrow, ncol, ncell)
#> resolution : 25000, 25000  (x, y)
#> extent     : -3850000, 3750000, -5350000, 5850000  (xmin, xmax, ymin, ymax)
#> crs        : +proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +x_0=0 +y_0=0 +a=6378273 +rf=298.279411123061 +units=m +no_defs 
#> source     : memory
#> names      : layer 
#> values     : 0.4, 100  (min, max)
#> time       : 2023-02-01 11:00:00 
#> 
## or we can read both, and get longlat by default
readice(hemisphere = "both")
#> for both hemispheres, 'xylim' may be specified - assuming global longlat at 0.25 degree
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'brick': the condition has length > 1
## 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)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'brick': the condition has length > 1

## 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