#!/usr/bin/env python # coding: utf-8 # ####################################################################### # ## eSEESminiPy # # # # USGS Design Ground Motions App # ## R210525 # # ### developed by Silvia Mazzoni, 2021 # ### silviamazzoni@yahoo.com # # # ####################################################################### # # ### INSTRUCTIONS # # This tool accesses the USGS WebServices tool (https://earthquake.usgs.gov/ws/designmaps/) and processes the data into usable and consistent format for all design codes. # NOTE: Some plots may appear jagged because of the low number of sig-figs provided by USGS. # # # This is a Jupyter Notebook
# Each cell can be executed individually using the Cell>Run Cells in the menu above.
#
# To run the Notebook, work through each cell in the order provided in this notebook and modify the input for your case
# To run this notebook select: Cell>Run All from the menu "
# # When you are done, you can print the notebook. # You can also download the notebook to your local computer. # # You may download this notebook. but I recommend you keep using the on-line version as I will be making updates and modifications. To save the data, print this notebook to a PDF. # # Because we are working in Binder, and Binder sessions are meant to be ephemeral, it is not possible for you to save any changes you make to your Jupyter Notebook. If you do make changes or notes, you will need to download the notebook to your own computer by clicking File > Download as > Notebook (.ipynb). The only way you will be able to run these is if you have the appropriate software to run Jupyter Notebooks in Python and pip install OpenSeesPy and eSEESminiPy in your Python configuration. You may view my videos on how to install Anaconda, Jupyter Notebooks and OpenSeesPy (https://www.youtube.com/c/silviasbrainery). # In[14]: ####################################################################### ############## user input ####################################################################### label = 'USGS Test Site' Latitude = 34 Longitude = -118 SiteClass = 'C' # options: ['A', 'B', 'C', 'D', 'E'] or NEHRP-2020: ['A', 'B', 'BC', 'C', 'CD', 'D', 'DE', 'E'] RiskCat = 'IV' # options: ['I', 'II', 'III', 'IV'] # Select governing code: ASCEcode = ['ASCE41-17'] # options: ASCE7-16,ASCE7-10,ASCE7-05,ASCE41-17,ASCE41-13,NEHRP-2020,NEHRP-2015,IBC-2015,IBC-2012,AASHTO-2009 # or you can define them all: ASCEcode = ['ASCE7-16','ASCE7-10','ASCE7-05','ASCE41-17','ASCE41-13','NEHRP-2020','NEHRP-2015','IBC-2015','IBC-2012','AASHTO-2009'] # output: printSpectraValues = False # options: True, False Period_scale='linear' # options: 'log','linear' PSA_scale='linear' # options: 'log','linear' ####################################################################### ####################################################################### # In[15]: get_ipython().run_cell_magic('javascript', '', 'IPython.OutputArea.auto_scroll_threshold = 10000;\n') # In[16]: import matplotlib.pyplot as plt import eSEESminiPy import glob import urllib import webbrowser from ipywidgets import widgets, Output # In[17]: for ASCEcode in ASCEcode: thisWidget = widgets.HTML(value = """

""" + ASCEcode + """

""") display(thisWidget) thisOut = eSEESminiPy.getUSGSdesignGroundMotion(label,ASCEcode,Latitude,Longitude,SiteClass,RiskCat) UserInput = thisOut['UserInput'] RequestData = thisOut['Request'] Data = thisOut['Data'] spectraData = thisOut['Spectra'] #print('') #print('USER INPUT') #for thisLabel in UserInput.keys(): # print(thisLabel + ': ' + str(UserInput[thisLabel])) print('') print('WEBSERVICES REQUEST DATA') for thisLabel in RequestData.keys(): print(thisLabel + ': ' + str(RequestData[thisLabel])) print('') print('GROUND MOTION DATA') for thisLabel in Data.keys(): print(thisLabel + ': ' + str(Data[thisLabel])) plt.figure(figsize=(12,8)) for SpectrumLabel in spectraData.keys(): if len(spectraData[SpectrumLabel])>0: plt.plot(spectraData[SpectrumLabel]['Period (sec)'], spectraData[SpectrumLabel]['PSA (g)'],lineWidth = 2, label=ASCEcode + '-' + SpectrumLabel) if printSpectraValues: print(SpectrumLabel) print(spectraData[SpectrumLabel]) plt.xlabel('Period (sec)') plt.ylabel('PSA (g)') plt.xscale(Period_scale) plt.yscale(PSA_scale) plt.title(ASCEcode) plt.legend() plt.grid() plt.show() # In[18]: ### Questions? #### Contact Silvia Mazzoni: silviamazzoni@yahoo.com ## copyright: ## You may use this code to run your analyses. ## You may print and distribute the results ## This tool comes as-is with no warranty and I recommend you check the results ## ## NO PART OF THIS CODE MAY BE REPRODUCED OR REDISTRIBUTED WITHOUT PRIOR WRITTEN CONSENT FROM THE AUTHOR