[Thread Prev][Thread Next][Index]

Calculating Track Length from Latitude and Longitude



Hello all,

I have a dataset that contains scattered data consisting of TIME, LATITUDE, LONGITUDE, and several  other variables (such as SEA_SURFACE_TEMPERATURE).  I would like to be able to plot the variables vs. track length.  However, when I use the following set of commands, 

LET R_EQUATOR=6378.137
LET R_POLAR  =6356.752
LET PI = 4*atan(1)
LET EASTING  =R_EQUATOR*cos(LATITUDE*PI/180)*LONGITUDE*PI/180
LET NORTHING =R_POLAR*LATITUDE*PI/180
LET NUM_TIME=`TIME, RETURN=LSIZE`
LET DX = EASTING[L=2:`NUM_TIME`]-EASTING[L=1:`NUM_TIME-1`] 
LET DY = NORTHING[L=2:`NUM_TIME`]-NORTHING[L=1:`NUM_TIME-1`]
LET DTRACK = (DX^2+DY^2)^0.5
LET/TITLE="Track"/UNITS="km" TRACK = DTRACK[L=@RSUM]
PLOT /VS TRACK,SEA_SURFACE_TEMPERATURE

I get the error:

 **ERROR: dimensions improperly specified: unequal line lengths:
          First expression has 424 points.
          Expression 2 has 425 points:
          "plot /VS TRACK,SEA_SURFACE_TEMPERATURE"

The expression:
PLOT /VS TRACK,SEA_SURFACE_TEMPERATURE[L=2:`NUM_TIME`]
works, but then I loose the first data point.

So, I must ask: is there a more direct way of doing this, and is there at least a way of getting the grid for the TRACK variable to extend to L=1 (where TRACK=0)?

Thanks, Mike Godin

_____________________________________________
Michael A. Godin
Software Engineer
Monterey Bay Aquarium Research Institute
Phone: 831-775-2063  http://www.mbari.org


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement