Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
#Read columns from table
mLat=tolist(values(tbl,"meanLat"))
mLon=tolist(values(tbl,"meanLon"))

#visualiser
iv_curve = input_visualiser(
	   input_plot_type	:	"geo_points",
	   input_longitude_variable	:	mLon,
	   input_latitude_variable	:	mLat	  	  
	)

#line attributes
vdgraph_curve=mgraph(graph_line_colour: "red",
         graph_line_thickness: "3",
         graph_symbol: "on",
         graph_symbol_marker_index: 15,
         graph_symbol_height: 0.5,
         graph_symbol_colour: "white",
         graph_symbol_outline: "on"
        ) 

...

Code Block
languagepy
plot(view,iv_curve,vdgraph_curve,title)

Having run the macro we will get a plot like this:

Step 2 - Plotting the dates along the mean track

We will improve the trajectory plot by plotting showing the waypoint dates along the track. 

The macro to use is 'plot_tr_step2.mv'. This macro is basically the same as the one in Step 1, but we have an additional data layer for the waypoint dates:

We will improve the trajectory plot by plotting the waypoint dates along the track. The macro to use is 'plot_tr_step2.mv'. We will see how this macro works.

...

to modify and extend it a bit.

The first difference is that we need to determine the middle of the release interval since the trajectory waypoint times are given in seconds elapsed since this date. The release date reading part needs to be modified like this:

Code Block
languagepy
#Read relaserelease dates from table header
startSec=number(metadata_value(tbl,"start"))
endSec=number(metadata_value(tbl,"end"))
releaseDate=runDate + second(startSec)
releaseMidDate=runDate + second((endSec+startSec)/2)#The input file

...

)

Then we need to add a new plotting layer for the date labels. Using the information above we can build the list of strings we want to show along the track and use the Input Visualiser and Symbol Plotting to define the plot:

Code Block
#Read waypoint times from table
#These are seconds elapsed since the middle of the release interval
tt=values(tbl,"time")

#Build the list of date strings to be plotted 
ttLst=nil
for i=1 to count(tt) do
    d=releaseMidDate + second(tt[i])
    ttLst = ttLst & [ "  " & string(d,"dd") & "/" & string(d,"HH")]
end for    

#visualiser
iv_date = input_visualiser(
	   input_plot_type	:	"geo_points",
	   input_longitude_variable	:	mLon,
	   input_latitude_variable	:	mLat	  	  
	)

#line attributes
sym_date=msymb(symbol_type: "text",
         symbol_text_list: ttLst,
         symbol_text_font_size: 0.3,
         symbol_text_font_colour: "navy"
        ) 

Finally the plot command has to be extended like this:

Code Block
languagepy
plot(view,iv_curve,graph_curve,iv_date,sym_date,title)

Having run the macro we will get a plot like this:

Image Added

Step 3 - Plotting the cluster centres

The trajectory output file also contains the coordinates of the cluster centres. In this step we will show a possible way to plot this extra bit of information together with the mean trajectory. Our approach is as follow:

we plot the track as a curve

we plot the mean trajectory points using different shaped and coloured symbols at different times

we use use the same symbols and colour-coding for the cluster centres


The challenge here is to produce an informative but still readplot kepping thWe will improve the trajectory plot by showing the waypoint dates along the track. 

The macro to use is 'plot_tr_step3.mv'.

First, we read the CSV file.

Code Block
languagepy
#The input file
dIn="result_tr_single"
inFile=dIn  & "/tr_r1.csv"

#Read table (CSV) data
tbl=read_table(table_filename: inFile,
    table_header_row: "2",
    table_meta_data_rows: "1")



The first difference is that we need to determine the middle of the release interval since the trajectory waypoint times are given in seconds elapsed since this date. The release date reading part needs to be modified like this:


Image Added