AggGEE: R6 Class for aggregating GEE data

AggGEER Documentation

R6 Class for aggregating GEE data

Description

R6 Class for executing the OFPE data aggregation process that consolidates data from Google Earth Engine to on-farm data. This is used within the 'AggDat' R6 class.

Public fields

aggInputs

An object of the 'AggInputs' class containaing the options for aggregating data. This includes the database connection.

farmidx

The ID of the farm in which the field falls within.

farmeridx

The ID of the farmer that owns the farm that the field falls within.

PY

The year prior to the selected year of interest (cy_resp). This differs from the previous crop year used prior.

PY2

The year two years prior to the selected year of interest (cy_resp).

labels

The labels of the GEE covariates that are collected and aggregated.

type

The type of data corresponding to each respective label.

SOURCE

The SOURCE of data corresponding to each respective label.

year

The year of data to gather, corresponding to each respective label.

loy

The length of year for which to gather data for each respective label.

Methods

Public methods


Method new()

Initialize an object for executing the process of aggregating Google Earth Engine data to OFPE data. Adds necessary columns to the temporary aggregated table, sets up the necessary options for gathering and extracting GEE data.

Usage
AggGEE$new(aggInputs, farmidx, farmeridx)
Arguments
aggInputs

An 'AggInputs' R6 class with the user's aggregation options.

farmidx

The ID of the farm in which the field falls within.

farmeridx

The ID of the farmer that owns the farm that the field falls within.

Returns

An initialized 'AggGEE' object.


Method aggregateGEE()

Method for executing the aggregation of GEE data to the on-farm data within the OFPE database. First, gather the environmental variables that do not change year to year. Gather from 2015 to make sure they are there. Gather Daymet V3 and GRIDMET data, when possible, for both the current and previous year. Get current and previous year precipitation and growing degree day data. Gather vegetation index data from the current, previous, and two years prior. Do this for NDVI, NDRE, and CIRE indices. Additionally, when applicable, gather Landsat 8 and Sentinel 2 data. Because Landsat does not have the band frequencies to calculate NDRE and CIRE these are only available when Sentinel 2 data is available. If available, gather SMAP data from the current and previous year. Get the surface soil moisture and subsurface soil moisture from SMAP.

Usage
AggGEE$aggregateGEE()
Arguments
None

No arguments necessary because identified in class instantiation.

Returns

GEE data aggregated to the temporary aggregated table in the database.


Method .getGEEdata()

Method for aggregating the Google Earth Engine data to the on-farm aggregated data. Identifies the appropriate data from the 'all_farms. gee' schema and extracts the values of each raster to each point in the field. All labels, type, SOURCE etc. are identified in the GEE data original filenames exported from GEE. The dot indicates that this function would be private if not for documentations sake.

Usage
AggGEE$.getGEEdata(
  label,
  type,
  SOURCE,
  year,
  loy,
  db,
  farmidx,
  farmeridx,
  farmername
)
Arguments
label

The labels for the GEE data to aggregate.

type

The type of data to aggregate.

SOURCE

The SOURCE of the data. (i.e. Landsat vs. Sentinel etc.).

year

The year of the data to gather.

loy

The length of year to get data from (i.e. 'mar' vs. 'full').

db

Connection to an OFPE database.

farmidx

ID of the farm that the field falls within.

farmeridx

ID of the farmer that owns the farm that the field falls within.

farmername

Name of the farmer that owns the field for aggregation.

Returns

Data in temporary aggregated table.


Method clone()

The objects of this class are cloneable with this method.

Usage
AggGEE$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

DBCon for the database connection class, AggDat for the class responsible for aggregating on-farm data, AggInputs for the inputs required for the aggregation process.


paulhegedus/OFPE documentation built on Nov. 23, 2022, 5:09 a.m.