How to plot wind direction with predicted data from kriging?

44 Views Asked by At

I used kriging to predict wind direction data, in degrees, from satellite information extracted at the location of monitoring stations. This is how I created my prediction object:

 (a) Creating my dataset
 i<-1 # month(1-12)
 krig_data<- data.frame(
 Station = Station$Station,
 Value = monthly_series[,i],
 X = stations_sh$X,
 Y = stations_sh$Y)
 coordinates(krig_data) <- ~ X + Y
 proj4string(krig_data)<-CRS("+init=epsg:3395")

 b) Prediction
 v<- variogram(Value~1, krig_data)
 expo <- fit.variogram(v, vgm("Exp"),fit.sills = TRUE,fit.ranges = TRUE,
 fit.kappa = TRUE,fit.method = 1)
 prediction <- krige(formula = Value~1, krig_data, grid, expo)`

I would like to draw a map of arrows from my prediction but I can't use ggplot2 properly because I only get an "ocean" of arrows and I can't see anything. How can I do it? The predicted data is in the object prediction.The predicted data is in degrees (0-360) The characteristics of the object are:

class(prediction)
[1] "SpatialGridDataFrame"
attr(,"package")
[1] "sp"
names(prediction)
[1] "var1.pred" "var1.var" 
proj4string(prediction)
[1] "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m 
+no_defs"
prediccion$var1.pred
[1] 156.0023 155.9966 155.9913 155.9863 155.9817 155.9774 155.9733 
155.9695 155.9659 155.9625 155.9593
[12] 155.9563 155.9534 155.9506 155.9479 155.9452 155.9427 155.9401 
155.9376 155.9351 155.9326 155.9300
[23] 155.9275 155.9249 155.9224 155.9198 155.9173 155.9147 155.9122 
155.9097 155.9074 155.9051 155.9030
[34] 155.9011 155.8994 155.8981 155.8970 155.8964 155.8963 155.8967 
155.8977 155.8995 155.9020 155.9055.....

I would be very grateful for your help. :)

0

There are 0 best solutions below