Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing surface in event.rupture when parsing the flatfile #60

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6922fbc
Missing surface in event.rupture when parsing the flatfile
stephane-on Jan 19, 2018
42ed8c6
Enhancements to trellis plots
g-weatherill Feb 1, 2018
a050482
Updates readme with new OQ instructions
g-weatherill Feb 1, 2018
e1564b2
Removes unnecessary parenthesis
g-weatherill Feb 1, 2018
48e079d
Fixes incorrect link
g-weatherill Feb 1, 2018
33a99c4
Merge pull request #62 from g-weatherill/readme_update_jan18
Feb 1, 2018
589e65c
Merge branch 'master' into rev_mag_dist_spec_trellis
g-weatherill Feb 4, 2018
9738ecd
Changes json exported to return body, not file
g-weatherill Feb 5, 2018
e803e65
removes commented lines
g-weatherill Feb 5, 2018
0a2df85
Merge pull request #63 from g-weatherill/rev_mag_dist_spec_trellis
Feb 7, 2018
4c2d0da
Remove binary requirements
daniviga Feb 7, 2018
8558f46
Update travis
daniviga Feb 7, 2018
4064bc1
Removes unnecessary json filename input
g-weatherill Feb 7, 2018
976ecae
Merge pull request #66 from g-weatherill/json_fix
Feb 7, 2018
20ff502
Merge pull request #65 from GEMScienceTools/rm-whl
Feb 7, 2018
ede6eb4
Adds unit tests for trellis plots
g-weatherill Feb 7, 2018
bf9e643
Merges upstream to fix conflicts
g-weatherill Feb 7, 2018
38ceb4a
Merge pull request #67 from g-weatherill/trellis_test
Feb 8, 2018
4852752
Minor changes to trellis module for Python 2 & 3 compatibility
g-weatherill Feb 8, 2018
9113e21
Merge pull request #68 from g-weatherill/trellis_py3
Feb 8, 2018
2e80f38
Adds IMS and response spectra tests
g-weatherill Feb 8, 2018
194da16
Merge pull request #69 from g-weatherill/rs_ims_tests.py
Feb 9, 2018
303adb7
Fixes mixing rupture surface check in sm_database
g-weatherill Feb 9, 2018
b847fb9
Refactor trellis json format
g-weatherill Feb 10, 2018
0d9fd1e
Merge pull request #70 from g-weatherill/trellis_json_adjust
Feb 10, 2018
a12e5a1
Merge branch 'master' into fixes_db_rupture
g-weatherill Feb 10, 2018
7f762e9
Merge pull request #71 from g-weatherill/fixes_db_rupture
Feb 10, 2018
f2c3530
Adds test code for residuals
g-weatherill Feb 10, 2018
b2fec96
Merge pull request #72 from g-weatherill/residuals_tests
Feb 10, 2018
c425ce0
test running old notebooks again with the SARA DB
stephane-on Feb 11, 2018
e9a9b97
test running old notebooks again with the SARA DB
stephane-on Feb 11, 2018
687a607
Fixes OQ mis-alignment in conditional simulation and adds tests
g-weatherill Feb 12, 2018
f22a881
Merge pull request #73 from g-weatherill/csim_fix_tests
Feb 12, 2018
00609cd
Add support for python 3 under Travis
daniviga Feb 13, 2018
a2e0e0d
Make pip more verbose
daniviga Feb 13, 2018
a576ead
Merge pull request #74 from GEMScienceTools/travis-py3
daniviga Feb 13, 2018
6eb1e4d
Update README.md
daniviga Feb 13, 2018
ef363da
Removes Python 3.5, 3.6 from .travis.yml
g-weatherill Feb 14, 2018
9c11e55
Merge pull request #75 from g-weatherill/travis_rmpy3
Feb 14, 2018
57f2ad0
revert
stephane-on Feb 15, 2018
328a412
Missing surface in event.rupture when parsing the flatfile
stephane-on Jan 19, 2018
1b75319
test running old notebooks again with the SARA DB
stephane-on Feb 11, 2018
1a61b4b
test running old notebooks again with the SARA DB
stephane-on Feb 11, 2018
717e609
revert
stephane-on Feb 15, 2018
b1f7145
Merge remote-tracking branch 'Mygithub-gmpe-smtk/dev_stephane' into d…
stephane-on Feb 15, 2018
9e81ec5
correct problem when looking for the spectral periods used in GMPEs
stephane-on Feb 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ language: python

python:
- "2.7"
# - "3.5"
# - "3.6"

addons:
apt:
Expand All @@ -16,11 +18,12 @@ install:
# Make sure pip is up-to-date and has support for wheels
- pip -q install -U pip
# Install oq-engine dependencies
- pip -q install -r oq-engine/requirements-py27-linux64.txt
- pip -q install -e oq-engine/
# Install HMTK extra dependencies
- pip -q install -r requirements-py27-linux64.txt
- pip -q install -e .
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install -r oq-engine/requirements-py27-linux64.txt;
elif [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then pip install -r oq-engine/requirements-py35-linux64.txt;
elif [[ $TRAVIS_PYTHON_VERSION == 3.6 ]]; then pip install -r oq-engine/requirements-py36-linux64.txt;
else echo "Python not supported" && exit 1; fi
- pip install -e oq-engine/
- pip install -e .

script:
- nosetests -vx tests
75 changes: 17 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
gmpe-smtk
=========
[![Build Status](https://travis-ci.org/GEMScienceTools/gmpe-smtk.svg?branch=master)](https://travis-ci.org/GEMScienceTools/gmpe-smtk)

Python and OpenQuake-based Toolkit for Analysis of Strong Motions and Interpretation of GMPEs

Expand All @@ -16,7 +17,7 @@ License as published by the Free Software Foundation, either version
3 of the License, or (at your option) any later version. Please take
a minute of your time to read the disclaimer below.

Copyright (c) 2014-2017 GEM Foundation
Copyright (c) 2014-2018 GEM Foundation


Disclaimer
Expand Down Expand Up @@ -50,73 +51,31 @@ The GEM Foundation, and the authors of the software, assume no
liability for use of the software.


dependencies
Installation
============

The gmpe-smtk currently requires the following dependencies:
The gmpe-smtk is built on top of the [OpenQuake-engine](https://github.com/gem/oq-engine).

To install the toolkit, and ensure that it is aligned with the OpenQuake-engine
we recommend to install the OpenQuake-engine according to the instructions
given for your specific operating system. The full installation instructions for
OpenQuake can be found here: [https://github.com/gem/oq-engine](https://github.com/gem/oq-engine).

* OpenQuake Hazard Library ([oq-hazardlib](https://github.com/gem/oq-hazardlib))
* Numpy (1.6.1 or later) (installed with oq-hazardlib)
* Scipy (0.11.0 or later) (installed with oq-hazardlib)
* Shapely (installed with oq-hazardlib)
* Matplotlib (1.3.x or later)
* h5py (2.2.0 or later)

installation
============

* Windows

Windows users should install the PythonXY software package (https://code.google.com/p/pythonxy/), which will install all of the dependencies except oq-hazardlib
To install oq-hazardlib it is recommended to install MinGW or Github for Windows.

If using Github for Windows simply open a bash shell, clone the oq-hazardlib
repository using:

```bash
git clone https://github.com/gem/oq-hazardlib.git
```

Then type

```bash
cd oq-hazardlib
python setup.py install
```

To install the gmpe-smtk simply download the zipped code from the repository,
unzip it to a location of your choice then add the directory path to
the Environment Variables found in:

My Computer -> Properties -> System Properties -> Advanced -> Environment Variables

In the Environment Variables you will see a list of System Variables. Select
"Path" and then "Edit". Then simply add the directory of the gmpe-smtk to the
list of directories.

* OSX/Linux

To install oq-hazardlib simply clone the oq-hazardlib repository into a folder
of your choice.

Once the OpenQuake-engine is installed, the gmpe-smtk repository is cloned by:
```bash
git clone https://github.com/gem/oq-hazardlib.git
git clone https://github.com/GEMScienceTools/gmpe-smtk
```

Then run

Then:
```bash
cd oq-hazardlib
cd gmpe-smtk
python setup.py install
```

Matplotlib and h5py can both be installed from the native package managers,
although it is recommended to use pip for this purpose.
For users interested in developing new features or contributing code to the
repository we strongly recommend to install the OpenQuake-engine according to
the instructions for [installing OpenQuake for development](https://github.com/gem/oq-engine/blob/master/doc/installing/development.md).

To install the gmpe-smtk, clone the code from the repository and then
add the following line to your bash or profile script:
The gmpe-smtk is currently written in Python 2.7 and work is now underway to
port this to Python 3.5.

```bash
export PYTHONPATH=/path/to/gmpe-smtk/:$PYTHONPATH
```
10 changes: 0 additions & 10 deletions requirements-py27-linux64.txt

This file was deleted.

10 changes: 0 additions & 10 deletions requirements-py35-linux64.txt

This file was deleted.

12 changes: 6 additions & 6 deletions smtk/hazard/conditional_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ def conditional_simulation(known_sites, residuals, unknown_sites, imt, nsim,
unknown_sites.depths = np.zeros_like(unknown_sites.depths)
cov_kk = correlation_model._get_correlation_matrix(known_sites, imt).I
cov_uu = correlation_model._get_correlation_matrix(unknown_sites, imt)
d_k_uk = np.zeros([known_sites.total_sites, unknown_sites.total_sites],
d_k_uk = np.zeros([len(known_sites), len(unknown_sites)],
dtype=float)
for iloc in range(0, known_sites.total_sites):
d_k_uk[iloc, :] = geodetic_distance(known_sites.lons[iloc],
known_sites.lats[iloc],
unknown_sites.lons,
unknown_sites.lats)
for iloc in range(len(known_sites)):
d_k_uk[iloc, :] = geodetic_distance(known_sites.array["lons"][iloc],
known_sites.array["lats"][iloc],
unknown_sites.array["lons"],
unknown_sites.array["lats"])
cov_ku = correlation_model._get_correlation_model(d_k_uk, imt)
mu = cov_ku.T * cov_kk * np.matrix(residuals).T
stddev = cov_uu - (cov_ku.T * cov_kk * cov_ku)
Expand Down
8 changes: 4 additions & 4 deletions smtk/intensity_measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def get_response_spectrum(acceleration, time_step, periods, damping=0.05,
periods,
damping,
units)
spectrum, time_series, accel, vel, disp = response_spec.evaluate()
spectrum, time_series, accel, vel, disp = response_spec()
spectrum["PGA"] = time_series["PGA"]
spectrum["PGV"] = time_series["PGV"]
spectrum["PGD"] = time_series["PGD"]
Expand Down Expand Up @@ -231,7 +231,7 @@ def geometric_mean_spectrum(sax, say):
Dictionary of response spectrum outputs from y-component
"""
sa_gm = {}
for key in sax.keys():
for key in sax:
if key == "Period":
sa_gm[key] = sax[key]
else:
Expand All @@ -243,7 +243,7 @@ def arithmetic_mean_spectrum(sax, say):
Returns the arithmetic mean of the response spectrum
"""
sa_am = {}
for key in sax.keys():
for key in sax:
if key == "Period":
sa_am[key] = sax[key]
else:
Expand All @@ -255,7 +255,7 @@ def envelope_spectrum(sax, say):
Returns the envelope of the response spectrum
"""
sa_env = {}
for key in sax.keys():
for key in sax:
if key == "Period":
sa_env[key] = sax[key]
else:
Expand Down
Loading