0
我想使用我自己製作的數據(使用Hysplit和R/openair)在openair軟件包(R)中製作軌跡圖。使用自己的數據在openair中繪製軌跡
我收到一個錯誤: 「abs(mydata $ len)中的錯誤:數學函數的非數值參數」。
我的代碼(在軌跡數據讀取直接從CSV文件):
# read in trajectory
mydata <- read.csv("c:/hysplit4/working/2014/2014rml.csv", header = TRUE,
stringsAsFactors = FALSE # I have tried with /without this line
)
# make sure dates are read correctly
mydata$date2 <- as.POSIXct(strptime(mydata$date2, format = "%Y-%m-%d %H:%M:%S"))
mydata$date <- as.POSIXct(strptime(mydata$date, format = "%Y-%m-%d %H:%M:%S"))
as.vector(as.matrix(mydata)) # I have tried with/ without this line
# plot trajectory for specific dates
library(openair)
library(mapdata)
trajPlot(mydata)`
備用碼我曾嘗試 - 由「ProcTraj」創建.Rdata文件中讀取作爲「的OpenAir」手冊附錄中詳細。當在Rstudio運行結束,將所得 'MYDATA' 看起來相同的(如下所示):
mydata <- importTraj(site = "SuvaCity", year = 2014,
local = "C:/HYSPLIT/TrajProc/")
## at this point it prints the trajectory data on the screen and it looks fine
trajPlot(mydata)
這給出了錯誤:
「錯誤在as.POSIXlt.character(MYDATA $日期[1]) : 字符串不是一個明確的標準格式」
如果我補充一下:
mydata$date2 <- as.POSIXct(strptime(mydata$date2, format = "%Y-%m-%d %H:%M:%S"))
mydata$date <- as.POSIXct(strptime(mydata$date, format = "%Y-%m-%d %H:%M:%S"))
我回到原來的錯誤。
MYDATA:
receptor,year,month,day,hour,hour.inc,lat,lon,height,pressure,date2,date
1,2014,1,1,0,0,-18.134,178.424,18,1000.2,2014-01-01 00:00:00,2014-01-01 00:00:00
1,2013,12,31,23,-1,-18.089,178.532,30,998.6,2013-12-31 23:00:00,2014-01-01 00:00:00
1,2013,12,31,22,-2,-18.045,178.659,44.5,996.9,2013-12-31 22:00:00,2014-01-01 00:00:00
1,2013,12,31,21,-3,-18.002,178.806,61.5,995.3,2013-12-31 21:00:00,2014-01-01 00:00:00
1,2013,12,31,20,-4,-17.96,178.97,80.6,993.3,2013-12-31 20:00:00,2014-01-01 00:00:00
1,2013,12,31,19,-5,-17.92,179.151,100.5,990.4,2013-12-31 19:00:00,2014-01-01 00:00:00
1,2013,12,31,18,-6,-17.885,179.352,120.3,988,2013-12-31 18:00:00,2014-01-01 00:00:00
感謝尼克,我剛纔還看見您的回覆......我結束了我實現數據分開越過國際日期變更線,並繪出了從該行的每一面的數據,這似乎工作。 –