def PlotHatchDict(): """ This dictionary is used by sectionplot (matplotlib) for relating the geoshort names with hatches in plots The user may update these fields in the zz_strat table to use other hatches Fallback method use dictionary defined in the code below """ success, Dict = utils.create_dict_from_db_2_cols(("strata", "hatch_mplot", "zz_stratigraphy_plots")) if not success: print("fallback method with PlotHatchDict from code") # hatch patterns : ('-', '+', 'x', '\\', '*', 'o', 'O', '.','/') if utils.getcurrentlocale() == "sv_SE": # swedish forms are loaded only if locale settings indicate sweden Dict = { u"Okänt": u"", "Berg": u"x", "Grovgrus": u"O", "Grus": u"O", "Mellangrus": u"o", "Fingrus": u"o", "Grovsand": u"*", "Sand": u"*", "Mellansand": u".", "Finsand": u".", "Silt": u"\\", "Lera": u"-", u"Morän": u"/", "Torv": u"+", "Fyll": u"+", } else: Dict = { u"Unknown": u"", "Rock": u"x", "Coarse gravel": u"O", "Gravel": u"O", "Medium gravel": u"o", "Fine gravel": u"o", "Coarse sand": u"*", "Sand": u"*", "Medium sand": u".", "Fine sand": u".", "Silt": u"\\", "Clay": u"-", "Till": u"/", "Peat": u"+", "Fill": u"+", } return Dict
def PlotColorDict(): """ This dictionary is used by sectionplot (matplotlib) for relating the geoshort names with color codes The user may update these fields in the zz_strat table to use other colors Fallback method use dictionary defined in the code below """ success, Dict = utils.create_dict_from_db_2_cols(("strata", "color_mplot", "zz_stratigraphy_plots")) if not success: print("fallback method with PlotColorDict from code") if utils.getcurrentlocale() == "sv_SE": # swedish forms are loaded only if locale settings indicate sweden Dict = { u"Okänt": u"white", "Berg": u"red", "Grovgrus": u"DarkGreen", "Grus": u"DarkGreen", "Mellangrus": u"DarkGreen", "Fingrus": u"DarkGreen", "Grovsand": u"green", "Sand": u"green", "Mellansand": u"green", "Finsand": u"DarkOrange", "Silt": u"yellow", "Lera": u"yellow", u"Morän": u"cyan", "Torv": u"DarkGray", "Fyll": u"white", } else: Dict = { u"Unknown": u"white", "Rock": u"red", "Coarse gravel": u"DarkGreen", "Gravel": u"DarkGreen", "Medium gravel": u"DarkGreen", "Fine gravel": u"DarkGreen", "Coarse sand": u"green", "Sand": u"green", "Medium sand": u"green", "Fine sand": u"DarkOrange", "Silt": u"yellow", "Clay": u"yellow", "Till": u"cyan", "Peat": u"DarkGray", "Fill": u"white", } # print Dict#debug! return Dict