Typeageddon!
The main purpose of this release is to finalize custom Types; major changes to Types are extremely unlikely after this release; minor changes will only happen in response to significant demands. The Type restructuring in this version serves two main purposes:
- allow a range of predetermined styles for fields with no universal standard (e.g. location)
- improve user experience
Descriptions of Type fields and meanings can be found in the help text of each Type.
Low-level descriptions of how each Type is stored on file can be found in the SeisIO documentation.
Full switch to read_data
Readers for individual file formats (e.g. readsac
) have been deprecated (as warned about in the notes to SeisIO-0.2.0). Please use read_data
instead.
Changes to SeisData, SeisChannel
- An abstract Type,
GphysData
, is now the supertype ofSeisData
. This will allow variants ofSeisData
objects to be added easily. - For similar reasons, an abstract Type,
GphysChannel
, is now the supertype ofSeisChannel
. - The
:loc
field now uses custom types designed for one location format each; current options are:GeoLoc
: geographic instrument position using lat/lonUTMLoc
: location in UTM coordinates (zone, Northing, Easting)XYLoc
: location in local (x-y-z) coordinates relative to a georeferenced originGenLoc
: generic location- It is not necessary for all channels in a SeisData object to use the same location Type.
- The
:resp
field now uses custom types designed for instrument response formats. Current options are:PZResp
: pole-zero response with Float32 fields:c
(damping constant),:p
(complex poles),:z
(complex zeros).PZResp64
: pole-zero response with Float64 precision; same field names asPZResp
.GenResp
: generic instrument response object comprising a descriptive string,:desc
, and a complex Float64 matrix,:resp
.
Quake submodule
All Types and functions related to handling of discrete earthquake events have been moved to a new submodule, SeisIO.Quake. This includes several (former) SeisIO core functions:
- UW data format:
readuwevt
,uwpf
,uwpf!
- Event web functions:
FDSNevq
,FDSNevt
,distaz
,get_pha!
- Miscellaneous:
gcdist
,show_phases
- Types:
SeisHdr
,SeisEvent
SeisIO.Quake Types
SeisSrc
is a new Type that characterizes an earthquake source process, with fields::id
(String): seismic source id:eid
(String): event id:m0
(Float64): scalar moment:misc
(Dict{String,Any}): dictionary for non-essential information:mt
(Array{Float64,1}): moment tensor values:dm
(Array{Float64,1}): moment tensor errors:npol
(Int64): number of polarities used in focal mechanism:pax
(Array{Float64,2}): principal axes:planes
(Array{Float64,2}): nodal planes:src
(String): data source:st
(SourceTime): source-time description with subfields::desc
(String): description of source-time function:dur
(Real): duration:rise
(Real): rise time:decay
(Real): decay time
SeisHdr
has changed, hopefully for the last time:- Fields describing the seismic source process have moved to
SeisSrc
. :typ
(String) added for event type.:id
changed Type (Int64 ==> String) to accommodate ISC IDs.:loc
was expanded; added subfields can now fully characterize location quality, type, and source.:mag
is now a custom object, rather than Tuple(Float32, String), with fields::val
(Float32): magnitude value:scale
(String): magnitude scale:nst
(Int64): number of stations used in magnitude calculation:gap
(Float64): max. azimuthal gap between stations in magnitude calculation:src
(String): magnitude source (e.g,. software name, authoring agency)
- Fields describing the seismic source process have moved to
SeisEvent
now has three substructures, rather than two::data
is now TypeEventTraceData
(<: GphysData), which behaves like SeisData but contains four additional fields for event-specific information:az
Azimuth from eventbaz
Backazimuth to eventdist
Source-receiver distancepha
Phase catalog. This is a dictionary of custom objects namedSeisPha
, keyed to phase names (e.g. "pP"), with fields: (Float64 except as indicated)amp
amplituded
distanceia
incidence anglepol
polarity (Char)qual
quality (Char)rp
ray parameterres
residualta
takeoff anglett
travel timeunc
uncertainty
:hdr
(SeisHdr), header information:source
(SeisSrc), source process characterization
Note: Seismic data centers typically use different IDs for event location and event source model; hence, for a SeisHdr object H
and the corresponding SeisSrc object R
, H.id == R.eid
, but generally, H.id != H.eid
. Please don't open an issue about this, I swear it's not a bug.
QuakeML Support
SeisIO.Quake introduces QuakeML support.
- A new function,
read_qml
, reads QuakeML files and parses QuakeML downloads. - If multiple focal mechanisms, locations, or magnitudes are present in a single
Event
element, the following rules are used to select one of each:FocalMechanism
preferredFocalMechanismID
if present- Solution with best-fitting moment tensor
- First
FocalMechanism
element
Magnitude
preferredMagnitudeID
if present- Magnitude whose ID matches
MomentTensor/derivedOriginID
- Last moment magnitude (in this context, any magnitude whose lowercase
scale abbreviation begins with "mw") - First
Magnitude
element
Origin
preferredOriginID
if presentderivedOriginID
from the chosenMomentTensor
element- First
Origin
element
- Non-essential QuakeML data are saved to each event
W
inW.source.misc
(for earthquake source data) orW.hdr.misc
(other data), using the corresponding QuakeML element names as keys.
Changes to former SeisIO core functions
FDSNevq
now returns both an Array{SeisHdr,1} and a corresponding Array{SeisSrc,1}.- SeisIO processing functions must now be called on the
:data
field of aSeisEvent
object. They won't work if called on theSeisEvent
object itself.
read/write and SeisIO Types
read
andwrite
methods now extend to all exported SeisIO Types, including those in SeisIO.Quake. The primary use ofrseis
andwseis
will be creating indexed, searchable files of many SeisIO objects.SeisChannel
objects are no longer converted toSeisData
on write.- The native file format has been rewritten. Please open an issue if you need to access data in the old file format; we don't think anyone was using it yet.
- Write speed has improved 20-30%. Read speed improved two orders of magnitude by removing automatic compression; it's now comparable to SAC or SEG Y with fewer allocations and less overhead.
- On write, the field
:x
of a data object is no longer compressed automatically.- Two new keywords,
KW.comp
(UInt8) andKW.n_zip
(Int64), control compression- If
KW.comp == 0x00
, data are not compressed when written. - If
KW.comp == 0x01
, only compress:x
if maximum([length(S.x[i])
for i = 1:S.n]) ≥ KW.n_zip; by default,KW.n_zip = 100000
. - If
KW.comp == 0x02
, always compress:x
.
- If
- Two new keywords,
- Switched compressors from
blosclz
tolz4
. This yields orders-of-magnitude write speed improvements for long sequences of compressed data.
New Functionality
purge!
returns to remove empty and duplicate channelsresample!
does what the name suggests. Note that this is both (much) slower and more memory-intensive than a typical decimate operation
Consistency, Performance, Bug Fixes
- The + and * operators on objects of type T<: GphysData now obey
basic properties of arithmetic:- commutativity:
S1 + S2 = S2 + S1
- associativity:
(S1 + S2) + S3 = S1 + (S2 + S3)
- distributivity:
(S1*S3 + S2*S3) = (S1+S2)*S3
- commutativity:
merge!
- improved speed and memory efficiency
- duplicates of channels are now removed
- duplicates of windows within channels are now removed
- corrected handling of two (previously breaking) end-member cases:
- data windows within a channel not in chronological order
- sequential one-sample time windows in a channel
mseis!
now accepts EventTraceData and EventChannel objectsget_data
- now uses new keyword
KW.prune
to determine whether or not to remove empty
channels from partially-successful data requests - now calls
prune!
insteadmerge!
after new downloads - no longer throws warnings if removing an empty channel because its data
were unavailable
- now uses new keyword
sort!
has been extended to objects of type T<: GphysData- FDSN web queries, including
get_data
, now work correctly with the Northern California Seismic Network. sizeof(S)
should now accurately return the total size of (all data and fields) in each custom Typeisempty
is now defined for all Types- fixed incremental subrequests in long
get_data
requests. - eliminated the possibility of a (never-seen, but theoretically possible) duplicate sample error in multiday
get_data
requests. get_data
no longer treats regional searches and instrument selectors as mutually exclusive.- SeisIO keyword
nd
(number of days per subrequest) is now typeReal
(was:Int
). - shortened SeisIO keyword
xml_file
toxf
because I'm that lazy about typing. y do u ax writesac
:- once again stores channel IDs correctly
- now sets begin time (SAC
b
) from SeisChannel/SeisData:t
, rather than to 0.0. Channel start and end times usingwritesac
should now be identical towseis
andwrite
.