Developer documentation
This page lists internal functions and types which may change between minor releases of Seis, and hence are not part of the public API.
Private function index
Private types
Seis.Pick
— TypePick{T}
A named arrival time which can be associated with a Trace
.
If p
is a Pick
, then p.time
gives the arrival time, and p.name
gives its description.
Pick
s can be iterated to retrieve the time and name in that order. Collections of Pick
s (such as those stored in the picks
field of Trace
s) can have their elements assigned by automatic conversion from real numbers, tuples, or named tuples with fields time
and name
.
Arrays of Pick
s, which are stored in Traces
, can be accessed using getproperty
(.
-access) and this returns arrays of times or names.
Examples
Getting and setting values
julia> t = Trace(0, 1, 1)
Seis.Trace{Float64,Array{Float64,1},Seis.Geographic{Float64}}:
b: 0.0
delta: 1.0
Station{Float64,Seis.Geographic{Float64}}:
sta.meta: Seis.SeisDict{Symbol,Any}()
Event{Float64,Seis.Geographic{Float64}}:
evt.meta: Seis.SeisDict{Symbol,Any}()
Trace:
picks: 0
meta:
julia> t.picks.P = 1.2
1.2
julia> t.picks.S = 2.1, "Sn"
(2.1, "Sn")
julia> t.picks.S.time
2.1
julia> t.picks
Seis.SeisDict{Union{Int64, Symbol},Seis.Pick{Float64}} with 2 entries:
:P => Seis.Pick{Float64}(time=1.2, name=missing)
:S => Seis.Pick{Float64}(time=2.1, name="Sn")
Iteration
julia> time, name = Seis.Pick(1, "X")
Seis.Pick{Float64}(time=1.0, name="X")
julia> time, name
(1.0, "X")
Dictionaries
Seis.SeisDict
— TypeSeisDict
Wrapper around Base.Dict
which allows one to get or set values using the {get|set}property[!]
syntax, i.e., .
-access like dict.key
. SeisDict
s also differ in that missing
is returned instead of throwing a KeyError
when accessing a nonexistent key. A key is removed if it is set to missing
.
Examples
julia> dict = Seis.SeisDict(:a=>1)
Seis.SeisDict{Any,Any} with 1 entry:
:a => 1
julia> dict.a
1
julia> dict.b
missing
julia> dict.a = missing
missing
julia> dict
Seis.SeisDict{Any,Any} with 0 entries
Access via getindex
and setindex!
(using []
s) is still possible:
julia> dict[:c] = 3
3
julia> dict[:c]
3
julia> dict[:c] = missing
missing
julia> dict[:d] # No key with this value
missing
julia> dict
Seis.SeisDict{Any,Any} with 0 entries
Arrays of SeisDict
s also define .
-access and setting via broadcasting, so one may do:
julia> d1 = Seis.SeisDict(:a=>1)
Seis.SeisDict{Any,Any} with 1 entry:
:a => 1
julia> d2 = deepcopy(d1); d2.a = 2;
julia> d = [d1, d2]
2-element Array{Seis.SeisDict{Any,Any},1}:
Seis.SeisDict(:a => 1)
Seis.SeisDict(:a => 2)
julia> d.a
2-element Array{Int64,1}:
1
2
Position in space
Seis.Position
— TypePosition
Abstract type of which other position types are subtypes. A Position
specifies where in space an object is located.
The coordinates of a Position
can be accessed via getproperty
(e.g., p.x
) or index (e.g., p[1]
):
Examples
julia> p = Seis.Cartesian(x=1, y=2, z=3)
Seis.Cartesian{Float64}(1.0, 2.0, 3.0)
julia> p.x === p[1]
true
Seis.Geographic
— TypeGeographic{T} <: Position
A geographic position in spherical coordinates. Accessible fields are:
lon
: Longitude (°)lat
: Latitude (°)elev
: Elevation above the reference level (e.g., ellipsoid) (m)dep
: Depth below the reference level (km) (defined to be-elev/1000
)
The fields .elev
and .dep
represent the same information, but in different ways. Setting dep
will automatically update elev
and vice versa. Both are provided for convenience.
Seis.Cartesian
— TypeCartesian{T} <: Position{T}
A position in Cartesian coordinates. Accessible fields are:
x
: X coordinate (m)y
: Y coordinate (m)z
: Z coordinate (m)
Seis.jl's convention is that x
and y
are horizontal (usually with x
being the local easting and y
the local northing), and z
is upwards (giving a right-handed system). The units are m.
Private functions
'Getters'
Seis._angle_tol
— Function_angle_tol(x) -> tol
Return an appropriate tolerance for x
(a floating point type, AbstractTrace
or Station
) to use in comparisons of angular quantities in °. Angles which are tol
° or less apart can be considered identical.
_angle_tol(x, y...) -> tol
Return an appropriate tolerance for a set of values or types x
and y...
, which is the maximum tolerance for all arguments.