function makeFromTemplateScale(scale, name, id_prefix, short) local returnVal = mw.clone(scale) returnVal.name = name or returnVal.name returnVal.id_prefix = id_prefix returnVal.short = short return returnValend
function addField(nameOfField, objectToWriteTo, objectToReadFrom) for k,v in pairs(objectToWriteTo) do if objectToReadFrom[k] ~= nil then v[nameOfField] = objectToReadFrom[k] end endend
local data =
-- MMI and many other scalesdata["mmi"] =
-- Roman numeral aliasesdata["mmi"].ranks["I"] = data["mmi"].ranks["1"]data["mmi"].ranks["II"] = data["mmi"].ranks["2"]data["mmi"].ranks["III"] = data["mmi"].ranks["3"]data["mmi"].ranks["IV"] = data["mmi"].ranks["4"]data["mmi"].ranks["V"] = data["mmi"].ranks["5"]data["mmi"].ranks["VI"] = data["mmi"].ranks["6"]data["mmi"].ranks["VII"] = data["mmi"].ranks["7"]data["mmi"].ranks["VIII"] = data["mmi"].ranks["8"]data["mmi"].ranks["IX"] = data["mmi"].ranks["9"]data["mmi"].ranks["X"] = data["mmi"].ranks["10"]data["mmi"].ranks["XI"] = data["mmi"].ranks["11"]data["mmi"].ranks["XII"] = data["mmi"].ranks["12"]
-- JMA, CWS, etc.data["jma"] =
data["cwa"] = makeFromTemplateScale(data.jma, "Central Weather Administration seismic intensity scale", "cwa_", "CWA")data["csis"] = makeFromTemplateScale(data.mmi, "China seismic intensity scale", "csis-", "CSIS")data["ems-98"] = makeFromTemplateScale(data.mmi, "European macroseismic scale", "ems-98-", "EMS-98")data["msk-64"] = makeFromTemplateScale(data.mmi, "Medvedev–Sponheuer–Karnik scale", "msk-", "MSK-64")data["rfs"] = makeFromTemplateScale(data.mmi, "Rossi–Forel scale", "rfs-", "RFS")data["rfs"].ranks["11"] = nildata["rfs"].ranks["12"] = nildata["rfs"].ranks["XI"] = nildata["rfs"].ranks["XII"] = nildata["rfs"].order[12] = nildata["rfs"].order[11] = nildata["peis"] = makeFromTemplateScale(data.rfs, "PHIVOLCS earthquake intensity scale", "peis-", "PEIS")
-- ranks only present with USGSdata["mmi"].ranks["2-3"] =
data["mmi"].ranks["II-III"] = data["mmi"].ranks["2-3"]
data["mmi"].ranks["10+"] =
data["mmi"].ranks["X+"] = data["mmi"].ranks["10+"]
data["mmi"].order =
-- Add categorical rankings to dataaddField("category", data["mmi"].ranks, )
addField("category", data["ems-98"].ranks, )
addField("category", data["msk-64"].ranks, )
addField("category", data["peis"].ranks, )
addField("category", data["rfs"].ranks, )
-- lower values for peak ground acceleration for MMI see https://usgs.github.io/shakemap/manual4_0/ug_intensity.html-- all values in units of %g and will need to be converted for other uses-- also categorization is done in buckets with averages precomputed in Excel--Rank PGA listed Average for bottom buckets1 0.05 0.1752-3 0.3 1.554 2.8 4.55 6.2 9.16 12 177 22 318 40 57.59 75 10710+ 139
addField("pga", data["mmi"].ranks,)
data["mmi"].ranksSorted =
-- same for JMA (values from Japan Meterological Agency seismic intensity scale and converted back to %g's)addField("pga", data["jma"].ranks,)
data["jma"].ranksSorted =
return data