https://github.com/anowacki/stationxml.jl

Parse seismic station information in the FDSN StationXML format, in Julia

https://github.com/anowacki/stationxml.jl

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 2 committers (100.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

seis-jl seismology stationxml
Last synced: 10 months ago · JSON representation

Repository

Parse seismic station information in the FDSN StationXML format, in Julia

Basic Info
  • Host: GitHub
  • Owner: anowacki
  • License: other
  • Language: Julia
  • Default Branch: master
  • Homepage:
  • Size: 469 KB
Statistics
  • Stars: 1
  • Watchers: 2
  • Forks: 2
  • Open Issues: 5
  • Releases: 4
Topics
seis-jl seismology stationxml
Created over 7 years ago · Last pushed 11 months ago
Metadata Files
Readme License

README.md

StationXML

Read and write FDSN StationXML-format files describing seismic stations.

Build Status codecov

The package follows the FDSN schema.

Installation

julia import Pkg; Pkg.pkg"add https://github.com/anowacki/StationXML.jl"

Use

StationXML is mainly designed to be used by other modules such as Seis to process station information. Therefore, relatively few convenience functions are defined for working with FDSNStationXML objects. However, the package aims to comprehensively document all objects and functions used.

The basic type exported by StationXML.jl is FDSNStationXML.

Reading FDSN StationXML data

Two unexported functions are available for use in creating FDSNStationXML objects:

  • StationXML.read(filename): Read from a file on disk.
  • StationXML.readstring(string): Parse from a String.

For instance (using an example StationXML file supplied with this module):

```julia julia> using StationXML

julia> sxml = StationXML.read(joinpath(dirname(pathof(StationXML)), "..", "test", data", "JSA.xml")) StationXML.FDSNStationXML source: String "IRIS-DMC" sender: String "IRIS-DMC" modulename: String "IRIS WEB SERVICE: fdsnws-station | version: 1.1.36" moduleuri: String "http://service.iris.edu/fdsnws/station/1/query?network=GB&station=JSA&level=response&format=xml&nodata=204" created: Dates.DateTime network: Array{StationXML.Network}((1,)) schema_version: String "1.0"

```

Writing data

Simply call write on an FDSNStationXML object to write it to disk or other IO stream:

julia julia> write("output_file.xml", sxml)

StationXML.jl always writes files according to the v1.1 schema.

Note that v1.1 removed a small number of fields from the specification. Therefore, if you are writing an FDSNStationXML object read from a v1.0 file, there is the potential that information may be lost. If you are worried, pass the warn=true keyword argument to write to enable warnings for the presence of any fields which will not be written.

Accessing fields

You should access the fields of FDSNStationXML objects directly. These match the StationXML specification directly, and are listed in each type's docstrings. These are accessible via the REPL by typing ? and then the name of the type. For example:

```julia julia> ? # REPL prompt becomes help?> help> StationXML.Channel Channel

A channel is a time series recording of a component of some observable, often colocated with other channels at the same location of a station.

Equivalent to SEED blockette 52 and parent element for the related the response blockettes.

│ Note │ │ The presence of a samplerateratio without a sample_rate field is not │ allowed in the standard, but it permitted by StationXML.jl.

List of fields ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

•    description::Union{Missing, String}

    Default: missing

... ```

To find out how many stations are in each of the networks returned in your request XML, and what the network code is, you can do:

julia julia> for net in sxml.network println(net.code, ": ", net.total_number_stations, " stations") end BG: 29 stations

To get a vector of the station codes in the one network (GB) returned in our request:

```julia julia> gb = sxml.network[1];

julia> stas = [sta.code for sta in gb.station] 1-element Array{String,1}: "JSA"

```

You can also access individual networks, stations and channels using functions with these names. For example, using the SeisRequests package to get all the broadband, high-gain channels stations in the GB network from 2012 to now:

```julia julia> using StationXML, SeisRequests, Dates

julia> sxml = get_request( FDSNStation(starttime=DateTime(2012), network="GB", location="--", channel="BH?", level="channel")).body |> String |> StationXML.readstring;

julia> [s.code for s in stations(sxml)] 28-element Array{String,1}: "BIGH" "CCA1" "CLGH" "CWF" "DRUM" "DYA" "EDI" "EDMD" "ELSH" "ESK" "FOEL" "GAL1" "HMNX" "HPK" "HTL" "IOMK" "JSA" "KESW" "KPL" "LBWR" "LMK" "LRW" "MCH1" "SOFL" "STNC" "SWN1" "WACR" "WLF1"

```

Accessor functions

You can easily construct vectors of all the networks, stations and channels in the StationXML using the following accessor functions:

  • networks(stationxml)
  • stations(stationxml_or_network)
  • channels(stationxml_or_network_or_station)

Note that station, for instance, accepts either a Network or a whole FDSNStationXML object, whilst either of those or a Station can be given to channels.

julia julia> stations(gb) 28-element Array{StationXML.Station,1}: StationXML.Station(missing, StationXML.Comment[], "BIGH", 2009-12-15T00:00:00, 2599-12-31T23:59:59, StationXML.RestrictedStatus value: String "open" ...

The channel_codes function returns a list of all of the channel codes within a FDSNStationXML document or a Network.

Dot-access to arrays of objects

Note: getproperty access for arrays of these objects is deprecated and will be removed in a future version.

The module defines getproperty methods for conveniently accessing the fields of each member of arrays of Networks, Stations and Channels. So our previous example of finding all the station codes could actually have been done like this:

julia julia> stations(sxml).code 28-element Array{String,1}: "BIGH" "CCA1" "CLGH" "CWF" ...

We can equally access any other field of the items this way:

julia julia> channels(sxml).longitude 84-element Array{Float64,1}: StationXML.Longitude(-3.9087, missing, missing, missing, "WGS84") StationXML.Longitude(-3.9087, missing, missing, missing, "WGS84") StationXML.Longitude(-3.9087, missing, missing, missing, "WGS84") StationXML.Longitude(-5.227299, missing, missing, missing, "WGS84") StationXML.Longitude(-5.227299, missing, missing, missing, "WGS84") StationXML.Longitude(-5.227299, missing, missing, missing, "WGS84") StationXML.Longitude(-6.110599, missing, missing, missing, "WGS84") StationXML.Longitude(-6.110599, missing, missing, missing, "WGS84") StationXML.Longitude(-6.110599, missing, missing, missing, "WGS84") ⋮

Merging multiple sets of metadata

merge[!]

You can merge together mulitiple FDSNStationXML objects with merge (returining a copy and not modifying the originals), or merge!, which updates the first object given. In situations where it is obvious that two networks, stations or channels are the same, these will not be duplicated in the final merged object. Cases which are ambiguous are not merged and the user is warned by default.

append!

As an alternative to merge!, one can simply append! two objects together. This simply has the effect of copying everything in one FDSNStationXML object into another, and duplication is not avoided.

Structure of objects

StationXML represents the XML as laid out in the StationXML schema. Therefore, it contains all the information in a StationXML file which is part of the StationXML standard. Elements and attributes of the XML are fields within structures nested several layers deep.

Contributing

Bugs and omissions

StationXML.jl should read any schema-compatible StationXML file without error, therefore any examples of documents failing are very warmly welcomed as are all bug reports.

Please open an issue with a link to the document which is causing problems and as much information as possible about how to reproduce your error.

Features

If you would like to add a feature to StationXML, this will be seriously considered. The package aims to be fairly minimal so please think very carefully before adding large dependencies.

New code for the repo should come via a pull request.

Owner

  • Name: Andy Nowacki
  • Login: anowacki
  • Kind: user

Lecturer at the School of Earth and Environment, University of Leeds, studying the Earth's deep interior.

GitHub Events

Total
  • Create event: 3
  • Commit comment event: 2
  • Release event: 1
  • Watch event: 1
  • Delete event: 2
  • Issue comment event: 2
  • Push event: 6
  • Pull request event: 4
Last Year
  • Create event: 3
  • Commit comment event: 2
  • Release event: 1
  • Watch event: 1
  • Delete event: 2
  • Issue comment event: 2
  • Push event: 6
  • Pull request event: 4

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 78
  • Total Committers: 2
  • Avg Commits per committer: 39.0
  • Development Distribution Score (DDS): 0.013
Top Committers
Name Email Commits
Andy Nowacki a****i@l****k 77
Andy Nowacki a****i@b****k 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 8
  • Total pull requests: 9
  • Average time to close issues: 8 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 0.25
  • Average comments per pull request: 0.22
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 5
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 4 days
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.5
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • anowacki (7)
  • JuliaTagBot (1)
Pull Request Authors
  • dependabot[bot] (11)
  • anowacki (5)
  • JuliaTagBot (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (11) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 3 total
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
juliahub.com: StationXML

Parse seismic station information in the FDSN StationXML format, in Julia

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 3 Total
Rankings
Dependent repos count: 9.9%
Forks count: 33.3%
Average: 38.8%
Dependent packages count: 38.9%
Stargazers count: 73.2%
Last synced: 11 months ago

Dependencies

.github/workflows/CI.yml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • codecov/codecov-action v1 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/CompatHelper.yml actions
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite