-
Notifications
You must be signed in to change notification settings - Fork 0
/
drifter_plot.jl
46 lines (37 loc) · 1.21 KB
/
drifter_plot.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Dates
using DelimitedFiles
using PyPlot
using GeoDatasets
using Statistics
function load_track(fname)
A = readdlm(fname,',');
time = DateTime.(A[:,1],"yyyy-mm-ddTHH:MM:SS");
lon = A[:,2]
lat = A[:,3]
return time,lon,lat
end
# adapt file name
fname = "/home/abarth/Data/Drifter/drifter01/track-drifter01-20230504T132704.txt" # 3 hours
#fname = "/home/abarth/Data/Drifter/drifter01/track-drifter01-20230504T104608.txt"
#fname = "/home/abarth/Data/Drifter/drifter01/track-drifter01-20230502T182456.txt"
#fname = "/home/abarth/Data/Drifter/drifter01/track-drifter01-20230504T131947.txt"
time,lon,lat = load_track(fname)
t0 = DateTime(year(minimum(time)),month(minimum(time)),day(minimum(time)))
t = time .- t0;
h = Dates.value.(t) / (1000*60*60);
clf()
scatter(lon,lat,10,h); colorbar(label = "hours since $t0 UTC")
xlabel("lon")
ylabel("lat")
res = 'h'
#=
# using PyPlot, GeoDatasets
# This download the file 'gshhg-shp-2.3.7.zip' when called the first time
# Do not interrupt the downloading which can take several minutes.
for (lonc,latc) in GeoDatasets.gshhg(res,[1,5])
plot(lonc,latc,"-",color="k", linewidth = 0.7)
end
=#
xlim(8.70,8.81)
ylim(42.54,42.594)
gca().set_aspect(1/cosd(mean(ylim())))