calcGrid {agroclim}R Documentation

Calculation of indices over gridded datasets

Description

Calculates any of the agroclimatic indices over a multidimensional dataset

Usage

calcGrid(mxnc = NULL, mnnc = NULL, varnametx = NULL,
  varnametn = NULL, fun, inienddays, dates, ncpu = 2,
  out = "test.nc", ...)

Arguments

mxnc

a path to a NetCDF file(s) with maximum temperature data.

mnnc

a path to a NetCDF file(s) with minimum temperature data.

varnametx

a character string specifying the name of the variable to extract in maximum temperature NetCDF file.

varnametn

a character string specifying the name of the variable to extract in minimum temperature NetCDF file.

fun

name of the function to apply over the netcdf file.

inienddays

character vector indicating the initial and ending dates in which the input data must be splitted. Dates must be provided in format "YYY-MM-DD".

dates

vector of dates corresponding with daily temprature series.

ncpu

number of parallel processes to spawn for the use for parallel computation in multiple cores.

out

name of the NetCDF file where results will be saved (extension ".nc" must be included).

...

specific arguments matching the arguments of the target funcion.

Details

The "inienddays" argument only works if the input daily temperature ncdf file includes the time dimension in the format of "days since YYY-MM-DD". Otherwise, the function will return an error. All the arguments of the target function (function to be applied over the ncdf) must be stated ("...") or an unespecified error will appear. The function uses the argument "ncpu" to split the tasks into different cores taking advantage of the hardware.

Value

A NetCDF file is created in the path specified in the "out" parameter.

Examples


 calcGrid(mxnc = NULL, mnnc = 'tmin.nc', varnametn = 'tn', fun = 'frostProb', 
          inienddays = NULL, dates = dates, ncpu = 4,  
          out = 'fd_prob.nc', iniday = '07-01', endday = '06-30', 
          type = 'doy', thres = 0, prob = 0.10)


[Package agroclim version 0.1.0 Index]