Learn R Programming

meteoland (version 2.2.2)

write_interpolator: Write the interpolator object

Description

Write the interpolator object to a file

Usage

write_interpolator(interpolator, filename, .overwrite = FALSE)

Value

invisible interpolator object, to allow using this function as a step in a pipe

Arguments

interpolator

meteoland interpolator object, as created by create_meteo_interpolator

filename

file name for the interpolator nc file

.overwrite

logical indicating if the file should be overwritten if it already exists

Author

Victor Granda García, EMF-CREAF

Details

This function writes the interpolator object created with create_meteo_interpolator in a NetCDF-CF standard compliant format, as specified in https://cfconventions.org/cf-conventions/cf-conventions.html

See Also

Other interpolator functions: add_topo(), create_meteo_interpolator(), get_interpolation_params(), read_interpolator(), set_interpolation_params(), with_meteo()

Examples

Run this code

# \donttest{
# example interpolator
data(meteoland_interpolator_example)

# temporal folder
tmp_dir <- tempdir()

# write interpolator
write_interpolator(
  meteoland_interpolator_example,
  file.path(tmp_dir, "meteoland_interpolator_example.nc"),
  .overwrite = TRUE
)

# check file exists
file.exists(file.path(tmp_dir, "meteoland_interpolator_example.nc"))

# read it again
read_interpolator(file.path(tmp_dir, "meteoland_interpolator_example.nc"))
# }

Run the code above in your browser using DataLab