[R-sig-Geo] Time vs. Longitude (Hovmueller Diagram)
Michael Sumner
mdsumner at gmail.com
Wed Aug 17 08:38:54 CEST 2011
At a guess, for a given latitude you could do this where "x" is a
data.frame with columns Longitude, Latitude, Time1, ..., TimeN
x1 <- x["Latitude" == -29, ]
## very simplistically
## drop Latitude, and order by Longitude (assuming Time columns are in
the right order)
x2 <- as.matrix(x1[order(x1$Longitude), -2]
image(x2)
## with a bit more work, but big assumptions
lon <- sort(x1$Longitude)
tm <- as.numeric(colnames(x2)[-1])
image(lon, tm, x2, main = "Latitude -29", xlab = "Longitude", ylab = "Time")
There's a lot of guessing here for us, can you describe the file more
exactly or provide a link to at least one latitude's worth?
The Spatial classes in sp provide much more structured support for
these grids, and the spacetime package even more for generalizing
further - but they rely on exactly regular grids, which it looks like
you have here.
Cheers, Mike.
On Wed, Aug 17, 2011 at 1:45 PM, Jianyun Wu <jianyun.fred.wu at gmail.com> wrote:
> Dear Experts,
>
> I am trying to plot the Hovmueller Diagram (example below), which is time
> vs. longitude in R.
>
> http://www.esrl.noaa.gov/psd/cgi-bin/hovmoller/timeplot.pl?var=air&level=1000&mon1=1&mon2=1&dy1=1&dy2=31&yr1=2010&yr2=2011&datatype=operational&type=mean&fxdlon=no&postscript=no&lon1=&lon2=&lat1=&lat2=&cint=&lowr=&highr=&size=100&Submit=Create+Plot
>
> But I couldn't make it work at the moment. Could anyone please suggest me
> which package or function in R can plot such a graph?
>
> The data file on hand is like:
>
> Longtitude Latitude Time1.....................TimeN
> 124 -29
> 126 -29 .......................................
> 128 -29
> .. . .
>
> 2520 spatial locations corresponding to an 84 (longitude) by 30 (latitude)
> grid with 2 degree x 2 degree spacing.
>
> Thank and Regards
>
> Fred
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsumner at gmail.com
More information about the R-sig-Geo
mailing list