Hello I will make an interpolation of data which represents azimuth direction ( angle from north in clockwise direction) values. But there is a problem. Say, for instance, while 1 and 359 indicate somewhat same direction, interpolation puts values in the range from 1 to 359. What can I do to solve the problem ? Anything you offer ? thanks in advance Ahmet Temiz General Directory of Disaster Affairs Ankara TURKEY ______________________________________ Inflex - installed on mailserver for domain @deprem.gov.tr Queries to: postmaster at deprem.gov.tr ______________________________________ The views and opinions expressed in this e-mail message are ...{{dropped}}
On Thu, 16 Oct 2003, temiz wrote:> I will make an interpolation of data which represents azimuth direction > ( angle from north in clockwise direction) values. > But there is a problem. > Say, for instance, while 1 and 359 indicate somewhat same direction, > interpolation puts values > in the range from 1 to 359. What can I do to solve the problem ? > > Anything you offer ?The usual solution is to extend the data periodically, that is to put copies shifted by one rotation on each side. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
> I will make an interpolation of data which represents azimuth > direction( angle from north in clockwise direction) values. > But there is a problem. > Say, for instance, while 1 and 359 indicate somewhat same direction, > interpolation puts values > in the range from 1 to 359. What can I do to solve the problem ?You might try breaking it down to x,y components on a circle of radius 1, or take the real and imaginary parts. Bin/average the results and then convert back to polar angles. Note if you are comparing vectors it is important to include magnitude in the calculation and otherwise think about the reality of the answer. e.g. A strong east-west dominant wind flow through a valley, which may be 15 km/hr east half the time and 15 km/hr west the other half may average to a weak north-south net, which tells you nothing about the 'usual' conditions. Sorry, that example isn't very illustrative of my point. R CircStats's circ.mean.R does this: http://cran.r-project.org/src/contrib/PACKAGES.html#CircStats circ.mean <- function(x) { sinr <- sum(sin(x)) cosr <- sum(cos(x)) circmean <- atan(sinr, cosr) circmean or a Matlab example: TH=wind.dirns; R=wind.velos; [X,Y] = pol2cart(TH,R); [TH1,R1] = cart2pol(mean(X),mean(Y)); wind_mean.dirn = TH1 * (180/pi) wind_mean.velo = mean(wind.velos); Hamish