HiClimR2nc {HiClimR} | R Documentation |
Export NetCDF-4 file for Hierarchical Climate Regionalization
Description
HiClimR2nc
is a helper function that exports region map
and mean timeseries into NetCDF-4 file, using the ncdf4
package.
Usage
HiClimR2nc(y = NULL, ncfile = "HiClimR.nc", timeunit = "", dataunit = "")
Arguments
y |
a dendrogram tree produced by |
ncfile |
Path and name of the NetCDF-4 file to be created. |
timeunit |
an optional character string for the time units,
A zero-length string (default: |
dataunit |
an optional character string for the data units,
A zero-length string (default: |
Details
HiClimR2nc
function exports region map and mean timeseries
from HiClimR
tree into NetCDF-4 file, using the ncdf4
package.
The NetCDF-4 file will be open to add other variables, if needed.
It is important to close the created file using nc_close
,
which flushes any unwritten data to disk.
Value
An object of class ncdf4
, which has the fields described in nc_open
.
Author(s)
Hamada S. Badr <badr@jhu.edu>, Benjamin F. Zaitchik <zaitchik@jhu.edu>, and Amin K. Dezfuli <amin.dezfuli@nasa.gov>.
References
Hamada S. Badr, Zaitchik, B. F. and Dezfuli, A. K. (2015): A Tool for Hierarchical Climate Regionalization, Earth Science Informatics, 8(4), 949-958, doi: 10.1007/s12145-015-0221-7.
Hamada S. Badr, Zaitchik, B. F. and Dezfuli, A. K. (2014): Hierarchical Climate Regionalization, Comprehensive R Archive Network (CRAN), https://cran.r-project.org/package=HiClimR.
See Also
HiClimR
, HiClimR2nc
, validClimR
,
geogMask
, coarseR
, fastCor
,
grid2D
and minSigCor
.
Examples
require(HiClimR)
require(ncdf4)
## Load test case data
x <- TestCase$x
## Generate longitude and latitude mesh vectors
xGrid <- grid2D(lon = unique(TestCase$lon), lat = unique(TestCase$lat))
lon <- c(xGrid$lon)
lat <- c(xGrid$lat)
## Hierarchical Climate Regionalization
y <- HiClimR(x, lon = lon, lat = lat, lonStep = 1, latStep = 1, geogMask = FALSE,
continent = "Africa", meanThresh = 10, varThresh = 0, detrend = TRUE,
standardize = TRUE, nPC = NULL, method = "ward", hybrid = FALSE,
kH = NULL, members = NULL, validClimR = TRUE, k = 12, minSize = 1,
alpha = 0.01, plot = TRUE, colPalette = NULL, hang = -1, labels = FALSE)
## Not run:
## Export region map and mean timeseries into NetCDF-4 file
y.nc <- HiClimR2nc(y=y, ncfile="HiClimR.nc", timeunit="years", dataunit="mm")
## The NetCDF-4 file is still open to add other variables or close it
nc_close(y.nc)
## End(Not run)