Skip to contents

This function converts a netcdf object to a raster object

Usage

nc_to_raster(
  nc,
  varname,
  extent = c(0, 360, -90, 90),
  crop = raster::extent(280, 300, 30, 50),
  show_images = FALSE
)

Arguments

nc

The nc file path

varname

The name of the variable to convert to a raster

extent

The latitude and longitude range the data should have, of the form c(xmin, xmax, ymin, ymax). Defaults to c(0, 360, -90, 90)

crop

An extent object to use to crop data. Defaults to raster::extent(280, 300, 30, 50) (Northeast US)

show_images

Boolean. Whether to display images of the data. Useful to check if cropping is occurring correctly.

Value

A raster brick