Skip to contents

This function generates a spatially-aggregated indicator from a netCDF file. Has been tested with GLORYS netCDF and OCCCI ERDDAP netCDF. The function passes data through EDABUtilities::make_2d_summary_ts, which provides summary statistics of 2d gridded data as time series by area. Converts .nc files to data frame.

Usage

create_spatial_indicator(indicator_name, units, ...)

Arguments

indicator_name

name of the indicator (character)

units

units associated with the indicator (character)

...

passed to EDABUtilities::make_2d_summary_ts

data.in

Either a character vector of full input file names for a list of spatRasters

output.files

character vector of full output file names corresponding to each input file

shp.file

string. Shape file you wish to crop each input file to

var.name

string. Variable name you wish to extract.

area.names

character vector. Names of shape file areas you want to summarize.

statistic

string. Which statistic to calculate = 'mean'

agg.time

character. Time scale to calculate over (days, doy, months, season, or years)

tz

string. Time zone to convert. No correction if NA

touches

logical. If TRUE, all cells touched by lines or polygons will be masked, not just those on the line render path, or whose center point is within the polygon

write.out

logical. If TRUE, will write a netCDF file with output.files. If FALSE will return a list of spatRasters

Value

Returns a data frame summarized by timestep for each area.names