sef2climatol {climatol}R Documentation

Convert SEF data files to climatol input files.

Description

This function reads all SEF files contained in a directory and writes their data in *.dat and *.est climatol input files.

Usage

  sef2climatol(dr,Vbl,varcli=Vbl,ndec=1,na.strings="NA",mindat=NA)

Arguments

dr

directory containing the SEF files

Vbl

name of the variable in the SEF files

varcli

name of the variable in the climatol destination files

ndec

number of decimals to save

na.strings

missing data codes (specified as quoted strings)

mindat

minimum required number of data per station

Details

SEF (Station Exchange Format) is the Copernicus Climate Change Service format for Data Rescue projects. Visit https://datarescue.climate.copernicus.eu/node/80

Missing elevations will be assigned the value 99

Some files may contain a single quotation mark in the metadata field, causing not reading the end of line until a pairing quoting is found in the following line, hence skipping half of the data. Parameter quote='\' has been set in the reading command as a workaround.

All data are dumped into a temporary file named SEFdata.csv, which is used by the function csv2climatol to write the input files for climatol.

See Also

csv2climatol, homogen

Examples

## Set a temporal working directory and write input files:
wd <- tempdir()
wd0 <- setwd(wd)

## Create a directory and copy all SEF files to be processed:
dir.create('dir1')
file.copy(exampleFiles('GHCN_v4_Bhamo.tsv'),'dir1')
file.copy(exampleFiles('GHCN_v4_Diamond_Island.tsv'),'dir1')

## Now run the function:
sef2climatol('dir1','ta')

## Return to user's working directory:
setwd(wd0)

## Input and output files can be found in directory:
print(wd)

[Package climatol version 4.1.0 Index]