Skip to content

A python tool to download ground motion from PEER NGA database.

License

Notifications You must be signed in to change notification settings

zouxlin3/PyPeerNGA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPeerNGA

PyPeerNGA

A Python tool to download ground motion from PEER NGA database.

Install

Make sure that you have installed Chrome.

  1. Install Python package

    $ pip install selenium
    $ pip install selenium-wire
    $ pip install requests
  2. Download Chrome driver

Go to the document of selenium for more details.

Usage

Sign in

driverPath = 'your chrome driver path'
web = PeerNGA(driverPath)
web.signIn('your_email', 'ypur_password')

Enter a database

Options: 'NGA West2', 'NGA East'

web.enterDB('NGA West2')

Search records

settings = {
    'RSNs': '',
    'Event Name': '',
    'Station Name': '',
    'Fault Type': '', 
    'Magnitude': '',
    'R_JB': '',
    'R_rup': '',
    'Vs30': '',
    'D5-95': '',
    'Pulse': '',
    'Max No. Records': ''
}

Fault Type options:

1 - All Types(Default)
2 - Strike Slip (SS)
3 - Normal/Oblique
4 - Reverse/Oblique
5 - SS+Normal
6 - SS+Reverse
7 - Normal+Reverse

Pulse options:

1 - Any Record(Default)
2 - ONLY Pulse-like Records
3 - NO Pulse-like Records
web.search(settings=settings)

Download records

web.download(saveDir)

Example

import os
from PeerNGA import PeerNGA


if __name__ == '__main__':
    settings = {
        'RSNs': '1'
    }
    saveDir = os.path.join(os.getcwd(), 'data')

    web = PeerNGA()
    web.signIn('email', 'password')
    web.enterDB('NGA West2')
    web.search(settings=settings)
    web.download(saveDir)
    web.close()

References

python实现下载进度条格式化输出

Selenium Wire

Selenium 网页测试爬虫库简介

selenium

License

MIT © zouxlin3

About

A python tool to download ground motion from PEER NGA database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages