R/create.geotop.meteo.file.R
create.geotop.meteo.files.Rd
Creates geotop meteo files from (a list of) 'zoo' objects
create.geotop.meteo.files(
x,
format = "%d/%m/%Y %H:%M",
file_prefix = "meteo",
file_extension = ".txt",
formatter = "%04d",
na = "-9999",
col.names = TRUE,
row.names = FALSE,
date_field = "Date",
sep = ",",
level = NULL,
quote = FALSE,
...
)
'zoo' object or a list of 'zoo' object representing the meteorological station
string format representing the date, see as.POSIXlt
. Default is "%d/%m/%Y %H:%M"
(which is the same format used in geotop.inpts
keyword InitDateDDMMYYYYhhmm
)
string containing file prefix (full path). It correspos to the value of in geotop.inpts
keyword MeteoFile
)
string containing the extensions of final files. Default is c(".txt")
string value. It is the decimal formatter contained in the file name and used in case the tabular data are referred at several points. Default is "%04d"
. See sprintf
.
NA value indicator. Default is "-9999"
. See write.table
.
logical parameter. Default is TRUE
. See write.table
.
logical parameter. Default is FALSE
. See write.table
.
string value. Default is "Date", otherwise defined by the value of HeaderDateDDMMYYYYhhmmMeteo
geotop keyword.
string value. Default is ","
. See write.table
.
integer argument. See get.geotop.inpts.keyword.value
for major details. Default is NULL
and is ignored.
logical parameter. Default is TRUE
. See write.table
.
further arguments for write.table
library(geotopbricks)
data(bondone) ## It contains a "meteo" zoo object.
set.seed(12)
file_prefix <- paste(tempdir(),"meteo",sep="/")
level=2
out <- create.geotop.meteo.files(x=meteo,file_prefix=file_prefix,level=level)
## It exports the "meteo" zoo object into a ASCII file for GEOtop
head(readLines(out))
#> [1] "Date,Iprec,AirT,RH,WindDir,WindSp,Swglob"
#> [2] "18/08/2004 00:00,-9999,-9999,-9999,-9999,-9999,-9999"
#> [3] "18/08/2004 01:00,-9999,-9999,-9999,-9999,-9999,-9999"
#> [4] "18/08/2004 02:00,-9999,-9999,-9999,-9999,-9999,-9999"
#> [5] "18/08/2004 03:00,-9999,-9999,-9999,-9999,-9999,-9999"
#> [6] "18/08/2004 04:00,-9999,-9999,-9999,-9999,-9999,-9999"
out
#> [1] "/tmp/RtmpoDHbhP/meteo0002.txt"