Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time series data shifted #674

Closed
jmkuhn opened this issue Aug 4, 2021 · 2 comments · Fixed by #675
Closed

Time series data shifted #674

jmkuhn opened this issue Aug 4, 2021 · 2 comments · Fixed by #675

Comments

@jmkuhn
Copy link
Contributor

jmkuhn commented Aug 4, 2021

I am trying to plot a short time series (a few seconds). With my initial plot, the axis seemed correct but no data was plotted. When I greatly increased the range on the x axis, my data is plotted but shifted by 1 day.

GMT.jl v0.35.0
GMT 6.2.0

using Dates, GMT

starttime = DateTime(2021, 2, 3, 4, 5, 0)
endtime = starttime + Second(4)
x = collect(starttime:Second(1):endtime)
y = collect(0.0:4.0)
plot(x, y, region=(starttime, endtime, 0, 4), lw=:thick, savefig="short_time.png", show=true)
plot(x, y, region=(starttime, endtime + Day(5), 0, 4), lw=:thick, savefig="long_time.png", show=true)

short_time
long_time

@jmkuhn
Copy link
Contributor Author

jmkuhn commented Aug 4, 2021

Should TIME_SYSTEM be RATA instead of RD0001?

GMT.jl/src/common_options.jl

Lines 2911 to 2915 in c6bc703

arg = Dates.value.(arg) ./ 1000; cmd *= " --TIME_SYSTEM=dr0001"
got_datetime, is_onecol = true, true
elseif (isa(arg, Matrix{Any}) && typeof(arg[1]) == DateTime) # Matrix with DateTime in first col
min_max = round_datetime(extrema(view(arg, :, 1)))
arg[:,1] = Dates.value.(arg[:,1]) ./ 1000; cmd *= " --TIME_SYSTEM=dr0001"

julia> Dates.value(DateTime(0, 12, 31))
0

@joa-quim
Copy link
Member

joa-quim commented Aug 4, 2021

Thanks for looking into this. I'll try to look at it but these summer days with visitors don't leave me much time. I remember to had to pick RD0001 to make this example but otherwise plotting time series is indeed something that lacks more testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants