Skip to content

Commit 5d1219f

Browse files
committed
resolve conflicts
2 parents fb86e36 + 8b1dbac commit 5d1219f

33 files changed

Lines changed: 1845 additions & 833 deletions

.github/workflows/docs.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build-and-deploy:
9+
name: build and deploy docs
10+
runs-on: ubuntu-latest
11+
env:
12+
MPLBACKEND: 'Agg'
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python 3.11
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: 3.11
21+
22+
- name: Install OQ and dependencies
23+
run: |
24+
sudo apt-get install -y libspatialindex-dev
25+
git clone --depth=1 https://github.com/gem/oq-engine.git
26+
cd oq-engine
27+
python ./install.py devel
28+
cd ..
29+
source $HOME/openquake/bin/activate
30+
pip install h3
31+
pip install -r requirements.txt
32+
pip install -e .
33+
pip install sphinx furo recommonmark
34+
35+
- name: Build HTML docs
36+
run: |
37+
source $HOME/openquake/bin/activate
38+
sphinx-build -b html doc_src/source doc_src/build/html
39+
touch doc_src/build/html/.nojekyll
40+
41+
- name: Deploy to GitHub Pages
42+
uses: peaceiris/actions-gh-pages@v4
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_branch: gh-pages
46+
publish_dir: doc_src/build/html/
47+
commit_message: "deploy docs from master"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: docs preview
2+
3+
on:
4+
push:
5+
branches: [ docs ]
6+
7+
jobs:
8+
build-and-deploy:
9+
name: build and deploy docs preview
10+
runs-on: ubuntu-latest
11+
env:
12+
MPLBACKEND: 'Agg'
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python 3.11
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: 3.11
21+
22+
- name: Install OQ and dependencies
23+
run: |
24+
sudo apt-get install -y libspatialindex-dev
25+
git clone --depth=1 https://github.com/gem/oq-engine.git
26+
cd oq-engine
27+
python ./install.py devel
28+
cd ..
29+
source $HOME/openquake/bin/activate
30+
pip install h3
31+
pip install -r requirements.txt
32+
pip install -e .
33+
pip install sphinx furo recommonmark
34+
35+
- name: Build HTML docs
36+
run: |
37+
source $HOME/openquake/bin/activate
38+
sphinx-build -b html doc_src/source doc_src/build/html
39+
touch doc_src/build/html/.nojekyll
40+
41+
- name: Deploy preview to gh-pages/preview/docs
42+
uses: peaceiris/actions-gh-pages@v4
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_branch: gh-pages
46+
publish_dir: doc_src/build/html/
47+
destination_dir: preview/docs
48+
commit_message: "docs preview from docs branch"

.github/workflows/test.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
schedule:
9+
- cron: "0 1 * * *"
10+
11+
jobs:
12+
test:
13+
name: pytest
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python 3.11
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: 3.11
22+
- name: Install OQ and dependencies
23+
run: |
24+
sudo apt-get install libspatialindex-dev
25+
git clone --depth=1 https://github.com/gem/oq-engine.git
26+
cd oq-engine
27+
python ./install.py devel
28+
cd ..
29+
source $HOME/openquake/bin/activate
30+
pip install h3
31+
pip install -r requirements.txt
32+
pip install -e .
33+
deactivate
34+
- name: Run test with pytest
35+
run: |
36+
source $HOME/openquake/bin/activate
37+
pytest openquake tests -W ignore::UserWarning

.github/workflows/test_page.yaml

Lines changed: 0 additions & 70 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ instance/
7070

7171
# Sphinx documentation
7272
docs/_build/
73+
doc_src/build/
74+
doc_src/source/_api/
7375

7476
# PyBuilder
7577
target/

README.md

Lines changed: 36 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,67 @@
11
# Hamlet: Hazard Model Evaluation and Testing
22

3-
Hamlet (`openquake.hme`) is a Python package developed (OK, in
4-
development) for qualitative and quantitative evaluation of
5-
Probabilistic Seismic Hazard Analysis (PSHA) models, with the intention
6-
of providing feedback to modelers during the model construction process,
7-
to aid model development. Hamlet is developed by the [GEM
3+
Hamlet (`openquake.hme`) is a Python package for qualitative and quantitative
4+
evaluation of Probabilistic Seismic Hazard Analysis (PSHA) models, with the
5+
intention of providing feedback to modelers during the model construction
6+
process, to aid model development. Hamlet is developed by the [GEM
87
Foundation](https://www.globalquakemodel.org), and uses the
98
[OpenQuake](https://github.com/GEM/oq-engine) software extensively.
109

11-
Hamlet will incorporate several model test frameworks, including those
12-
developed by GEM and some of those developed outside of GEM such as the
13-
[RELM](http://cseptesting.org/documents/relm.php) tests. Currently, and
14-
likely in the future, the model files will be required to be in the
15-
[OpenQuake](https://github.com/GEM/oq-engine) format, regardless of the
16-
format of their original implementation.
17-
18-
Most of the Hamlet evaluations are spatial in nature; the model domain
19-
is discretized into grid cells, and comparisons between observations and
20-
model predictions are performed in each grid cell, to highlight where in
21-
the domain the model matches the observations, and where it might need
22-
some refinement.
23-
24-
Additionally, unlike some other hazard model testing frameworks, Hamlet
25-
is designed to operate on separate components of a hazard model, so that
26-
each component can be evaluated against its corresponding data. For
27-
example, each branch of a source model logic tree can be tested
28-
independently, and each type of source (e.g., subduction megathrust,
29-
crustal, in-slab) can be tested independently as well, in the spatial
30-
framework described above.
10+
Hamlet incorporates several model test frameworks, including those developed by
11+
GEM and some of those developed outside of GEM such as the
12+
[RELM/CSEP](http://cseptesting.org/documents/relm.php) tests. The model files
13+
must be in the [OpenQuake](https://github.com/GEM/oq-engine) format.
14+
15+
Most of the Hamlet evaluations are spatial in nature; the model domain is
16+
discretized into grid cells, and comparisons between observations and model
17+
predictions are performed in each grid cell, to highlight where in the domain
18+
the model matches the observations, and where it might need some refinement.
19+
20+
Additionally, unlike some other hazard model testing frameworks, Hamlet is
21+
designed to operate on separate components of a hazard model, so that each
22+
component can be evaluated against its corresponding data. For example, each
23+
branch of a source model logic tree can be tested independently, and each type
24+
of source (e.g., subduction megathrust, crustal, in-slab) can be tested
25+
independently as well, in the spatial framework described above.
3126

3227
## Quickstart
3328

3429
### Installation
3530

36-
Hamlet requires installation Python v.3.7+, the
37-
[OpenQuake](https://github.com/GEM/oq-engine) engine, and some
38-
additional dependencies as well. These are specified in the
39-
`requirements.txt` file.
40-
41-
(*Note:* A few of the dependencies might be challenging to install.
42-
These are [Rtree](https://toblerity.org/rtree/) and
43-
[h3-py](https://github.com/uber/h3-py). You may have to install
44-
`libspatialindex` or `libspatialindex-dev` on Linux or MacOS first,
45-
depending on your system, for `Rtree`. `h3-py` requires `cc` and `make`,
46-
but then on Linux/MacOS can be installed easily. Please see the
47-
documentation for each.)
48-
49-
First, install the [OpenQuake](https://github.com/GEM/oq-engine) engine,
50-
following directions on that website. You probably want to install it
51-
into a virtual environment, and you may even want to have a separate
52-
virtual environment for running Hamlet than the
53-
[OpenQuake](https://github.com/GEM/oq-engine) virtual environment that
54-
you normally use (this is up to you).
31+
Hamlet requires Python 3.11+ and the
32+
[OpenQuake](https://github.com/GEM/oq-engine) engine.
33+
34+
First, install the OpenQuake engine, following directions on that website. You
35+
probably want to install it into a virtual environment.
5536

5637
Then, clone the Hamlet repository, and from that directory, install the
5738
requirements:
5839

5940
```bash
60-
pip install -r requirements.txt
41+
pip install -r requirements.txt
6142
```
6243

6344
and then install Hamlet:
6445

6546
```bash
66-
pip install -e .
47+
pip install -e .
6748
```
6849

6950
### Running Hamlet
7051

71-
Hamlet only requires a seismic hazard model (implemented in
72-
[OpenQuake](https://github.com/GEM/oq-engine)) and a processed seismic
73-
catalog (declustered, and ideally classified by source type) to run.
74-
Once installed, Hamlet can be run from the command line:
52+
Hamlet requires a seismic hazard model (implemented in OpenQuake) and a
53+
processed seismic catalog (declustered, and ideally classified by source type)
54+
to run. Once installed, Hamlet can be run from the command line:
7555

7656
```bash
77-
hamlet test_model.yml
57+
hamlet test_model.yml
7858
```
7959

80-
`test_model.yml` is a configuration file in
81-
[YAML](https://yaml.org) format that specifies the source model, seismic
82-
catalog, tests to be run, and other variables and parameters.
60+
`test_model.yml` is a configuration file in [YAML](https://yaml.org) format
61+
that specifies the source model, seismic catalog, tests to be run, and other
62+
variables and parameters.
8363

8464
## Documentation
8565

86-
Hamlet documentation can currently be found at
87-
https://cossatot.gitlab.io/hamlet/ .
66+
Hamlet documentation can be found at
67+
https://gemsciencetools.github.io/hamlet/ .

doc_src/source/_static/custom.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* Expand top two levels of sidebar nav by default */
2+
.sidebar-tree .toctree-l1 > ul,
3+
.sidebar-tree .toctree-l2 > ul {
4+
display: block !important;
5+
}
6+
7+
.sidebar-tree .toctree-l1 > label,
8+
.sidebar-tree .toctree-l2 > label {
9+
display: none;
10+
}

doc_src/source/api.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
=============
2+
API Reference
3+
=============
4+
5+
.. autosummary::
6+
:toctree: _api
7+
:recursive:
8+
9+
openquake.hme.core
10+
openquake.hme.model_test_frameworks
11+
openquake.hme.utils
12+
openquake.hme.reporting

0 commit comments

Comments
 (0)