140 likes | 240 Views
Thinning Procedure for Shiptracks. David Rosenfield Research Associate NOAA National Coastal Data Development Center 1021 Balch Boulevard, Suite 1003 Stennis Space Center, MS 39529 9/11/2012.
E N D
Thinning Procedure for Shiptracks David Rosenfield Research Associate NOAA National Coastal Data Development Center 1021 Balch Boulevard, Suite 1003 Stennis Space Center, MS 39529 9/11/2012
Disclaimer: We are in the process of standardizing the shiptrack thinning and several other methods. This work is a proposed method arrived at from a combination of several sources and may not reflect the final method we intend on using.
U:\Okeanos Explorer 2008-2009-2010-2011\2010\EX1004_Indonesia\NODC\data\0-data\vessel\EX1004_Leg3\Ship_Navigation\CNAV\: CNAV-GGA_20100722-004127.Raw CNAV-GGA_20100722-073052.Raw CNAV-GGA_20100722-101604.Raw CNAV-GGA_20100723-000000.Raw CNAV-GGA_20100724-000000.Raw CNAV-GGA_20100725-000000.Raw CNAV-GGA_20100726-000000.Raw CNAV-GGA_20100727-000000.Raw CNAV-GGA_20100728-000000.Raw CNAV-GGA_20100729-000000.Raw CNAV-GGA_20100730-000000.Raw CNAV-GGA_20100731-000000.Raw CNAV-GGA_20100801-000000.Raw CNAV-GGA_20100802-000000.Raw CNAV-GGA_20100803-000000.Raw CNAV-GGA_20100804-000000.Raw CNAV-GGA_20100805-000000.Raw CNAV-GGA_20100806-000000.Raw CNAV-GGA_20100806-150855.Raw CNAV-GGA NMEA SCS Date(MM/DD/YYYY),SCS Time(hh:mm:ss.sss),Sentence Label(None),CNAV-TIME(hhmmss),CNAV-LAT(deg),CNAV-LAT Units,CNAV-LON(deg), 07/26/2010,00:00:01.471,$GPGGA,000001.00,0216.124127,N,12449.075605,E,2,09,1.1,22.604,M,65.744,M,10.0,0025*44 07/26/2010,00:00:02.471,$GPGGA,000002.00,0216.124154,N,12449.075612,E,2,09,1.1,22.566,M,65.744,M,10.0,0025*42 07/26/2010,00:00:03.471,$GPGGA,000003.00,0216.124176,N,12449.075607,E,2,09,1.1,22.682,M,65.744,M,9.0,0025*76 07/26/2010,00:00:04.472,$GPGGA,000004.00,0216.124197,N,12449.075601,E,2,09,1.1,22.797,M,65.744,M,10.0,0025*45 07/26/2010,00:00:05.472,$GPGGA,000005.00,0216.124185,N,12449.075604,E,2,09,1.1,22.801,M,65.744,M,10.0,0025*42 07/26/2010,00:00:06.472,$GPGGA,000006.00,0216.124119,N,12449.075601,E,2,09,1.1,22.772,M,65.744,M,10.0,0025*4A 07/26/2010,00:00:07.472,$GPGGA,000007.00,0216.124052,N,12449.075599,E,2,09,1.1,22.741,M,65.745,M,10.0,0025*46 07/26/2010,00:00:08.472,$GPGGA,000008.00,0216.124001,N,12449.075584,E,2,09,1.1,22.700,M,65.744,M,10.0,0025*47 07/26/2010,00:00:09.472,$GPGGA,000009.00,0216.124011,N,12449.075558,E,2,09,1.1,22.693,M,65.744,M,9.0,0025*75 07/26/2010,00:00:10.472,$GPGGA,000010.00,0216.124038,N,12449.075558,E,2,09,1.1,22.742,M,65.744,M,10.0,0025*43 07/26/2010,00:00:11.472,$GPGGA,000011.00,0216.124050,N,12449.075586,E,2,09,1.1,22.717,M,65.744,M,10.0,0025*4F 07/26/2010,00:00:12.456,$GPGGA,000012.00,0216.124051,N,12449.075614,E,2,09,1.1,22.669,M,65.744,M,10.0,0025*4D 07/26/2010,00:00:13.472,$GPGGA,000013.00,0216.124051,N,12449.075625,E,2,09,1.1,22.666,M,65.744,M,10.0,0025*41 SCS Date(MM/DD/YYYY), SCS Time(hh:mm:ss.sss), Sentence Label(None), CNAV-TIME(hhmmss), CNAV-LAT(deg), CNAV-LAT Units, CNAV-LON(deg), CNAV-LON Units, CNAV-Fix Quality(*NONE*), CNAV-Sat(*NONE*), CNAV-HDOP(*NONE*), CNAV-Alt(Meters), CNAV-Alt-M(*NONE*), CNAV-Geoid(*NONE*), CNAV-Geoid-M(*NONE*), CNAV-?(*NONE*), CNAV-GGA-Chksum(*NONE*)
thinshiptrack.m • octave> [ipos,opos]=thinshiptrack(eps,dist,nsec); • Three step process • Save record every ‘nsec’ seconds • Save ‘ipos’ as ascii file • Save ipos as a workspace variable • Perform Douglas Peucker optimization • octave> list=douglaspeucker(x,y,points,eps,dist); • octave> opos=ipos(:,list); • Save ‘opos’ as ascii file • Return opos as a workspace variable • Convert to (and save) a .kml file
STEP 1 of thinshiptrack.m • Save record every ‘nsec’ seconds For each file: if nsec=6 for example… CNAV-GGA_20100722-004127.Raw CNAV-GGA_20100722-073052.Raw DateString,Tag,Date#,Lon,N,Lat,E,,,,,,Elev,,,, CNAV-GGA_20100722-101604.Raw ---------------------------------------------- CNAV-GGA_20100723-000000.Raw CNAV-GGA_20100724-000000.Raw CNAV-GGA_20100725-000000.Raw CNAV-GGA_20100726-000000.Raw CNAV-GGA_20100727-000000.Raw CNAV-GGA_20100728-000000.Raw CNAV-GGA_20100729-000000.Raw CNAV-GGA_20100730-000000.Raw CNAV-GGA_20100731-000000.Raw CNAV-GGA_20100801-000000.Raw CNAV-GGA_20100802-000000.Raw CNAV-GGA_20100803-000000.Raw saves variable creates ascii file CNAV-GGA_20100804-000000.Raw CNAV-GGA_20100805-000000.Raw DateString Date# Lon Lat Elev CNAV-GGA_20100806-000000.Raw ---------------------------------- CNAV-GGA_20100806-150855.Raw ipos is a [4x100K] matrix in Octave/MATLAB workspace ipos=[Date#;lon;lat;elev] 07/26/2010,00:00:01.471,$GPGGA,000001.00,0216.124127,N,12449.075605,E,2,09,1.1,22.604,M,65.744,M,10.0,0025*44 07/26/2010,00:00:02.471,$GPGGA,000002.00,0216.124154,N,12449.075612,E,2,09,1.1,22.566,M,65.744,M,10.0,0025*42 07/26/2010,00:00:03.471,$GPGGA,000003.00,0216.124176,N,12449.075607,E,2,09,1.1,22.682,M,65.744,M,9.0,0025*76 07/26/2010,00:00:04.472,$GPGGA,000004.00,0216.124197,N,12449.075601,E,2,09,1.1,22.797,M,65.744,M,10.0,0025*45 07/26/2010,00:00:05.472,$GPGGA,000005.00,0216.124185,N,12449.075604,E,2,09,1.1,22.801,M,65.744,M,10.0,0025*42 07/26/2010,00:00:06.472,$GPGGA,000006.00,0216.124119,N,12449.075601,E,2,09,1.1,22.772,M,65.744,M,10.0,0025*4A 07/26/2010,00:00:07.472,$GPGGA,000007.00,0216.124052,N,12449.075599,E,2,09,1.1,22.741,M,65.745,M,10.0,0025*46 07/26/2010,00:00:08.472,$GPGGA,000008.00,0216.124001,N,12449.075584,E,2,09,1.1,22.700,M,65.744,M,10.0,0025*47 07/26/2010,00:00:09.472,$GPGGA,000009.00,0216.124011,N,12449.075558,E,2,09,1.1,22.693,M,65.744,M,9.0,0025*75 07/26/2010,00:00:10.472,$GPGGA,000010.00,0216.124038,N,12449.075558,E,2,09,1.1,22.742,M,65.744,M,10.0,0025*43 07/26/2010,00:00:11.472,$GPGGA,000011.00,0216.124050,N,12449.075586,E,2,09,1.1,22.717,M,65.744,M,10.0,0025*4F 07/26/2010,00:00:12.456,$GPGGA,000012.00,0216.124051,N,12449.075614,E,2,09,1.1,22.669,M,65.744,M,10.0,0025*4D 07/26/2010,00:00:13.472,$GPGGA,000013.00,0216.124051,N,12449.075625,E,2,09,1.1,22.666,M,65.744,M,10.0,0025*41 07/26/2010,00:00:14.472,$GPGGA,000014.00,0216.124072,N,12449.075628,E,2,09,1.1,22.669,M,65.744,M,10.0,0025*45 07/26/2010,00:00:15.456,$GPGGA,000015.00,0216.124079,N,12449.075626,E,2,09,1.1,22.751,M,65.745,M,9.0,0025*72 07/26/2010,00:00:16.472,$GPGGA,000016.00,0216.124060,N,12449.075623,E,2,09,1.1,22.826,M,65.744,M,9.0,0025*72 07/26/2010,00:00:17.472,$GPGGA,000017.00,0216.124028,N,12449.075627,E,2,09,1.1,22.814,M,65.744,M,10.0,0025*42 07/26/2010,00:00:18.472,$GPGGA,000018.00,0216.124035,N,12449.075640,E,2,09,1.1,22.725,M,65.744,M,10.0,0025*4D 07/26/2010,00:00:19.472,$GPGGA,000019.00,0216.124065,N,12449.075641,E,2,09,1.1,22.693,M,65.744,M,10.0,0025*44 07/26/2010,00:00:06.472 3.971281 124.817927 2.268735 22.772 07/26/2010,00:00:12.456 3.971350 124.817927 2.268734 22.669 07/26/2010,00:00:18.472 3.971420 124.817927 2.268734 22.725
STEP 2 of thinshiptrack.m • Perform Douglas Peucker optimization Simple lines of several points are reduced to a 2 point line. n=6n=2 More complex paths are broken down to smaller lines... n=13 ...and each are reduced to a 2 point line. n=4 This method is called “recursion.”
STEP 2 of thinshiptrack.m • Standard Douglas Peucker optimization • Epsilon: some small % of total distance max perpendicular dist epsilon * total dist total distance n=15
STEP 2 of thinshiptrack.m • Addition to Douglas Peucker optimization • BaseDistance: some small (1-1000m) distance When total distance is smaller than BaseDistance, all points within the line are removed. And we’re done! n=7
thinshiptrack.m • Overview
thinshiptrack.m • Evaluation In your “C:\Octave\student\” directory there is a file you will run in Octave called thinshiptrack.m (runs douglaspeucker.m) The basic call is: opos=thinshiptrack(eps,dist,nsec) so you can either define eps, dist and nsec, or plug in values octave>cd ../../student octave>eps=0.01;dist=1;nsec=6; octave>opos1=thinshiptrack(eps,dist,nsec); octave>opos2=thinshiptrack(0.01,100,60); octave>whos Details on opos1 and opos2 come up on your screen. Exploring your student directory, you should see two new *.kml file that you just created. Drag both of these into Google Earth and change one shiptrack’s color to red. Repeat to fill out the following table.
thinshiptrack.m • Evaluation • Otherwise use eps=1%, nsec=60, and dist=10m
thinshiptrack.m • Error Calculation • But how much do they differ quantitatively? • First run the highest resolution possible • octave>eps=0.0001;dist=1;nsec=1; • octave>opos0=thinshiptrack(eps,dist,nsec); • That took a little while…200s on my box • octave>eps=0.1;dist=1000;nsec=600; • octave>opos3=thinshiptrack(eps,dist,nsec); • This one’s much faster…0.5s • octave>whosopos* • Details on opos0-3 come up on your screen. • Now let’s perform an error test on these shiptracks • octave>errortest(opos3) • octave>errortest(opos2) • octave>errortest(opos1) • OR • octave>errortest(thinshiptrack(eps,dist,nsec))
thinshiptrackBJ4.m • Applying the thinshiptrack.m routine to a shiptrack from the Baruna Jaya IV was done for you, but you may want to repeat the process for yourself. • Given High-Resolution Multibeam Data (~300MB x y z ascii file) filter data using a 200 point triangular window running average over multiple (100) iterations • Subsample by a 100 (from an original 9 million points) gives one a good representation of the shiptrack • Repeat Douglas Peuker thinning by modifying thinshiptrack.m