Skip to content

Conversation

@anowacki
Copy link
Owner

@anowacki anowacki commented Mar 4, 2025

This is an attempt at switching to the use of NanoDates from
NanoDates.jl for origin times. For practical purposes this
avoids all issues with sampling intervals which are not
whole numbers of milliseconds (so long as they are still
sensibly rounded to nanoseconds), and so makes it easier to
deal with high-sample-rate data in absolute time.

  • Use NanoDates for dates rather than DateTimes
  • Add mention of format of dates in manual
  • Add datetime to return sample dates as DateTimes
  • Makie: add date option to plot_traces

@codecov
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 65.51724% with 20 lines in your changes missing coverage. Please review.

Project coverage is 66.74%. Comparing base (0df9b70) to head (dedaccb).

Files with missing lines Patch % Lines
ext/SeisMakieExt.jl 0.00% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #63      +/-   ##
==========================================
- Coverage   67.36%   66.74%   -0.63%     
==========================================
  Files          21       23       +2     
  Lines        2185     2198      +13     
==========================================
- Hits         1472     1467       -5     
- Misses        713      731      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Replace use of the Dates standard library type `DateTime` with
`NanoDate` of NanoDates.jl.  The means that dates are represented
internally with ns precision, and `NanoDate`s are returned when calling
e.g. `origin_time` or `dates`.

This also means that we no longer need to set `b` to anything other than
0 when reading miniSEED files (which are resolved usually to µs).
Include a mention of the use of `NanoDate`s in the manual in the section
on `Event`s, since that is where the `.time` field holds the date.
In addition to the `dates` function, now export an additional function
which returns samples to the nearest ms in UTC time, to make it easier
for users who don't need to use a `NanoSecond`.
Add the plotting of sample values against absolute (UTC) time, rather
than relative time, by passing `date=true` to `plot_traces` (and
therefore also to `Makie.plot(::AbstractArray{<:Seis.AbstractTrace})`).

For now, issues with Makie means that picks are plotted with diamonds
rather than vertical lines, and labels cannot be plotted.  These may be
worked around in future or remedied upstream.
On 32-bit platforms, rounding to an `Int` means rounding to and
`Int32`, and this can fail when using `NanoDate`s because the
values are too large.  Change this to an explicit `Int64` to try
to avoid this.
Currently plotting with `space=:relative` doesn't work when using
an axis with units of `DateTime`
(MakieOrg/Makie.jl#4324).  Work around the
issue by plotting into a 'dimensionless' scene, as per the suggestion of
MakieOrg/Makie.jl#4324 (comment)
Move the default `axis` keyword arguments into the `axis` keyword
for the `Makie.lines` call which now creates the axis for each trace.
This allows the user to set keyword arguments for `Makie.Axis` without
resetting the defaults completely.
Incorrect rounding means that although `datetimes` was working,
the test was broken.  Fix by rounding to a large enough integer to
cope with the size of time interval in ns used in the test.
Updat the documentation environment to enable docs to be built
with the NanoDates dependency.
NanoDates supports Julia v1.7+, while LTS is now v1.10, so it is
time to drop support for v1.6 and only support LTS for new
features.
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 this pull request may close these issues.

2 participants