csv_to_netcdf: CSV to NetCDF Function

View source: R/rIACI.R

csv_to_netcdfR Documentation

CSV to NetCDF Function

Description

Merges CSV files in a specified directory into a single NetCDF file, completing the grid by filling missing values.

Usage

csv_to_netcdf(csv_dir, output_file, freq)

Arguments

csv_dir

Character. Directory containing CSV files, each file representing a single latitude-longitude point. The filename format should be 'lat_lon.csv'.

output_file

Character. Path to the output NetCDF file.

freq

Character. Frequency of the data, either ''monthly'‘ or '’seasonal''. - ''monthly'‘ data uses date format '’YYYY-MM''. - ''seasonal'‘ data uses date format like '’YYYY-SSS'‘ (e.g., '’1961-DJF'').

Value

None. The NetCDF file is saved to the specified location.

Examples

## Not run: 
# Example usage of csv_to_netcdf
csv_directory <- "/path/to/csv_files"
output_netcdf_file <- "/path/to/output_file.nc"
csv_to_netcdf(csv_dir = csv_directory, output_file = output_netcdf_file, freq = "monthly")

## End(Not run)

rIACI documentation built on April 12, 2025, 9:16 a.m.