Learn R Programming

hyfo (version 1.3.4)

writeNcdf: Write to NetCDF file using hyfo list file

Description

Write to NetCDF file using hyfo list file

Usage

writeNcdf(gridData, filePath, missingValue = 1e+20, tz = "GMT",
  units = NULL)

Arguments

gridData
A hyfo list file or the list file from loadECOMS{ecomsUDG.Raccess} or loadGridData{ecomsUDG.Raccess}
filePath
A path of the new NetCDF file, should end with ".nc"
missingValue
A number representing the missing value in the NetCDF file, default is 1e20 #'
tz
A string representing the time zone, default is GMT, if you know what time zone is you can assign it in the argument. If tz = '', current time zone will be taken.
units
A string showing in which unit you are putting in the NetCDF file, it can be seconds or days and so on. If not specified, the function will pick up the possible largest time units from c('weeks', 'days', 'hours', 'mins', 'secs')

Value

  • An NetCDF version 3 file.

References

  • #' David Pierce (2014). ncdf: Interface to Unidata netCDF data files. R package version 1.6.8. http://CRAN.R-project.org/package=ncdf
  • Santander MetGroup (2015). ecomsUDG.Raccess: R interface to the ECOMS User Data Gateway. R package version 2.2-6. http://meteo.unican.es/ecoms-udg

Examples

Run this code
# First open the test NETcDF file.
filePath <- system.file("extdata", "tnc.nc", package = "hyfo")


# Then if you don't know the variable name, you can use \\code{getNcdfVar} to get variable name
varname <- getNcdfVar(filePath)

nc <- loadNcdf(filePath, varname)

# Then write to your work directory

writeNcdf(nc, 'test.nc')

# More examples can be found in the user manual on http://yuanchao-xu.github.io/hyfo/

Run the code above in your browser using DataLab