;Read all data into a one-dimensional variable. begin ;---Make a list of all files we are interested in files = (/ "flight1.csv","flight2.csv","flight3.csv","flight4.csv" /) ;---Start the graphics plot = new(4,graphic) wks = gsn_open_wks("png","flights_2008") data = asciiread(files(0),-1,"string") delim = "," flt = str_get_field(data,1, delim) ; flight lat = stringtofloat(str_get_field(data,2, delim)) ; latitude values lon = stringtofloat(str_get_field(data,3, delim)) ; longitude values alt = stringtofloat(str_get_field(data,4, delim)) ; altitude year = stringtoint(str_get_field(data,5, delim)) ; year mth = stringtoint(str_get_field(data,6, delim)) ; month day = stringtoint(str_get_field(data,7, delim)) ; day hr = stringtoint(str_get_field(data,8, delim)) ; hour minute = stringtoint(str_get_field(data,9, delim)) ; minute wks = gsn_open_wks("png","trajectory") ; save as png res = True ; plot mods desired res@pmTickMarkDisplayMode = "Always" res@mpFillOn = False ; turn off map fill res@mpOutlineDrawOrder = "PostDraw" ; draw continental outline last res@mpOutlineBoundarySets = "GeophysicalAndUSStates" ; state boundaries ;-- set plot resources res@gsnDraw = False res@gsnFrame = False res@gsnMaximize = True res@mpMinLatF = 38.0 res@mpMaxLatF = 45.0 res@mpMinLonF = -80.0 res@mpMaxLonF = -72.0 ;-- create basic map map = gsn_csm_map(wks,res) ;-- gres = True gres@gsLineThicknessF = 3.0 ; line thickness gres@gsLineColor = "Red" ; line color ; plot1 = gsn_add_polyline(wks, map, lon, lat, gres) do i=1,3 data = asciiread(files(1),-1,"string") delim = "," lat = stringtofloat(str_get_field(data,2, delim)) ; latitude values lon = stringtofloat(str_get_field(data,3, delim)) ; longitude values plot(i) = gsn_add_polyline(wks, map, lon, lat, gres) overlay(map,plot(i)) ; delete( [/lon, lat/] ) ;deletes old array for next iteration end do draw(map) frame(wks) end