Commit 9b295136 authored by Marius's avatar Marius

set file path from environment

parent faa086f3
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
The eGSIM shakemap is comprised of a backend service (`api.py`) and a front end response site (`front-end`). The eGSIM shakemap is comprised of a backend service (`api.py`) and a front end response site (`front-end`).
# Requirements
vs30 model available at [USGS](https://earthquake.usgs.gov/data/vs30/). Export an environment variable `VS30PATH` pointing to that file.
# Installation # Installation
The backend build relies on [pipenv](https://pipenv.kennethreitz.org/en/latest/). To install the frontend a version of Node.js and npm (Node package manager) is *required*. I recommend serving the final build (`front-end/shakemap/dist`) through nginx webserver. For further information spawning The backend build relies on [pipenv](https://pipenv.kennethreitz.org/en/latest/). To install the frontend a version of Node.js and npm (Node package manager) is *required*. I recommend serving the final build (`front-end/shakemap/dist`) through nginx webserver. For further information spawning
...@@ -25,4 +29,8 @@ Starting the API documentation: ...@@ -25,4 +29,8 @@ Starting the API documentation:
git clone https://github.com/swagger-api/swagger-node git clone https://github.com/swagger-api/swagger-node
npm start npm start
Go to open http://localhost:8081/docs Go to open http://localhost:8081/docs
\ No newline at end of file
## API
Either post request QuakeML formatted strings or use get requests on endpoint `/shakemap`.
\ No newline at end of file
...@@ -123,8 +123,9 @@ def get_vs30_sites_from_bbox(bbox, isep="\t"): ...@@ -123,8 +123,9 @@ def get_vs30_sites_from_bbox(bbox, isep="\t"):
""" """
Returns a basic site dictionary from a bbox [llon, ulon, llat, ulat] Returns a basic site dictionary from a bbox [llon, ulon, llat, ulat]
""" """
filepath = os.path.dirname(__file__) site_data_path = os.environ.get('VS30PATH', None) or \
site_data_path = os.path.join(filepath, "global_vs30.grd") os.path.join(os.path.dirname(__file__), "global_vs30.grd")
_, fn_grid = tempfile.mkstemp() _, fn_grid = tempfile.mkstemp()
_, fn_xyz = tempfile.mkstemp() _, fn_xyz = tempfile.mkstemp()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment