[Thread Prev][Thread Next][Index]

RE: Calculating Track Length from Latitude and Longitude



Thanks Mick,

That was exactly what I was looking for.

Regards, Mike

-----Original Message-----
From: Mick.Spillane@noaa.gov [mailto:Mick.Spillane@noaa.gov]
Sent: Tuesday, February 15, 2005 4:17 PM
To: Godin, Michael
Cc: ferret_users@noaa.gov
Subject: Re: Calculating Track Length from Latitude and Longitude



Hi Michael,
	What you need to do I think is to use @ddf rather than
the difference you use where the terms subtracted have different
numbers of values.  With @ddf the last point on the track
will be lost - if you used @ddb or @ddc the first or both end
points would be lost.
	Since you use L=... I presume the data is read in along
the t-axis.  Here is a demo based on your email to illustrate.
Good luck,
	Mick

! define a track with "sst" increasing linearly along it
region/L=1:1000
let LONGITUDE = 180+(L-500)^2/2500
let LATITUDE  = 20+(L-500)/10
let SST = 30 - abs(latitude)/5  ! fake sst, decreasing from equator

LET R_EQUATOR=6378.137 ! earths equatorial radius
LET R_POLAR  =6356.752 ! earths polar radius
LET D2R = atan(1.)/45  ! PI/180 to convert degrees to radians
! then the east and north positions in km are
LET EASTING  =R_EQUATOR*cos(D2R*LATITUDE)*LONGITUDE*D2R
LET NORTHING =R_POLAR*LATITUDE*D2R
! use forward difference to get increments in position
LET DX = EASTING[L=@DDF]
LET DY = NORTHING[L=@DDF]
LET DTRACK = (DX^2+DY^2)^0.5
LET/TITLE="Track"/UNITS="km" TRACK = DTRACK[L=@RSUM]

! plot sst vs track
set view upper ; plot/nolab/vs/line=1 track,sst

! shade a chart in lower half
set view lower ; ppl axlen,5,3
use etopo40
shade/nolab/nokey/pal=gray if(rose ge 0)then 1
! define a rectangular mark
let bx=ysequence({-0.5,0.5,0.5,-0.5})
let by=ysequence({-0.5,-0.5,0.5,0.5})
! ... and color the trajectory according to the value of sst
polygon/o/nolab/coord_ax=y longitude+bx,latitude+by,sst


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement