{"id":20848154,"url":"https://github.com/tlcfem/motion-base","last_synced_at":"2025-04-10T19:12:42.506Z","repository":{"id":231461784,"uuid":"540673197","full_name":"TLCFEM/motion-base","owner":"TLCFEM","description":"🌏 ground motion database","archived":false,"fork":false,"pushed_at":"2025-04-06T15:29:33.000Z","size":5924,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T16:31:44.499Z","etag":null,"topics":["ground-motion","seismic","strong-motion","structural-engineering"],"latest_commit_sha":null,"homepage":"http://170.64.176.26/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TLCFEM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-24T01:34:18.000Z","updated_at":"2025-04-06T15:28:04.000Z","dependencies_parsed_at":"2024-04-15T01:29:05.237Z","dependency_job_id":"023af2d2-8cde-493a-9cbc-d19018756bf7","html_url":"https://github.com/TLCFEM/motion-base","commit_stats":null,"previous_names":["tlcfem/motion-base"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLCFEM%2Fmotion-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLCFEM%2Fmotion-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLCFEM%2Fmotion-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLCFEM%2Fmotion-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TLCFEM","download_url":"https://codeload.github.com/TLCFEM/motion-base/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248280039,"owners_count":21077409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ground-motion","seismic","strong-motion","structural-engineering"],"created_at":"2024-11-18T02:24:45.488Z","updated_at":"2025-04-10T19:12:42.482Z","avatar_url":"https://github.com/TLCFEM.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# motion-base\n\n[![codecov](https://codecov.io/gh/TLCFEM/motion-base/branch/master/graph/badge.svg?token=E6TCZUQ6AX)](https://codecov.io/gh/TLCFEM/motion-base)\n[![front-size](https://img.shields.io/docker/image-size/tlcfem/motion-base-front?label=front%20end)](https://hub.docker.com/r/tlcfem/motion-base-front)\n[![back-size](https://img.shields.io/docker/image-size/tlcfem/motion-base-back?label=back%20end)](https://hub.docker.com/r/tlcfem/motion-base-back)\n\n\n`motion-base` is a web application that aims to provide a unified entry point for accessing and processing ground motion\nrecords from different national databases.\n\nIt comes with a web interface and a Python client that can be used to access the data programmatically.\n\n**Check out the [demo](http://170.64.176.26/) site.**\n\n![screenshot](docs/screenshot.png)\n\n## Main Functionalities\n\n- [x] Parse and index ground motion records from different databases in a uniform format.\n- [x] Search and select ground motion records based on different criteria, including magnitude, PGA, event time, event location, etc.\n- [x] Provide ad hoc processing, including up-/down-sampling, normalization, filtering and computation of response spectra.\n- [x] Converting acceleration record to velocity/displacement record that is consistent with specific time integration methods.\n\n## Quick Start\n\nPlease ensure `docker`, `curl`, and `jq` are installed on the system.\nThe following command will download the `example.sh` script and execute it.\nIt will pull the images and upload the example data to the application.\n\n```bash\ncurl -s https://raw.githubusercontent.com/TLCFEM/motion-base/refs/heads/master/scripts/example.sh -o example.sh \u0026\u0026 bash example.sh\n```\n\nPlease always check the content of the script (especially from the Internet) before executing it.\nThe following is a walkthrough of the script.\n\n[![walkthrough](docs/demo.gif)](https://asciinema.org/a/FYpQv4PFufAEArqzWBOyodzeQ)\n\n## Installation\n\n### as a developer\n\n```bash\n# 1. clone the project\ngit clone https://github.com/TLCFEM/motion-base.git\ncd motion-base\n# 2. create a virtual environment and install python dependencies\npython -m venv .venv\nsource .venv/bin/activate\npip install -e .[dev,client]\n# 3. install node.js dependencies\ncd gui\npnpm install\ncd ..\n```\n\nThere are no extra steps needed to set up the development environment.\nTo run the application locally, use the following command:\n\n```bash\n# 1. mongodb and rabbitmq\ndocker compose -f docker/docker-compose.yml up -d\n# 2. backend\npython ./mb_runner.py\n# 3. celery workers\npython ./mb_runner.py celery\n# 4. frontend\ncd gui\npnpm dev\n```\n\nUse `back.Dockerfile` and `front.Dockerfile` to build the docker images for the backend and frontend, respectively.\n\n### as a host\n\nTo host the application, two files are needed: `.env` and `docker-compose-production.yml`.\n\n```bash\nmkdir motion-base \u0026\u0026 cd motion-base\nwget https://raw.githubusercontent.com/TLCFEM/motion-base/master/docker/.env\nwget https://raw.githubusercontent.com/TLCFEM/motion-base/master/docker/docker-compose-production.yml\n\n# edit the .env file to set the correct values\n# or create those environment variables in other means\ndocker compose -f docker-compose-production.yml up -d\n```\n\nIt shall run out of the box, but it is recommended to check the settings and adjust accordingly.\n\nIt is recommended to use one process per container and scale the application horizontally.\nTo do so, one can check the example given in file `docker/docker-compose-production-nginx.yaml`.\nTo use it, `docker/nginx.conf.sh` should also be available.\n\n```bash\nmkdir motion-base \u0026\u0026 cd motion-base\nwget https://raw.githubusercontent.com/TLCFEM/motion-base/master/docker/.env\nwget https://raw.githubusercontent.com/TLCFEM/motion-base/master/docker/nginx.conf.sh\nwget https://raw.githubusercontent.com/TLCFEM/motion-base/master/docker/docker-compose-production-nginx.yml\n\ndocker compose -f docker-compose-production-nginx.yml up -d\n```\n\nPlease feel free to use other tools to deploy the application, such as Kubernetes, Docker Swarm, etc.\n\n### as an analyst\n\n```bash\n# 1. clone the project\ngit clone https://github.com/TLCFEM/motion-base.git\ncd motion-base\n# 2. create a virtual environment and install python dependencies\npython -m venv .venv\nsource .venv/bin/activate\npip install .[client]\n```\n\nIt is then possible to use the client to access the data.\n\n```python\nimport anyio\n\nfrom mb.client import MBClient\n\napi_url = \"http://somewhere.the.application.is.hosted\"\n\n\nasync def search():\n    async with MBClient(api_url) as client:\n        results = await client.search({\"min_magnitude\": 6.0, \"min_pga\": 200.0})\n        for r in results:\n            print(r)\n\n\nif __name__ == \"__main__\":\n    anyio.run(search)\n```\n\n## Raw Data Source\n\nThe raw data, once downloaded from sources, can be uploaded to the application.\n\n```python\nimport anyio\n\nfrom mb.client import MBClient\n\n# assuming the application is running locally\napi_url = \"http://localhost:8000\"\n# using the default credentials\nusername = \"test\"\npassword = \"password\"\nregion = \"jp\"\n\n\n# assume current folder contains the files to be uploaded\nasync def upload():\n    async with MBClient(api_url, username, password) as client:\n        await client.upload(region, '.')\n\n\nif __name__ == \"__main__\":\n    anyio.run(upload)\n```\n\n### Japan\n\nThe raw data is available\nat [Strong Motion Seismograph Networks](https://www.kyoshin.bosai.go.jp/kyoshin/data/index_en.html).\nThe waveform files in ASCII format `*.EW`, `*.NS`, and `*.UD` can be uploaded and parsed.\n\n### New Zealand\n\nThe raw data is available at [Strong Motion Data Products](https://www.geonet.org.nz/data/types/strong_motion).\nThe waveform files `*.V1A` and `*.V2A` can be uploaded and parsed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlcfem%2Fmotion-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftlcfem%2Fmotion-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlcfem%2Fmotion-base/lists"}