Skip to content

Commit 275f74d

Browse files
committed
Merge pull request #110 from UV-CDAT/taylor_plots
Taylor plots
2 parents 2e7e308 + 825c316 commit 275f74d

File tree

4 files changed

+33
-37
lines changed

4 files changed

+33
-37
lines changed

src/python/frontend/diags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def run_diagnostics_from_filetables( opts, modelfts, obsfts ):
284284
# tmmobs[ir] is the template for plotting a simple plot on a page
285285
# which has the entire compound plot - that's vcanvas2
286286
gmobs, tmobs, tmmobs = return_templates_graphic_methods( vcanvas, gms, ovly, onPage )
287-
if 1==1: # optional debugging:
287+
if 1: # optional debugging:
288288
print "tmpl nsingleplots=",nsingleplots,"nsimpleplots=",nsimpleplots
289289
print "tmpl gms=",gms
290290
print "tmpl len(res)=",len(res),"ovly=",ovly,"onPage=",onPage

src/python/frontend/it.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# #
99
#######################################################################################################
1010
def return_templates_graphic_methods(canvas1=None, gms=None, ovly=None, onPage=None):
11-
1211
if len(gms) == len(ovly):
1312

1413
# Create a unique graphics method for each diagnostic display
@@ -36,7 +35,7 @@ def return_templates_graphic_methods(canvas1=None, gms=None, ovly=None, onPage=N
3635
gmobs[i].linewidth = 2.0
3736
gmobs[i].linecolor = 242
3837
gmobs[i].markersize = 1
39-
if (gms[i] == 'taylor'):
38+
if (gms[i] == 'taylordiagram'):
4039
td = canvas1.createtaylordiagram('taylor_' + (str(random.random())[2:]), 'default')
4140
gmobs.append( td )
4241
#gmobs[i].addMarker()
@@ -54,7 +53,7 @@ def return_templates_graphic_methods(canvas1=None, gms=None, ovly=None, onPage=N
5453
tmobs.append( canvas1.createtemplate('uvwg_' + (str(random.random())[2:]), 'UVWG1D') )
5554
else: # overlay plot use DUD - only plot the data
5655
tmobs.append( canvas1.createtemplate('uvwg_DUD_' + (str(random.random())[2:]), 'UVWG1D_DUD') )
57-
elif (gms[i] in ['taylor']):
56+
elif (gms[i] in ['taylordiagram']):
5857
tmpl = canvas1.createtemplate('taylor_' + (str(random.random())[2:]), 'deftaylor')
5958
tmobs.append( tmpl )
6059

src/python/frontend/uvcdat.py

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def __init__( self, pvars, presentation, labels=[], title='', source='', ranges=
230230
self.presentation = vcsx.createisoline()
231231
elif presentation == "Scatter":
232232
self.presentation = vcsx.createscatter()
233-
elif presentation == "Taylor":
233+
elif presentation == "Taylordiagram":
234234
self.presentation = vcsx.createtaylordiagram()
235235
else:
236236
print "ERROR, uvc_plotspec doesn't recognize presentation",presentation
@@ -579,28 +579,6 @@ def finalize( self, flip_x=False, flip_y=False ):
579579
#print markersizes
580580
#print self.vars
581581

582-
#setup the markersize and colors
583-
MAX = max(markersizes)
584-
MIN = min(markersizes)
585-
scale = vcs.mkscale(MIN, MAX)
586-
#labels = vcs.mklabels(scale)
587-
colorScale = vcs.getcolors(scale, split=False)
588-
sizes = range(10, 10+len(colorScale))
589-
590-
dotsizes = []
591-
dotcolors = []
592-
593-
#determine dot size and color
594-
for size in markersizes:
595-
for index in range(0, len(scale)-1):
596-
low, high = scale[index], scale[index+1]
597-
if low <= size and size < high:
598-
dotsizes += [sizes[index]]
599-
dotcolors += [colorScale[index]]
600-
#print dotsizes
601-
#print dotcolors
602-
break
603-
604582
#determine the identifier for the legend
605583
IDs = []
606584
for ID in markerids:
@@ -614,13 +592,10 @@ def finalize( self, flip_x=False, flip_y=False ):
614592
#out to the plot
615593
self.legendTitles = IDs
616594

617-
index = []
618-
for i in range(len(markersizes)):
619-
index += [str(i)]
620-
self.presentation.Marker.size = dotsizes
621-
self.presentation.Marker.color = dotcolors
595+
#self.presentation.Marker.size = dotsizes
596+
#self.presentation.Marker.color = dotcolors
622597
#self.presentation.IDs = IDs
623-
self.presentation.Marker.id = index
598+
#self.presentation.Marker.id = index
624599
#pdb.set_trace()
625600

626601
#create list of offsets
@@ -632,9 +607,31 @@ def finalize( self, flip_x=False, flip_y=False ):
632607
else:
633608
XOFF = XOFF.tolist()
634609
YOFF = YOFF.tolist()
635-
self.presentation.Marker.xoffset = XOFF
636-
self.presentation.Marker.yoffset = YOFF
637-
self.presentation.Marker.id_size = len(markersizes)*[20]
610+
#self.presentation.Marker.xoffset = XOFF
611+
#self.presentation.Marker.yoffset = YOFF
612+
#self.presentation.Marker.id_size = len(markersizes)*[20]
613+
for i in range(len(markersizes)):
614+
if markersizes[i]>1.01:
615+
mtype = "triangle_up"
616+
elif markersizes[i]<.99:
617+
mtype = "triangle_down"
618+
else:
619+
mtype = "circle"
620+
b = abs(1.-markersizes[i])
621+
if b<5:
622+
size = 12
623+
elif b<10:
624+
size = 16
625+
elif b<20:
626+
size = 20
627+
else:
628+
size = 25
629+
630+
self.presentation.Marker.addMarker(size=size,
631+
id=str(i),id_size=20,
632+
symbol = mtype,
633+
xoffset=XOFF[i],yoffset=YOFF[i])
634+
self.presentation.Marker.equalize()
638635

639636
#self.presentation.list()
640637

src/python/packages/amwg/amwg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2626,7 +2626,7 @@ def __init__( self, model, obs, varid, seasonid='JAN', region=None, aux=None ):
26262626
self.obsfns = [obsfn]
26272627
self.legendTitles = []
26282628
plot_spec.__init__(self, seasonid)
2629-
self.plottype = 'Taylor'
2629+
self.plottype = 'Taylordiagram'
26302630
self._seasonid = seasonid
26312631
self.season = cdutil.times.Seasons(self._seasonid)
26322632
#ft1id, ft2id = filetable_ids(filetable1, filetable2)

0 commit comments

Comments
 (0)