nc_clip: Clip a netcdf file

Description Usage Arguments Value Examples

View source: R/clip.R

Description

Clip a netcdf file to a specific latlon box

Usage

1
2
3
4
nc_clip(ff, vars = NULL, lon_range = c(-180, 180), lat_range = c(-90,
  90), vert_range = NULL, date_range = NULL, months = NULL,
  years = NULL, out_file = NULL, cdo_output = FALSE,
  zip_file = FALSE, overwrite = FALSE)

Arguments

ff

This is the file to clip.

vars

Select the variables you want. If this is not given, all variables will be regridded.

lon_range

longitude range. c(min_longituse, max_longitude).

lat_range

latitude range. c(min_latitude, max_latitude).

vert_range

This is the range of depths for vertical clipping, if wanted. c(min_depth, max_depth)

date_range

This is the range of dates you want. c(date_min, date_max). "day/month/year" character string format.

months

Months you want. c(month_1, month_2,...). Coerced to integer if numeric.

years

Months you want. c(year_1, year_2,...). Coerced to integer if numeric.

out_file

The name of the file output. If this is not stated, a data frame will be the output.

cdo_output

set to TRUE if you want to see the cdo output

zip_file

Do you want any output file to be zipped to save space. Default is FALSE.

overwrite

Do you want to overwrite out_file if it exists? Defaults to FALSE

Value

data frame or netcdf file.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Clipping data from the NOAA World Ocean Atlas sample file.
ff <- system.file("extdata", "woa18_decav_t01_01.nc", package = "rcdo")

# clip to a specific depth range using vert_range

nc_clip(ff, vert_range = c(1, 5))

# clip to a specific longitude and latitude box
# Clipping to the region around the UK

uk_sst <- nc_clip(ff, lon_range = c(-12, 10), lat_range = c(48, 62))

r4ecology/rcdo documentation built on July 21, 2019, 9 p.m.