writeNcdf function

Write to NetCDF file using hyfo list file

Write to NetCDF file using hyfo list file

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

Arguments

  • gridData: A hyfo list file from loadNcdf
  • 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 #' @param 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.
  • tz: time zone, default is "GMT"
  • 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')
  • version: ncdf file versions, default is 3, if 4 is chosen, output file will be foreced to version 4.

Returns

An NetCDF version 3 file.

Examples

# 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 ## Not run: writeNcdf(nc, 'test.nc') ## End(Not run) # More examples can be found in the user manual on https://yuanchao-xu.github.io/hyfo/

References

Other functions in hyfo

Related functions from the same R package

  • Maintainer: Yuanchao Xu
  • License: GPL-2
  • Last published: 2023-08-16