gibson_textfile | R Documentation |
Read observations from a text files stored somewhere on the disk.
gibson_textfile(date.str=NULL,
format=NULL,
path="",
path.date="yyyy/mm/dd"
fbname=""
fbname.date="yyyymmddThhZ"
fext="txt",
fsep=";",
selout=c("lat","lon","elev"),
na=-999,
na.rm=T)
date |
a date-time string, such as for example |
format |
the format to be used for the output string. For the
list of items see the help page of |
path |
string containing the path used to construct the full file name |
path.date |
string containing that part of the path that depends on the date |
fbname |
string with the base name of the file name |
fbname.date |
string with the part of the base name of the file name that depends on the date |
fext |
string with file extension |
fsep |
character used to separate fields in the text file |
selout |
vector of strings with the column names to write into the output file |
na |
numeric defining the NA value |
na.rm |
logical, decide whether NAs are included in the output |
The name of the file is set to path/path.date/fbname+fbname.date+fext.
The format of the input is something like:
lat;lon;elev;FF;PR;TA;DG;DD;RR_1;FG;UU 59.520877;10.698517;38;0.56;1006.20;-4.60;103;90;-999;1.94;81 58.785390;5.624396;43;-999;994.70;-1.20;-999;-999;-999;-999;65 61.722195;17.104938;7;0.56;1005.00;-3.90;325;345;-999;1.39;98 ...
so to get metadata and hourly precipitation use selout=c("lat","lon","elev","RR_1")
.
Possible variables are: FF hourly wind speed; PR hourly atmospheric pressure; TA hourly temperature; DG direction of the wind gust; DD wind direction; RR_1 hourly total precipitation; FG wind gust; UU relative humidity.
The values refers to the last 10 minutes of the hour used as time stamp. Exceptions are: RR_1 that is the total precipitation for the hour; ....
These function invoke the function replaceDate
.
a data frame with the columns specified by selout and the value read from the input text file.
Cristian Lussana
replaceDate
# get precipitation and temperature data (not NAs)
data <- gibson_textfile(date.str="2018.03.04.12",format="%Y.%m.%d.%H",selout=c("lat","lon","elev","RR_1","TA"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.