Coder Social home page Coder Social logo

qmlutil's Introduction

qmlutil

Utilities for QuakeML

In a perfect world, all professional seismological applications speak QuakeML. This is for when that doesn't happen.

About

This is the Nevada Seismological Lab's python package for dealing with "QML", the QuakeML Model Language schema. It mostly contains housekeeping classes and functions for dealing with python dicts and lists adhering to the QuakeML v1.2 schema. It contains some schema converter classes, and a few plugins for using 3rd party libraries.

This module is a work-in-progress, and may change until a 1.0 release. That said, the goal is to keep the current methods and API stable up to and through the 1.0. NSL is currently using this lib in production, so it behooves us not to change the API as much as possible. More/better doc to come, hopefully.

NSL builds all python libraries as wheels; to build qmlutil, clone the repo and build an installable wheel in the top-level directory:

% git clone https://github.com/NVSeismoLab/qmlutil
% pip wheel -w /tmp ./

Philosophy

This module aims to:

  • be written in pure python
  • have zero (or minimal) dependencies
  • prefer python data structures over classes

Rather than map classes to classes, and have to write custom JSON, XML, etc encoders, this module attempts to do schema translation using python dicts, lists, etc as fundamental units of records, rows, and documents. There are many good existing implementations of QuakeML classes, including those distributed by quakeml.org, and the excellent ObsPy framework. Those or other custom classes can easily be built using the structures from this module. Being in pure python allows this lib to be used by other interpreters, i.e. pypy. Another goal of this project is to produce structures which can easily be serialized to other wire formats, i.e. JSON, msgpack, Avro, or Protocol Buffers.

The core of this module has no external dependencies. Serialization to XML is done through the xmltodict module, which is included in this package. There are plugins, which do have external dependencies. For instance, serialization to XML is pure python, but the XSD schema validator currently depends on the lxml package (validating is highly recommended in production).

Description

Core

  • qmlutil.css - Convert between CSS3.0 and QML1.2 schemas (currently only CSS->QML)
  • qmlutil.ichinose - Convert Ichinose moment tensor text output to QML1.2
  • qmlutil.lib - Contains vendored packages
  • qmlutil.xml - Serialize a python QML structure (dicts + lists) to XML/QuakeML

Require other python libs

  • qmlutil.plugins.antelope_db - Contains converter classes for Antelope CSS databases
  • qmlutil.plugins.xml - Contains classes for more advanced XML tasks that require libxml2

Dependencies

There are no deps for core. The plugins modules have various vendor reqs:

  • The antelope_db plugin requires the proprietary antelope packages and NSL's curds2 DBAPI driver
  • The xml plugin requires the lxml package

License

Copyright 2016 University of Nevada, Reno

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

qmlutil's People

Contributors

markcwill avatar nackerley avatar michalkolaj avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.