Title: | Reading Data from NetCDF Files for 'REddyProc' |
---|---|
Description: | Extension to 'REddyProc' that allows reading data from netCDF files. |
Authors: | Department for Biogeochemical Integration at MPI-BGC, Jena, Germany [cph], Thomas Wutzler [aut, cre], Antje Maria Moffat [aut, trl] |
Maintainer: | Thomas Wutzler <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1.4 |
Built: | 2024-11-26 03:06:39 UTC |
Source: | https://github.com/bgctw/reddyprocncdf |
This package enhances REddyProc a package for standard and extensible Eddy-Covariance data post-processing includes uStar-filtering, gap-filling, and flux-partitioning. A general description and an online tool based on this REddyProc can be found here: https://www.bgc-jena.mpg.de/bgi/index.php/Services/REddyProcWeb.
This package adds functionality to read data from netCDF files.
Reading data from NetCDF files was formerly part of REddyProc, but has been factored to this own package to decrease the number of dependencies in REddyProc.
The main functions
Reading standard data from a NetCDF file: fLoadFluxNCIntoDataframe
Reading a specific variable from a NetCDF file: fAddNCFVar
The package works with alternative backend-packages that are installed.
For the default is the first entry of argument packageNames
in requireNetCDFPackage
.
If the preference order for a specific package is changed, provide argument
use: prefNcPkg = requireNetCDFPackage(myPreferenceNameVector)
and
subsequently specify argument ncPkg = prefNcPkg
to other functions.
Time may be stored in different formats, and fLoadFluxNCIntoDataframe
is parameterized by a argument fReadTime
.
The following functions are provided to construct time from different formats:
These functions help with the preparation of your data for the analysis:
from columnns 'year',...,'hour': fReadTimeSeveralCols
from column in ISODate integer format: fReadTimeBerkeley
Further functionality.
Get site information from BGI NetCDF files: fLoadFluxNCInfo
Department for Biogeochemical Integration at MPI-BGC, Jena, Germany
Add variable from NetCDF file to data frame
fAddNCFVar(data, varNames, fileName, ncPkg = requireNetCDFPackage(), callingFunction = "", varRenames = varNames, ...)
fAddNCFVar(data, varNames, fileName, ncPkg = requireNetCDFPackage(), callingFunction = "", varRenames = varNames, ...)
data |
Data frame |
varNames |
Variable name or names (vector of strings) |
fileName |
NetCDF file name as a string |
ncPkg |
scalar string of package name to be used to be tried to used in this order |
callingFunction |
Name (string) of function called from |
varRenames |
Name (string) of the variable in data, offer renaming |
... |
further arguments to var.get.nc or ncvar_get , such as start and count |
Data frame with new nc variable added.
AMM, KS, TW Department for Biogeochemical Integration at MPI-BGC, Jena, Germany <[email protected]> [cph], Thomas Wutzler <[email protected]> [aut, cre], Antje Maria Moffat <[email protected]> [aut, trl]
Load site information attributes such as latitude, longitude and others from BGI NetCDF files
fLoadFluxNCInfo(fileName, ncPkg = requireNetCDFPackage(), callingFunction = "")
fLoadFluxNCInfo(fileName, ncPkg = requireNetCDFPackage(), callingFunction = "")
fileName |
NetCDF file name as a string |
ncPkg |
scalar string of package name to be used |
callingFunction |
Name (string) of function called from |
Description of attribute list:
SiteID
Number of data rows
Longitude
Latitude
Time zone
Elevation
IGBP class
Attibute list
AMM, TW Department for Biogeochemical Integration at MPI-BGC, Jena, Germany <[email protected]> [cph], Thomas Wutzler <[email protected]> [aut, cre], Antje Maria Moffat <[email protected]> [aut, trl]
Load specified variables and time stamp information from NetCDF file in Fluxnet BGI format. The time stamp information needs to be provided as variables 'year', 'month', 'day', 'hour'.
fLoadFluxNCIntoDataframe(varNames, fileName, ncPkg = requireNetCDFPackage(), fReadTime = fReadTimeSeveralCols, ...)
fLoadFluxNCIntoDataframe(varNames, fileName, ncPkg = requireNetCDFPackage(), fReadTime = fReadTimeSeveralCols, ...)
varNames |
string vector of variables to be read in |
fileName |
File name as a string |
ncPkg |
scalar string of package name to be used |
fReadTime |
function that reads time columns
It must append columns year (from 0AD), month, day, and hour (fractional)
See |
... |
further arguments to var.get.nc or ncvar_get, such as start and count |
Data frame with data from nc file.
AMM, KS, TW Department for Biogeochemical Integration at MPI-BGC, Jena, Germany <[email protected]> [cph], Thomas Wutzler <[email protected]> [aut, cre], Antje Maria Moffat <[email protected]> [aut, trl]
examplePath <- system.file( file.path('examples','Example_DE-Tha.1996.1998.hourly_selVars.nc') , package = "REddyProcNCDF") EddyNCData <- fLoadFluxNCIntoDataframe(c('NEE', 'Rg', 'NEE_f'), examplePath)
examplePath <- system.file( file.path('examples','Example_DE-Tha.1996.1998.hourly_selVars.nc') , package = "REddyProcNCDF") EddyNCData <- fLoadFluxNCIntoDataframe(c('NEE', 'Rg', 'NEE_f'), examplePath)
Reads time columns (year, month, day, hour) from column in ISODate integer format
fReadTimeBerkeley(data, fileName, ncPkg = requireNetCDFPackage(), callingFunction = "", colTime = "TIMESTAMP_END", ...)
fReadTimeBerkeley(data, fileName, ncPkg = requireNetCDFPackage(), callingFunction = "", colTime = "TIMESTAMP_END", ...)
data |
Data frame |
fileName |
NetCDF file name as a string |
ncPkg |
scalar string of package name to be used |
callingFunction |
Name (string) of function called from |
colTime |
the column name (string) holding time with format described in details |
... |
further arguments to var.get.nc or ncvar_get, such as start and count |
In the Berkeley-Release of the fluxnet data, the time is stored as an integer with base10-digits representing YYYYMMddhhmm
Department for Biogeochemical Integration at MPI-BGC, Jena, Germany <[email protected]> [cph], Thomas Wutzler <[email protected]> [aut, cre], Antje Maria Moffat <[email protected]> [aut, trl]
Constructing time from columnns 'year',...,'hour'
fReadTimeSeveralCols(data, fileName, ncPkg = requireNetCDFPackage(), callingFunction = "", colYear = "year", colMonth = "month", colDay = "day", colHour = "hour", defaultHour = 0, ...)
fReadTimeSeveralCols(data, fileName, ncPkg = requireNetCDFPackage(), callingFunction = "", colYear = "year", colMonth = "month", colDay = "day", colHour = "hour", defaultHour = 0, ...)
data |
Data frame |
fileName |
NetCDF file name as a string |
ncPkg |
scalar string of package name to be used |
callingFunction |
Name (string) of function called from |
colYear |
Name (string) of variable holding the year |
colMonth |
Name (string) of variable holding the month |
colDay |
Name (string) of variable holding the day |
colHour |
Name (string) of variable holding the hour |
defaultHour |
(numeric) default that is used when colHour = NA , when only days are specified |
... |
further arguments to var.get.nc or ncvar_get , such as start and count |
Time may be stored in different formats, and fLoadFluxNCIntoDataframe
is parameterized by a argument fReadTime
.
The following functions are provided to construct time from different formats:
These functions help with the preparation of your data for the analysis:
from columnns 'year',...,'hour': fReadTimeSeveralCols (this function)
from column in ISODate integer format: fReadTimeBerkeley
Department for Biogeochemical Integration at MPI-BGC, Jena, Germany <[email protected]> [cph], Thomas Wutzler <[email protected]> [aut, cre], Antje Maria Moffat <[email protected]> [aut, trl]
require namespace of given NetCDF package
requireNetCDFPackage(packageNames = c("RNetCDF", "ncdf4"))
requireNetCDFPackage(packageNames = c("RNetCDF", "ncdf4"))
packageNames |
string vector: Name of R NetCDF packages to be tried to used in this order |
currently 'RNetCDF' and 'ncdf4' are supported Loading package namespace is tried in the order of occurence in packageNames
The package name whose namespace has been loaded
Department for Biogeochemical Integration at MPI-BGC, Jena, Germany <[email protected]> [cph], Thomas Wutzler <[email protected]> [aut, cre], Antje Maria Moffat <[email protected]> [aut, trl]