write_interpolator: Write the interpolator object

View source: R/tidy_interpolator.R

write_interpolatorR Documentation

Write the interpolator object

Description

Write the interpolator object to a file

Usage

write_interpolator(
  interpolator,
  filename,
  .overwrite = FALSE,
  .verbose = getOption("meteoland_verbosity", TRUE)
)

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

.verbose

Logical indicating if the function must show messages and info. Default value checks "meteoland_verbosity" option and if not set, defaults to TRUE. It can be turned off for the function with FALSE, or session wide with options(meteoland_verbosity = FALSE)

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

Value

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

Author(s)

Victor Granda García, EMF-CREAF

See Also

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

Examples



# 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"))



meteoland documentation built on Dec. 12, 2025, 9:07 a.m.