nc_remap: Horizontally and vertically remap a ncdf file

Description Usage Arguments Value Examples

View source: R/remap.R

Description

This function allows you to remap a netcdf horizontally and vertically to any set of latlon coordinates.

Usage

1
2
3
nc_remap(ff, vars = NULL, coords = NULL, vert_depths = NULL,
  out_file = NULL, zip_file = FALSE, cdo_output = FALSE,
  remapping = "bil", na_value = NULL, overwrite = FALSE, ...)

Arguments

ff

This is the file to regrid.

vars

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

coords

A 2 column matrix or data frame of the form (longitude, latitude) with coordinates for regridding. This can be regular or irregular. The function will calculate which it is.

out_file

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

zip_file

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

cdo_output

set to TRUE if you want to see the cdo output

remapping

The type of remapping. bil = bilinear. nn = nearest neighbour. dis = distance weighted.

na_value

This is a value in the raw netcdf file that needs to be treated as an na.#'

overwrite

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

...

optional arguments to be sent to nc_clip if you need to clip prior to remapping.#'

Value

data frame or netcdf file.

Examples

1
2
3
4
5
6
7
8
# Remapping NOAA world ocean atlas data to the region around the UK
ff <- system.file("extdata", "woa18_decav_t01_01.nc", package = "rcdo")
# remapping to 1 degree resolution across all depth layers
uk_coords <- expand.grid(Longitude = seq(-20, 10, 1), Latitude = seq(48, 62, 1))
nc_remap(ff, vars = "t_an", coords = uk_coords)

# remapping to 1 degree resolution for 5, 50 and 100 metres in the region around the uk
nc_remap(ff, vars = "t_an", coords = uk_coords, vert_depths = c(5, 50, 100))

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