Giter VIP home page Giter VIP logo

csspy's Introduction

csspy

csspy is a simple package for reading centers for seismic studies event format (v 3.0). csspy is not real polished, nor do I plan to aggressively maintain it, but you may find it useful for extracting event information from the ANF catalog (http://anf.ucsd.edu/tools/events/) as dataframes or obspy Catalog objects.

Installation

csppy requires python 3.6. You can install csspy using pip + git

$ pip install git+https://github.com/d-chambers/csspy

Quickstart

Supposing you have downloaded and extracted the ANF catalog from 2007_08. You should now have a file called "events_usarray_2007_08" in your current directory. As an example we will extract the events associated with the Crandall Canyon mine collapse

from pathlib import Path

import obspy

import csspy


# get a path object pointing to the catalog directory
path = Path("events_usarray_2007_08")

# load data into a dict of dataframes (if you are wanting css 3.0 format)
df_dict = csspy.dir_to_df(path)

# filter by day and location
t1 = obspy.UTCDateTime('2007-08-06')
t2 = obspy.UTCDateTime('2007-08-08')
latmin = 39.4
latmax = 39.53
lonmin = -111.29
lonmax = -111.07

df_dict = csspy.dir_to_df(path, starttime=t1, endtime=t2, 
                          minlatitude=latmin, maxlatitude=latmax,
                          minlongitude=lonmin, maxlongitude=lonmax)

# convert to an obspy catalog (still a bit rough)
cat = csspy.css_to_catalog(df_dict) 

# now you can fill any missing network codes or location codes
network = 'TA'
location = '--'

cat = csspy.set_seed_defaults(cat, network=network, location=location)

print(cat)

cat.plot(projection='local')

csspy's People

Contributors

d-chambers avatar

Stargazers

 avatar

Watchers

 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.