Re: [R] How to plot wind direction and strength field

From: Jenny Barnes <jmb_at_mssl.ucl.ac.uk>
Date: Fri, 02 May 2008 09:57:00 +0100 (BST)

Thanks Greg,

I'll give it a whirl and let you know how it goes (although it might not be till after the bank holiday weekend now sorry for delay!)

Thanks for replying and spending time on this problem.

All the best,

Jenny

On Thu, 1 May 2008, Greg Snow wrote:

> Does the following do what you want (or at least move in that
> direction)?
>
> u <- array(NA,c(5,8))
> t <- seq(from=0.5, to=0.11,length=15)
> t2 <- seq(from=(-0.7),to=(-0.1),length=25)
> u[1:15] <- t
> u[16:40] <- t2
> v <- array(NA,c(5,8))
> y <- seq(from=(-0.9), to=(-0.01),length=40)
> v[1:40] <- y
>
> library(TeachingDemos)
>
> library(maps)
> map('state',col='grey')
>
> lats <- seq( 27.5, 48.7, length=5 )
> longs <- seq( -123, -73, length=8 )
>
> x <- longs[ col(u) ]
> y <- lats[ row(u) ]
>
> speed <- sqrt( u*u+v*v )
> dir <- atan2(v,u)
>
> my.symbols(x,y,ms.arrows, angle=dir, r=speed, add=TRUE, length=.05)
>
>
> Hope this helps,
>
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow_at_imail.org
> (801) 408-8111
>
>
>
>> -----Original Message-----
>> From: r-help-bounces_at_r-project.org
>> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Jenny Barnes
>> Sent: Tuesday, April 29, 2008 6:26 AM
>> To: Jim Lemon
>> Cc: r-help_at_r-project.org
>> Subject: Re: [R] How to plot wind direction and strength field
>>
>> Thanks Jim - here is some data:
>>
>> u <- array(NA,c(5,8))
>> t <- seq(from=0.5, to=0.11,length=15)
>> t2 <- seq(from=(-0.7),to=(-0.1),length=25)
>> u[1:15] <- t
>> u[16:40] <- t2
>> v <- array(NA,c(5,8))
>> y <- seq(from=(-0.9), to=(-0.01),length=40) v[1:40] <- y
>>
>> I've made up the data but it's similar magnitude and the
>> longitude direction is u and latitude direction is v as in
>> the real data.
>>
>> I really appreciate your help!
>>
>> Jenny
>>
>> On Tue, 29 Apr 2008, Jim Lemon wrote:
>>
>>> Jenny Barnes wrote:
>>>> Hi Jim,
>>>>
>>>> I would like to plot something like figure 2 on this webpage:
>>>> http://www.cnrfc.noaa.gov/storm_summaries/jan1997storms.php
>>>>
>>>> My data is very large - covering the whole globe at 2.5deg
>> resolution
>>>> so
>>>> longitude=144 girds, latitude=73 grids and time=32 years - hard to
>>>> give you that data......Would it help to give you a couple of grid
>>>> squares worth of data for one year?
>>>>
>>> Okay, Figures 2 and 3 look like 5 degree squares, and given
>> a larger
>>> plot,
>>> 2.5 degree should be okay. Do you want curved arrows? That
>> would take
>>> some programming as the standard arrows are straight. Also,
>> the arrows
>>> in the figures all seem to be the same length. I can make
>> the lengths
>>> proportional to wind speed. Yes, some data would be helpful, as
>>> getting the right plot usually involves trying out real
>> data. Doesn't
>>> matter if it's faked as long as it has the same format and
>> similar numbers to the real thing.
>>>
>>> Jim
>>>
>>>
>>>
>>
>> ______________________________________________
>> R-help_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 02 May 2008 - 09:21:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 02 May 2008 - 11:30:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive