Skip to content

Commit d758a15

Browse files
authored
Merge branch 'SCECcode:master' into master
2 parents 51690bc + 9e53c0a commit d758a15

22 files changed

+452
-171
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: docs
2+
on:
3+
pull_request:
4+
branches: [ master ]
5+
jobs:
6+
build_docs:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Set up Python 3.7
11+
uses: actions/setup-python@v2
12+
with:
13+
python-version: 3.7
14+
- name: Install dependencies
15+
run: |
16+
sudo apt-get update
17+
sudo apt-get install libproj-dev proj-data proj-bin
18+
sudo apt-get install libgeos-dev
19+
sudo apt-get install python3-sphinx
20+
python -m pip install --upgrade pip
21+
pip install numpy
22+
pip install wheel
23+
pip install pytest pytest-cov
24+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
25+
pip install pillow
26+
- name: Install PyCSEP
27+
run: |
28+
python setup.py install
29+
- name: Build documentation
30+
run: |
31+
make -C docs clean
32+
make -C docs html

.github/workflows/build-sphinx.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ on:
66

77
jobs:
88
build_docs:
9-
109
runs-on: ubuntu-latest
11-
1210
steps:
1311
- uses: actions/checkout@v2
1412
- name: Set up Python 3.7
@@ -22,15 +20,11 @@ jobs:
2220
sudo apt-get install libgeos-dev
2321
sudo apt-get install python3-sphinx
2422
python -m pip install --upgrade pip
25-
pip install numpy==1.18.4
23+
pip install numpy
2624
pip install wheel
2725
pip install pytest pytest-cov
2826
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29-
pip install sphinx-gallery>=0.7.0
30-
pip install sphinx-rtd-theme
3127
pip install pillow
32-
pip uninstall -y shapely
33-
pip install shapely --no-binary shapely
3428
- name: Install PyCSEP
3529
run: |
3630
python setup.py install

.github/workflows/python-app.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
build:
1414

1515
runs-on: ubuntu-latest
16-
1716
steps:
1817
- uses: actions/checkout@v2
1918
- name: Set up Python 3.7

CONTRIBUTING.md

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Contributing to PyCSEP
1+
# Contributing to pyCSEP
22

3-
This document provides an overview on how to contribute to PyCSEP. It will provide step-by-step instructions and hope to
3+
This document provides an overview on how to contribute to pyCSEP. It will provide step-by-step instructions and hope to
44
answer some questions.
55

66

77
## Getting Started
88

99
* Make sure you have an active GitHub account
10-
* Download and install git
11-
* Read the git documentation
12-
* Install a development version of PyCSEP
13-
* If you haven't worked with Git Forks before, make sure to read the documentation linked here:
10+
* Download and install `git`
11+
* Read git documentaion if you aren't familiar with `git`
12+
* Install the **development version** of PyCSEP
13+
* If you haven't worked with git Forks before, make sure to read the documentation linked here:
1414
[some helping info](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/working-with-forks).
1515

1616
## Developer Installation
@@ -24,17 +24,21 @@ We recommend using `conda` to install the development environment.
2424
conda env create -f requirements.yml
2525
conda activate csep-dev
2626
pip install -e .[all]
27-
# sync with default repository
27+
# add upstream repository
2828
git remote add upstream https://github.com/SCECCode/pycsep.git
2929

30-
Note: use the commend `conda deactivate` to go back to your regular environment.
30+
Note: use the command `conda deactivate` to go back to your regular environment when you are done working with pyCSEP.
3131

3232
## Submitting a Pull Request
3333

34-
Pull requests are great! Please submit them to us! Here's how:
34+
### Some notes for starting a pull request
35+
36+
Pull requests are how we use your changes to the code! Please submit them to us! Here's how:
3537

3638
1. Make a new branch. For features/additions base your new branch at `master`.
37-
2. Add a test! Only pull requests for documentation and refactoring do not require a test.
39+
2. Make sure to add tests! Only pull requests for documentation, refactoring, or plotting features do not require a test.
40+
3. Also, documentation must accompany new feature requests.
41+
- Note: We would really appreciate pull requests that help us improve documentation.
3842
3. Make sure the tests pass. Run `./run_tests.sh` in the top-level directory of the repo.
3943
4. Push your changes to your fork and submit a pull request. Make sure to set the branch to `pycsep:master`.
4044
5. Wait for our review. There may be some suggested changes or improvements. Changes can be made after
@@ -43,9 +47,26 @@ the pull request has been opening by simply adding more commits to your branch.
4347
Pull requests can be changed after they are opened, so create a pull request as early as possible.
4448
This allows us to provide feedback during development and to answer any questions.
4549

46-
Please make sure to set the correct branch for your pull request. Also, please do not include large files in your pull request.
47-
If you feel that you need to add large files, let us know and we can figure something out.
50+
Also, if you find pyCSEP to be useful, but don't want to contribute to the code we highly encourage updates to the documentation!
4851

52+
Please make sure to set the correct branch for your pull request. Also, please do not include large files in your pull request.
53+
If you feel that you need to add large files, such as a benchmark forecast, let us know and we can figure something out.
54+
55+
### Tips to get your pull request accepted quickly
56+
57+
1. Any new feature that contains calculations must contain unit-tests to ensure that the calculations are doing what you
58+
expect. Some exceptions to this are documentation changes and new plotting features.
59+
2. Documentation should accompany any new feature additions into the package.
60+
* Plotting functions should provide a sphinx-gallery example, which can be found [here](https://github.com/SCECcode/pycsep/blob/master/examples/tutorials/catalog_filtering.py).
61+
* More complex features might require additional documentation. We will let you know upon seeing your pull request.
62+
* The documentation use sphinx which compiles reST. Some notes on that can be found [here](https://www.sphinx-doc.org/en/master/usage/quickstart.html).
63+
3. pyCSEP uses pytest as a test runner. Add new tests to the `tests` folder in an existing file or new file starting matching `test_*.py`
64+
4. New scientific capabilities that are not previously published should be presented to the CSEP science group as part of a
65+
science review. This will consist of a presentation that provides a scientific justification for the feature.
66+
5. Code should follow the [pep8](https://pep8.org/) style-guide.
67+
6. Functions should use [Google style docstrings](https://www.sphinx-doc.org/en/master/usage/extensions/example_google.html). These
68+
get compiled by Sphinx to become part of the documentation.
69+
4970
## Submitting an Issue
5071

5172
Please open an issue if you want to ask a question about PyCSEP.
@@ -54,15 +75,17 @@ Please open an issue if you want to ask a question about PyCSEP.
5475
* Please apply the correct tag to your issue so others can search
5576

5677
If you want to submit a bug report, please provide the information below:
57-
* PyCSEP version, Python version, and Platform (Linux, Windows, Mac OSX, etc)
58-
* How did you install PyCSEP (pip, anaconda, from source...)
78+
* pyCSEP version, Python version, and Platform (Linux, Windows, Mac OSX, etc)
79+
* How did you install pyCSEP (pip, anaconda, from source...)
5980
* Please provide a short, complete, and correct example that demonstrates the issue.
6081
* If this broke in a recent update, please tell us when it used to work.
6182

6283
## Additional Resources
6384
* [Working with Git Forks](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/working-with-forks)
6485
* [Style Guide](http://google.github.io/styleguide/pyguide.html)
6586
* [Docs or it doesn’t exist](https://lukeplant.me.uk/blog/posts/docs-or-it-doesnt-exist/)
87+
* [Quickstart guide for Sphinx](https://www.sphinx-doc.org/en/master/usage/quickstart.html)
88+
* [Pep8 style guide](https://pep8.org/)
6689
* Performance Tips:
6790
* [Python](https://wiki.python.org/moin/PythonSpeed/PerformanceTips)
6891
* [NumPy and ctypes](https://scipy-cookbook.readthedocs.io/)

CREDITS.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
PyCSEP development is a group effort.
2+
3+
Contributors:
4+
* William Savran, Southern California Earthquake Center
5+
* Pablo Iturrieta, GFZ Potsdam
6+
* Khawaja Asim, GFZ Potsdam
7+
* Thomas Beutin, GFZ Potsdam
8+
* Jose Bayona, University of Bristol
9+
* Marcus Hermann, University of Naples 'Frederico II'
10+
* Edric Pauk, Southern California Earthquake Center
11+
* Max Werner, University of Bristol
12+
* Danijel Schorlemmner, GFZ Potsdam
13+
* Philip Maechling, Southern California Earthquake Center
14+
15+
Thanks to everyone for all your contributions!

LICENSE renamed to LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2020, The University of Southern California
1+
Copyright (c) 2021, The University of Southern California
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

PULL_REQUEST_TEMPLATE.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# pyCSEP Pull Request Checklist
2+
3+
Please check out the [contributing guidelines](https://github.com/SCECcode/pycsep/blob/master/CONTRIBUTING.md) for some tips
4+
on making pull requests to pyCSEP.
5+
6+
Fixes issue #(*please fill in or delete if not needed*).
7+
8+
## Type of change:
9+
10+
Please delete options that are not relevant.
11+
12+
- [ ] Bug fix (non-breaking change which fixes an issue)
13+
- [ ] New feature (non-breaking change which adds functionality)
14+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
15+
- [ ] Documentation update (this pull request adds no new code)
16+
- [ ] Unpublished science feature (This may require a science review)
17+
- [ ] This change requires a documentation update
18+
19+
## Checklist:
20+
21+
- [ ] I have performed a self-review of my own code
22+
- [ ] I have commented my code, particularly in hard-to-understand areas
23+
- [ ] I have made corresponding changes to the documentation
24+
- [ ] My changes generate no new warnings
25+
- [ ] I have added tests that prove my fix is effective or that my feature works
26+
- [ ] New and existing unit tests pass locally with my changes

README.md

Lines changed: 74 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,85 @@
1-
# PyCSEP: Collaboratory for the Study of Earthquake Predictability
2-
3-
![](http://hypocenter.usc.edu/research/badges/CSEP2_Logo_CMYK.png)
4-
5-
![Python version](http://hypocenter.usc.edu/research/badges/pycsep-python.svg)
1+
# pyCSEP: Collaboratory for the Study of Earthquake Predictability
2+
![](https://i.postimg.cc/Bb60rVQP/CSEP2-Logo-CMYK.png)
3+
![Python version](https://gist.githubusercontent.com/wsavran/efce311162c32460336a4f9892218532/raw/1b9c060efd1c6e52eb53f82d4249107417d6a5ec/pycsep_python_badge.svg)
64
![Python application](https://github.com/SCECCode/csep2/workflows/Python%20application/badge.svg)
75
[![Build sphinx documentation](https://github.com/SCECCode/csep2/workflows/Build%20sphinx%20documentation/badge.svg)](https://cseptesting.org)
86
[![codecov](https://codecov.io/gh/SCECcode/pycsep/branch/master/graph/badge.svg?token=HTMKM29MAU)](https://codecov.io/gh/SCECcode/pycsep)
97

10-
The PyCSEP tools help earthquake forecast model developers evaluate their forecasts with the goal of understanding
8+
# Description:
9+
The pyCSEP Toolkit helps earthquake forecast model developers evaluate their forecasts with the goal of understanding
1110
earthquake predictability.
1211

13-
PyCSEP should:
12+
pyCSEP should:
1413
1. Help modelers become familiar with formats, procedures, and evaluations used in CSEP Testing Centers.
1514
2. Provide vetted software for model developers to use in their research.
16-
3. Provide quantative and visual tools to assess earthquake forecast quality.
15+
3. Provide quantitative and visual tools to assess earthquake forecast quality.
1716
4. Promote open-science ideas by ensuring transparency and availability of scientific code and results.
1817
5. Curate benchmark models and data sets for modelers to conduct retrospective experiments of their forecasts.
1918

20-
## Using Conda
21-
22-
The easiest way to install PyCSEP is using `conda`. It can also be installed using `pip` or built from source.
23-
If you plan on contributing to this package, visit the
24-
[contribution guidelines](https://github.com/SCECcode/pycsep/blob/master/CONTRIBUTING.md) for
25-
installation instructions. We recommend creating a `conda` environment for this installation, but this is not a required step.
26-
27-
conda create -n pycsep
28-
conda activate pycsep
29-
30-
Install `pycsep`
31-
32-
conda install --channel conda-forge pycsep
33-
34-
## Using Pip
35-
36-
Before this installation will work, you must **first** install the following system dependencies. The remaining dependencies
37-
should be installed by the installation script. To help manage dependency issues, we recommend using virtual environments
38-
like `virtualenv`.
39-
40-
Python 3.7 or later (https://python.org)
41-
42-
NumPy 1.10 or later (https://numpy.org)
43-
    Python package for scientific computing and numerical calculations.
44-
45-
GEOS 3.3.3 or later (https://trac.osgeo.org/geos/)
46-
    C++ library for processing geometry.
47-
48-
PROJ 4.9.0 or later (https://proj4.org/)
49-
    Library for cartographic projections.
50-
51-
Example for Ubuntu:
52-
53-
sudo apt-get install libproj-dev proj-data proj-bin
54-
sudo apt-get install libgeos-dev
55-
pip install --upgrade pip
56-
pip install numpy
57-
58-
Example for MacOS:
59-
60-
brew install proj geos
61-
pip install --upgrade pip
62-
pip install numpy
63-
64-
### From Source
65-
66-
Use this approach if you want the most up-to-date code. This creates an editable installation that can be synced with
67-
the latest GitHub commit.
68-
69-
We recommend using virtual environments when installing python packages from source to avoid any dependency conflicts. We prefer
70-
`conda` as the package manager over `pip`, because `conda` does a good job of handling binary distributions of packages
71-
across multiple platforms. Also, we recommend using the `miniconda` installer, because it is lightweight and only includes
72-
necessary pacakages like `pip` and `zlib`.
73-
74-
#### Using Conda
75-
If you don't have `conda` on your machine, download and install [Miniconda](https://docs.conda.io/en/latest/miniconda.html).
76-
77-
git clone https://github.com/SCECcode/pycsep
78-
cd pycsep
79-
conda env create -f requirements.yml
80-
conda activate csep-dev
81-
# Installs in editor mode with all dependencies
82-
pip install -e .
83-
84-
Note: If you want to go back to your default environment use the command `conda deactivate`.
85-
86-
#### Using Pip / Virtualenv
87-
88-
We highly recommend using Conda, because this tools helps to manage binary dependencies on Python packages. If you
89-
must use [Virtualenv](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)
90-
follow these instructions:
91-
92-
git clone https://github.com/SCECcode/pycsep
93-
cd pycsep
94-
python -m virtualenv venv
95-
source venv/bin/activate
96-
# Installs in editor mode with all dependencies
97-
pip install -e .[all]
98-
99-
Note: If you want to go back to your default environment use the command `deactivate`.
100-
101-
## Documentation and Changelog
102-
103-
The documentation can be found at [here](https://cseptesting.org), and the changelog can be found
104-
[here](https://github.com/SCECcode/pycsep/blob/master/CHANGELOG.txt).
105-
106-
## Releases
107-
108-
We follow [semver](https://semver.org/) for our versioning strategy.
19+
# Table of Contents:
20+
1. [Software Documentation](https://docs.cseptesting.org)
21+
2. [Installation](#installation)
22+
3. [Usage](#usage)
23+
4. [Contributing](#contributing)
24+
5. [Change Log](https://github.com/SCECcode/pycsep/blob/master/CHANGELOG.txt)
25+
6. [Credits](#credits)
26+
7. [License](#license)
27+
28+
# Installation:
29+
pyCSEP can be installed in several ways. It can be installed using conda or pip package managers or from the
30+
source code found in the pyCSEP github repo. Researchers interested in contributing to pyCSEP development should
31+
install pyCSEP from source code. pyCSEP depends on the following software packages.
32+
These which may be installed automatically, or manually, depending on the installation method used.
33+
* Python 3.7 or later (https://python.org)
34+
* NumPy 1.21.3 or later (https://numpy.org)
35+
* SciPy 1.7.1 or later (https://scipy.org)
36+
* pandas 1.3.4 or later (https://pandas.pydata.org)
37+
* cartopy 0.20.0 or later (https://scitools.org.uk/cartopy/docs/latest)
38+
* GEOS 3.7.2 or later (https://trac.osgeo.org/geos/)
39+
* PROJ 8.0.0 or later (https://proj.org/)
40+
41+
Please see the [requirements file](https://github.com/SCECcode/pycsep/blob/master/requirements.yml) for a complete list
42+
of requirements. These are installed automatically when using the `conda` distribution.
43+
44+
Detailed pyCSEP [installation instructions](https://docs.cseptesting.org/getting_started/installing.html) can be found
45+
in the online pyCSEP documentation.
46+
47+
# Usage:
48+
Once installed, pyCSEP methods can be invoked from python code by importing package csep. pyCSEP provides objects and
49+
utilities related to several key concepts:
50+
* Earthquake Catalogs
51+
* Earthquake Forecasts
52+
* Earthquake Forecast Evaluations
53+
* Regions
54+
55+
An simple example to download and plot an earthquake catalog from the USGS ComCat:
56+
<pre>
57+
import csep
58+
from csep.core import regions
59+
from csep.utils import time_utils
60+
start_time = time_utils.strptime_to_utc_datetime('2019-01-01 00:00:00.0')
61+
end_time = time_utils.utc_now_datetime()
62+
catalog = csep.query_comcat(start_time, end_time)
63+
catalog.plot()
64+
</pre>
65+
66+
Please see [pyCSEP Getting Started](https://docs.cseptesting.org/getting_started/core_concepts) documentation for more examples and tutorials.
67+
68+
# Software Support:
69+
Software support for pyCSEP is provided by that Southern California Earthquake Center (SCEC) Research Computing Group.
70+
This group supports several research software distributions including UCVM. Users can report issues and feature requests
71+
using the pyCSEP github-based issue tracking link below. Developers will also respond to emails sent to the SCEC software contact listed below.
72+
1. [pyCSEP Issues](https://github.com/SCECcode/pycep/issues)
73+
2. Email Contact: software [at] scec [dot] usc [dot] edu
74+
75+
# Contributing:
76+
We welcome contributions to the pyCSEP Toolkit. If you would like to contribute to this package, including software, tests, and documentation,
77+
please visit the [contribution guidelines](https://github.com/SCECcode/pycsep/blob/master/CONTRIBUTING.md) for guidelines on how to contribute to pyCSEP development.
78+
pyCSEP contributors agree to abide by the code of conduct found in our [Code of Conduct](CODE_OF_CONDUCT.md) guidelines.
79+
80+
# Credits:
81+
Development of pyCSEP is a group effort. A list of developers that have contributed to the PyCSEP Toolkit
82+
are listed in the [credits](CREDITS.md) file in this repository.
83+
84+
# License:
85+
The pyCSEP software is distributed under the BSD 3-Clause open-source license. Please see the [license](LICENSE.txt) file for more information.

0 commit comments

Comments
 (0)