'Area weighted average of wind speed gridded data

I have wind speed gridded data at a particular longitude and latitude. I want to calculate an area-weighted average of wind speed in R. I'm using package "ClimProjDiagsin" for area weighted average. Also, some code related to the area weighted average was given.

data <- 1:(2 * 3 * 4 * 5)

dim(data) <- c(lon = 2, lat = 3, time = 4, model = 5)

lat <- c(1, 10, 20)

lon <- c(1, 10)

a <- WeightedMean(data = data, lon = lon, lat = lat, region = NULL, 
                 mask = NULL, londim = 1, latdim = 2)

str(a)

But here I do not understand what the time and model are representing.

Here is my data sample with longitude and latitude:

data <- c(3.632576,  3.226389, 5.810934, 4.473232, 3.239784)

lat = 5

lon = 79.59

My question is how do I use my data sample in the above code to calculate an area weighted average of wind speed gridded data.

Thanks

Mohammad shad



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source