Commit d3f59963 authored by Tara Evaz Zadeh's avatar Tara Evaz Zadeh
Browse files

changed tabs to 4 spaces in Fragility_to_Dictionary.py

parent 1827e91d
......@@ -3,31 +3,31 @@
import csv
def Fragility_to_Dictionary2(gmDict,taxonomyConversionCsv,fragilities_path):
#OUTPUT:
#returns A dictionary with keys as first column
#of taxonomyConversionCsv(taxonomies)
#values as relative fragility names
#(2nd column of taxonomyConversionCsv) and
#ground-motion type and the respective
#column number of the gm-type
#INPUTS:
#gmDict: Dictionary with keys as gm-type and
#values as the relative column number
#taxonomyConversionCsv : A file with first column
#as taxonomies and the second column as the name of
#relative fragility function(type : _csv.reader matrix)
#fragilities_path: Path to the folder of fragility functions
taxonomyConversionDict = {}
for row in taxonomyConversionCsv:
fragilityFileName = row[1] + ".csv"
data = list(csv.reader(open(fragilities_path+"/"+fragilityFileName)))
gm_type1=data[0][0]
columnNumber = gmDict[gm_type1]
key = row[0]
if key in taxonomyConversionDict:
# implement your duplicate row handling here
pass
dictValue = [row[1],gm_type1,columnNumber]
taxonomyConversionDict[key] = dictValue
return(taxonomyConversionDict)
#OUTPUT:
#returns A dictionary with keys as first column
#of taxonomyConversionCsv(taxonomies)
#values as relative fragility names
#(2nd column of taxonomyConversionCsv) and
#ground-motion type and the respective
#column number of the gm-type
#INPUTS:
#gmDict: Dictionary with keys as gm-type and
#values as the relative column number
#taxonomyConversionCsv : A file with first column
#as taxonomies and the second column as the name of
#relative fragility function(type : _csv.reader matrix)
#fragilities_path: Path to the folder of fragility functions
taxonomyConversionDict = {}
for row in taxonomyConversionCsv:
fragilityFileName = row[1] + ".csv"
data = list(csv.reader(open(fragilities_path+"/"+fragilityFileName)))
gm_type1=data[0][0]
columnNumber = gmDict[gm_type1]
key = row[0]
if key in taxonomyConversionDict:
# implement your duplicate row handling here
pass
dictValue = [row[1],gm_type1,columnNumber]
taxonomyConversionDict[key] = dictValue
return(taxonomyConversionDict)
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