I want to use pyincore and create my input for analysis. First, I want to create an earthquake. I am using this code https://github.com/IN-CORE/pyincore/blob/master/tests/test_hazardservice.py#L112 . There is a file in GitHub (pyincore-master), and in this directory (pyincore-master→tests), the abovementioned code exists. I have a question. Should I change the Json files (eq-model.json) first and then apply it to the above code?How can I run the above code?I want to run buildingdamage.ipynb file as an analysis for earthquake and it has specific hazard id which is predefined, so is that possible by running the above code reaching new hazard id to put it in buildingdamage.ipynb?
Thank you for your reaching out. In the code you mentioned, in the test_create_earthquake method, you can see that there are two types of earthquakes: model and dataset based. For the model based earthquake, you can find an example json file here: https://github.com/IN-CORE/pyincore/blob/master/tests/eq-model.json, and for the dataset earthquake you can find an example json here: https://github.com/IN-CORE/pyincore/blob/master/tests/eq-dataset.json After you decide which type of earthquake you want, and you make the appropriate changes, you can run the following code to upload it:
from pyincore import HazardService, IncoreClient
client = IncoreClient()
hazard_svc = HazardService(client)
# Model Based Earthquake without files
with open("eq-model.json", 'r') as file:
eqmodel_json = file.read()
model_response = hazard_svc.create_earthquake(eqmodel_json)
eq_id = model_response["id"]
When you post an earthquake, a unique id will be assigned to your data. You can add this id to the analysis you want to run, like buildingdamage.ipynb. If you run the code above, it will print the id of the earthquake you created. Another way of searching through data that you posted is by signing in to https://incore.ncsa.illinois.edu/, going to the data viewer, and then selecting your own space. For example, below I am filtering the data to only show the ones that I created.
Please let me know if this answered your questions.
Great! Yes, that was the answer to my question. Thank you for your attitude in replying to the question by providing detail from code, which is necessary in most cases.
Powered by a free Atlassian Confluence Open Source Project License granted to NCSA OpenSource. Evaluate Confluence today.