detect_io_type: Detect the file type of an LPJmL input/output file

View source: R/detect_io_type.R

detect_io_typeR Documentation

Detect the file type of an LPJmL input/output file

Description

This utility function tries to detect automatically if a provided file is of "clm", "meta", or "raw" file type. NetCDFs and simple text formats such as ".txt" or ".csv" are also detected.

Usage

detect_io_type(filename)

Arguments

filename

Character string naming the file to check.

Value

Character vector of length 1 giving the file type:

  • "cdf" for a NetCDF file (classic or NetCDF4/HDF5 format).

  • "clm" for a binary LPJmL input/output file with header.

  • "meta" for a JSON meta file describing a binary LPJmL input/output file.

  • "raw" for a binary LPJmL input/output file without header. This is also the default if no other file type can be recognized.

  • "text" for any type of text-only file, e.g. ".txt" or ".csv"

Examples

## Not run: 
detect_io_type(filename = "filename.clm")
# [1] "clm"

## End(Not run)


lpjmlkit documentation built on March 31, 2023, 9:35 p.m.