# NOT RUN {
# Weather data files for Newmarracara for testing and examples have been
# included in ascotraceR. The weather data files both are of the same format,
# so they will be combined for formatting here.
Newmarracarra <- read.csv(
system.file("extdata",
"1998_Newmarracarra_weather_table.csv",
package = "ascotraceR")
)
station_data <- system.file("extdata",
"stat_dat.csv",
package = "ascotraceR")
weather <- format_weather(
x = Newmarracarra,
POSIXct_time = "Local.Time",
temp = "mean_daily_temp",
rain = "rain_mm",
ws = "ws",
wd = "wd",
wd_sd = "wd_sd",
station = "Location",
time_zone = "Australia/Perth",
lonlat_file = station_data
)
# Saving weather data and reimporting can lose the object class
# Reimported data can be quickly reformatted, adding the 'asco.weather' class
# with this same function
temp_file_path <- paste0(tempdir(),"weather_file.csv")
write.csv(weather, file = temp_file_path, row.names = FALSE)
weather_imported <- read.csv(temp_file_path)
weather <- format_weather(weather_imported,
time_zone = "Australia/Perth")
unlink(temp_file_path) # remove temporary weather file
# }
Run the code above in your browser using DataLab