Skip to main content

A bunch of really useful codes for earthquake stuff

Project description

License Stars Pyversions Version Downloads Code style: black Codacy Badge Codecov Build Docs DOI

Inspired by bruges, bruces aims to be a collection of lightweight codes/tools for seismology with an emphasis on computational efficiency.

Installation

The recommended way to install bruces and all its dependencies is through the Python Package Index:

pip install bruces[full] --user

Otherwise, clone and extract the package, then run from the package location:

pip install .[full] --user

To test the integrity of the installed package, check out this repository and run:

pytest

Documentation

Refer to the online documentation for detailed description of the API and examples.

Alternatively, the documentation can be built using Sphinx:

pip install -r doc/requirements.txt
sphinx-build -b html doc/source doc/build

Example

The following code snippet will decluster a catalog downloaded with pycsep using the nearest-neighbor method:

from datetime import datetime

import csep
import matplotlib.pyplot as plt

import bruces

# Download catalog using pycsep
catalog = csep.query_comcat(
   start_time=datetime(2008, 1, 1),
   end_time=datetime(2018, 1, 1),
   min_magnitude=3.0,
   min_latitude=35.0,
   max_latitude=37.0,
   min_longitude=-99.5,
   max_longitude=-96.0,
)

# Decluster pycsep catalog
cat = bruces.from_csep(catalog)
eta_0 = cat.fit_cutoff_threshold()
catd = cat.decluster(method="thinning", eta_0=eta_0)

# Display declustering result
fig, ax = plt.subplots(1, 2, figsize=(12, 6))
cat.plot_time_space_distances(eta_0=eta_0, eta_0_diag=eta_0, ax=ax[0])
catd.plot_time_space_distances(eta_0=eta_0, eta_0_diag=eta_0, ax=ax[1])
sample

Contributing

Please refer to the Contributing Guidelines to see how you can help. This project is released with a Code of Conduct which you agree to abide by when contributing.

Notice

bruces Copyright (c) 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved. If you have questions about your rights to use or distribute this software, please contact Berkeley Lab’s Intellectual Property Office at IPO@lbl.gov.

This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit others to do so.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bruces-0.5.0.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

bruces-0.5.0-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

Details for the file bruces-0.5.0.tar.gz.

File metadata

  • Download URL: bruces-0.5.0.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for bruces-0.5.0.tar.gz
Algorithm Hash digest
SHA256 b4b868cbdfe032ed597c84c3e9c47e280d1123ad79e3fbcfb4e22de8aa61d393
MD5 3be9cbcd01fd12b4decaaff7192f9259
BLAKE2b-256 a81064c5cfc1aa07d134e58517ac460f652db7ef13eac6e7c740387374247b4b

See more details on using hashes here.

File details

Details for the file bruces-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: bruces-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 36.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for bruces-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 521ff7fb9371d8b5a452fb31d18694a25c779f005735bbbc964c8136142559ad
MD5 fbd26d8fe0b73ff4e9f9e95099369ca1
BLAKE2b-256 51f7f502b9032660b58cd4070c01d594e18c2a63b16c6534e15e7d7c58df52ec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page