Type: Package
Title: Download Sea Ice Concentration Data from the NSIDC Climate Data Record
Version: 1.0.0
Description: Programmatic access to NSIDC's sea ice concentration CDR versions 4 and 5 via its ERDAPP server. Supports caching results and optional fixes for some inconsistencies of the raw files.
License: MIT + file LICENSE
Encoding: UTF-8
Depends: R (≥ 4.3.0)
RoxygenNote: 7.3.3
Suggests: here, ncdf4, rcdo, testthat (≥ 3.0.0), vcr
Imports: checkmate, cli, digest, glue, httr2, rlang
URL: https://github.com/eliocamp/icecdr
BugReports: https://github.com/eliocamp/icecdr/issues
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-03-10 03:28:36 UTC; user1
Author: Elio Campitelli ORCID iD [cre, aut, cph]
Maintainer: Elio Campitelli <eliocampitelli@gmail.com>
Repository: CRAN
Date/Publication: 2026-03-16 16:20:09 UTC

icecdr: Download Sea Ice Concentration Data from the NSIDC Climate Data Record

Description

Programmatic access to NSIDC's sea ice concentration CDR versions 4 and 5 via its ERDAPP server. Supports caching results and optional fixes for some inconsistencies of the raw files.

Author(s)

Maintainer: Elio Campitelli eliocampitelli@gmail.com (ORCID) [copyright holder]

See Also

Useful links:


Download sea ice concentration from NSIDC Climate Data Record

Description

This is a low-level function to download data from PolarWatch's ERDDAP server.

Usage

cdr(
  date_range = c(NA, NA),
  variables = "aice",
  hemisphere = c("south", "north"),
  resolution = c("monthly", "daily"),
  date_stride = 1,
  xgrid_range = c(NA, NA),
  xgrid_stride = 1,
  ygrid_range = c(NA, NA),
  ygrid_stride = 1,
  version = 5,
  format = "nc",
  file = NULL,
  dir = tempdir(),
  use_cache = FALSE
)

Arguments

date_range

Vector of size two with the start and end dates. Supported formats are:

  • A Date or POSIXct/POSIXlt object.

  • A character vector with ISO format dates: c("2020-01-01", "2020-12-31")

  • A character vector with year-month: c("2020-01", "2020-06") (expands to first/last day of month).

  • A character vector with year only: c("2020", "2021") (expands to full year).

variables

Character vector with the variables to fetch. Valid values are

aice

CDR Sea ice concentration.

qa

Quality control flag.

stdev

Sea ice standard deviation.

interpolation_spatial

Flag for spatial interpolation.

interpolation_temporal

Flag for temporal interpolation.

aice_bt

Sea ice concentration of the Bootstrap method.

aice_nt

Sea ice concentration of the Nasa Team method.

Although not all variables are available in all versions and all resolutions. The ⁠*_nt⁠ and ⁠*_bt⁠ variables are only available in version 4 and the interpolation flags are only available for daily values.

hemisphere

Character with the hemisphere to download. Can be either "south" or "north".

resolution

Character with the temporal resolution. Can be either "monthly" or "daily".

date_stride

Numeric with the temporal stride. A number greater than 1 means to take only the nth date in the series.

xgrid_range

Numeric vector of size 2 with the range of the x dimension.

xgrid_stride

Numeric with the stride of the x dimension.

ygrid_range

Numeric vector of size 2 with the range of the y dimension.

ygrid_stride

Numeric with the stride of the y dimension.

version

Version of the dataset. Can be 4 or 5.

format

Character with the format.

file

Character with the file name to use for download. If NULL, the file name will be constructed by hashing the request URL. Requests consisting in more than one file will append a number.

dir

Directory where to download the file.

use_cache

Logical indicating whether to not perform the download if the file already exist.

Value

Path or vector of paths to the downloaded files.

Examples

## Not run: 
cdr(date_range = c("2022-01", "2022-01"),
    # Data every 7 days
    date_stride = 7,
    resolution = "daily",
    # Thin the grid by taking every other gridpoint
    xgrid_stride = 2,
    ygrid_stride = 2,
    hemisphere = "north"
    )

## End(Not run)

Convenience functions

Description

These are convenience functions to download, daily or monthly sea ice concentration data from the whole Antarctic or Arctic. For a more complete low level function, see cdr().

Usage

cdr_antarctic_monthly(
  date_range,
  variables = "aice",
  version = 5,
  file = NULL,
  dir = tempdir(),
  use_cache = FALSE
)

cdr_antarctic_daily(
  date_range,
  variables = "aice",
  version = 5,
  file = NULL,
  dir = tempdir(),
  use_cache = FALSE
)

cdr_arctic_monthly(
  date_range,
  variables = "aice",
  version = 5,
  file = NULL,
  dir = tempdir(),
  use_cache = FALSE
)

cdr_arctic_daily(
  date_range,
  variables = "aice",
  version = 5,
  file = NULL,
  dir = tempdir(),
  use_cache = FALSE
)

Arguments

date_range

Vector of size two with the start and end dates. Supported formats are:

  • A Date or POSIXct/POSIXlt object.

  • A character vector with ISO format dates: c("2020-01-01", "2020-12-31")

  • A character vector with year-month: c("2020-01", "2020-06") (expands to first/last day of month).

  • A character vector with year only: c("2020", "2021") (expands to full year).

variables

Character vector with the variables to fetch. Valid values are

aice

CDR Sea ice concentration.

qa

Quality control flag.

stdev

Sea ice standard deviation.

interpolation_spatial

Flag for spatial interpolation.

interpolation_temporal

Flag for temporal interpolation.

aice_bt

Sea ice concentration of the Bootstrap method.

aice_nt

Sea ice concentration of the Nasa Team method.

Although not all variables are available in all versions and all resolutions. The ⁠*_nt⁠ and ⁠*_bt⁠ variables are only available in version 4 and the interpolation flags are only available for daily values.

version

Version of the dataset. Can be 4 or 5.

file

Character with the file name to use for download. If NULL, the file name will be constructed by hashing the request URL. Requests consisting in more than one file will append a number.

dir

Directory where to download the file.

use_cache

Logical indicating whether to not perform the download if the file already exist.

Value

A string vector with the location of the downloaded files

Examples

## Not run: 
cdr_antarctic_monthly(c("2022-01", "2022-01"))

## End(Not run)



Minor fixes to CDR files.

Description

cdr_fix() "fixes" some inconsistencies in the raw data. It standardised variable names between versions and temporal resolutions and adds projection information to the grid definition so CDO can compute the area of each gridpoint to compute weighted means or area integrals. Both require the rcdo package and CDO installed.

Usage

cdr_fix(files, fix = c("names", "grid"))

cdr_fix_names(files)

cdr_fix_grid(files)

Arguments

files

Path to the files.

fix

Character vector with the fixes to implement.

Details

cdr_fix_names() and cdr_fix_grid() are aliases for cdr_fix(fix = "names") and cdr_fix(fix = "grid"), respectively. Using cdr_fix() to fix both at the same time is more efficient as it recreates each file only once.

Value

The path to the modified files.

Examples

## Not run: 
cdr_antarctic_monthly(c("2022-01", "2022-01")) |>
  cdr_fix()

## End(Not run)

mirror server hosted at Truenetwork, Russian Federation.