Skip to content
Snippets Groups Projects
Commit 8084ed93 authored by (no author)'s avatar (no author)
Browse files

adding code to plot small numbers of tagged points on simple figures correctly

git-svn-id: https://svn.ssec.wisc.edu/repos/glance/trunk@213 8a9318a1-56ba-4d59-b755-99d26321be01
parent 1d2cb8c1
No related branches found
No related tags found
No related merge requests found
...@@ -79,7 +79,7 @@ def _make_range(data_a, valid_a_mask, num_intervals, offset_to_range=0.0, data_b ...@@ -79,7 +79,7 @@ def _make_range(data_a, valid_a_mask, num_intervals, offset_to_range=0.0, data_b
return np.linspace(minVal, maxVal, num_intervals) return np.linspace(minVal, maxVal, num_intervals)
def _plot_tag_data_simple(tagData) : def _plot_tag_data_simple(tagData, axes) :
""" """
This method will plot tag data listed as true in the This method will plot tag data listed as true in the
tagData mask on the current figure. It is assumed that tagData mask on the current figure. It is assumed that
...@@ -106,11 +106,32 @@ def _plot_tag_data_simple(tagData) : ...@@ -106,11 +106,32 @@ def _plot_tag_data_simple(tagData) :
LOG.debug('\t\tnumber of mismatch points: ' + str(numMismatchPoints)) LOG.debug('\t\tnumber of mismatch points: ' + str(numMismatchPoints))
LOG.debug('\t\tpercent of mismatch points: ' + str(percentBad)) LOG.debug('\t\tpercent of mismatch points: ' + str(percentBad))
new_kwargs = {} # get the current limits of the plot
new_kwargs['cmap'] = greenColorMap tempXLim = axes.get_xlim()
cleanTagData = ma.array(tagData, mask=~tagData) tempYLim = axes.get_ylim()
p = contourf(cleanTagData, **new_kwargs)
# TODO, need to incorporate plot for small numbers of pts # if there aren't a lot of points, plot them individually
if (numMismatchPoints < 50000) | ((numMismatchPoints < 200000) & (percentBad < 2.0)) :
(height, width) = tagData.shape
tempX = [ ]
tempY = [ ]
for h in range(height) :
for w in range(width) :
if tagData[h, w] :
tempX.append(w)
tempY.append(h)
pTemp = plot(tempX, tempY, '.', markersize=0.1, color='#00ff00')
# if there are a lot of points, plot them as an overall mask
else :
new_kwargs = {}
new_kwargs['cmap'] = greenColorMap
cleanTagData = ma.array(tagData, mask=~tagData)
pTemp = contourf(cleanTagData, **new_kwargs)
# make sure we haven't changed the limits of the plot
axes.set_xlim(tempXLim)
axes.set_ylim(tempYLim)
# display the number of mismatch points on the report if we were passed a set of tag data # display the number of mismatch points on the report if we were passed a set of tag data
mismatchPtString = '\n\nShowing ' + str(numMismatchPoints) + ' Mismatch Points' mismatchPtString = '\n\nShowing ' + str(numMismatchPoints) + ' Mismatch Points'
...@@ -591,7 +612,7 @@ def create_simple_figure(data, figureTitle, invalidMask=None, tagData=None, colo ...@@ -591,7 +612,7 @@ def create_simple_figure(data, figureTitle, invalidMask=None, tagData=None, colo
# and some informational stuff # and some informational stuff
axes.set_title(figureTitle) axes.set_title(figureTitle)
numMismatchPoints = _plot_tag_data_simple(tagData) numMismatchPoints = _plot_tag_data_simple(tagData, axes)
return figure return figure
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment