From c21c97794fb80954f164b08c1678e6056dd839b6 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@8a9318a1-56ba-4d59-b755-99d26321be01> Date: Tue, 18 Aug 2009 22:02:33 +0000 Subject: [PATCH] added the ability to define custom display colors in the config file git-svn-id: https://svn.ssec.wisc.edu/repos/glance/trunk@56 8a9318a1-56ba-4d59-b755-99d26321be01 --- pyglance/glance/exconfig.py | 10 +++++++--- pyglance/glance/plot.py | 14 ++++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/pyglance/glance/exconfig.py b/pyglance/glance/exconfig.py index e4548b2..5286c75 100644 --- a/pyglance/glance/exconfig.py +++ b/pyglance/glance/exconfig.py @@ -46,8 +46,6 @@ lat_lon_info['data_filter_function_lon_in_b'] = (insert lambda function here) lat_lon_info['data_filter_function_lat_in_b'] = (insert lambda function here) """ # this value can be used to control how similar the longitude and latitude must be to be considered matching -# if all of your longitude and latitude do not match under this epsilon, most of the comparison report will -# not be generated, since the data would not correlate spatially # Note: this value is only intended to allow you to avoid very small floating point errors that would make glance # think that your data is disparate, when really it is very close together. If you put a large epsilon in here # the various comparison plots may contain misleading data @@ -114,7 +112,7 @@ setOfVariables['Total Totals'] = { # the key of your variable entry wi # on amount of non-finite data # note, this setting overrides the default - 'display_ranges': [13.0, 14.0, 15.0, 20.0, 32.0, 40.0, 54.0, 60.0], + 'display_ranges': [13.0, 14.0, 15.0, 20.0, 32.0, 40.0, 54.0, 60.0], # this array of ranges can be defined in order to control # a custom display of color ranges in any graphs produced # for this variable, ranges will fall between the numbers @@ -132,10 +130,16 @@ setOfVariables['Total Totals'] = { # the key of your variable entry wi # TODO In the future this array may have the ability to # let you label your ranges (ie, the space between two # boundaries) or your boundaries. + + 'display_colors': ('m', 'b', 'c', 'r', 'k', 'y', 'g'), + # the colors that should be used to display the ranges + # color definition information can be found at + # http://matplotlib.sourceforge.net/api/colors_api.html # data filters can be defined/overridden on a variable by variable basis # 'data_filter_function_a': (insert lambda function here), # note: will only be applied to file A data # 'data_filter_function_b': (insert lambda function here) # note: will only be applied to file B data + } setOfVariables['Total Precipitable Water, High'] = { 'variable_name': 'imager_prof_retr_abi_total_precipitable_water_high', diff --git a/pyglance/glance/plot.py b/pyglance/glance/plot.py index 74f4f44..6fe5028 100644 --- a/pyglance/glance/plot.py +++ b/pyglance/glance/plot.py @@ -191,7 +191,7 @@ def _clean_lon_or_lat_with_mask(lon_or_lat_data, invalid_data_mask): # set on the existing image def _create_mapped_figure(data, latitude, longitude, title, invalidMask=None, colorMap=None, tagData=None, - dataRanges=None, dataRangeNames=None) : + dataRanges=None, dataRangeNames=None, dataRangeColors=None) : # make a clean version of our lon/lat latitudeClean = _clean_lon_or_lat_with_mask(latitude, invalidMask) @@ -222,6 +222,7 @@ def _create_mapped_figure(data, latitude, longitude, title, dataRanges[0] = dataRanges[0] - offsetToRange dataRanges[len(dataRanges) - 1] = dataRanges[len(dataRanges) - 1] + offsetToRange kwargs['levelsToUse'] = dataRanges + kwargs['colors'] = dataRangeColors # add in the list of colors (may be None) # if we've got a color map, pass it to the list of things we want to tell the plotting function if not (colorMap is None) : @@ -496,7 +497,10 @@ def plot_and_save_figure_comparison(aData, bData, dataRanges = variableRunInfo['display_ranges'] dataRangeNames = None if ('display_range_names' in variableRunInfo) : - dataRangeNames = variableRunInfo['display_range_names'] + dataRangeNames = variableRunInfo['display_range_names'] + dataColors = None + if ('display_colors' in variableRunInfo) : + dataColors = variableRunInfo['display_colors'] # from this point on, we will be forking to create child processes so we can parallelize our image and # report generation @@ -512,7 +516,8 @@ def plot_and_save_figure_comparison(aData, bData, (variableDisplayName + "\nin File A"), invalidMask=(~goodInAMask), dataRanges=dataRanges, - dataRangeNames=dataRangeNames)), + dataRangeNames=dataRangeNames, + dataRangeColors=dataColors)), "\t\tsaving image of " + variableDisplayName + " for file a", outputPath + "/" + variableName + ".A.png", outputPath + "/" + variableName + ".A.small.png", @@ -527,7 +532,8 @@ def plot_and_save_figure_comparison(aData, bData, (variableDisplayName + "\nin File B"), invalidMask=(~ goodInBMask), dataRanges=dataRanges, - dataRangeNames=dataRangeNames)), + dataRangeNames=dataRangeNames, + dataRangeColors=dataColors)), "\t\tsaving image of " + variableDisplayName + " for file b", outputPath + "/" + variableName + ".B.png", outputPath + "/" + variableName + ".B.small.png", -- GitLab