#!/usr/bin/env python from simpleSVG import * #simpleSVG.py must be in your PYTHONPATH from math import * #need to use sin and cos below ################################ g=svg_class(fname='gradwind.svg',bbx=300,bby=300) #override defaults g.rect(0,0,g.bbx,g.bby,fill='white') #solid white background g.scale(-1.5,.5,-.25,.75) #set the range of user coordinates that spans between margins #print "g.xmin", g.xmin g.group(fill='black') g.xaxis(y=-.25,dx=.5,x1=-1.5,x2=.5) #make an x axis g.yaxis(x=-1.5,dy=.25,y1=-.25,y2=.75,form='%5.2f') #make a y axis, change default ticks to 0.4 g.group(stroke_dasharray='3,2') g.draw([-1.5,0.,.5,0.]) g.draw([0.,-.25,0.,.75]) xa=[-1.5+.01*i for i in range(0,201)] ya=[-.25+(x+.5)**2 for x in xa] g.group() g.group(fill="green",stroke='none') g.circle(.2,.24,5) g.circle(-1.2,.24,5) g.circle(-.2,-.16,5) g.circle(-.8,-.16,5) g.group() g.group(fill="black",font_size="12pts") g.text(.26,.22,0,'r.l.') g.text(-1.14,.22,0,'a.l.') g.text(-.52,-.15,0,'r.h.') g.text(-1.12,-.15,0,'a.h.') g.group() g.group(stroke_width="2pts") g.draw(zip(xa,ya),stroke='red',fill='none') g.draw([-.25,-.25,.5,.5],stroke='blue',stroke_dasharray='3,2') g.close() ################################ def cyclone(c): c.scale(-10.,10.,-12.,8.) #set the range of user coordinates that spans between margins dcol=rgbstring(.8,.8,0.) c.circle(0.,0.,10.,stroke_dasharray='3,2',stroke=dcol) c.group(fill='black') sym="L" if fp>0: sym="H" c.text(142,150,0.,sym,font_size="24pt") pcol=rgbstring(0,.5,0) ccol=rgbstring(.5,.0,.5) c.rect2(-.5,-10.5,.5,-9.5,fill='black') c.group(stroke='none') d=.5 if fp<0: d=-.5 c.fatarrow(0.5,-10.-d,0.5,-10.-d-sc*fp,.2,fill=pcol) d=.5 if fc<0: d=-.5 c.fatarrow(0.1,-10.-d,0.1,-10.-d-sc*fc,.2,fill=ccol) c.group() c.group(line_width="2pts") d=.5 if v<0: d=-.5 c.arrow(d,-10.,d+sv*v,-10.,6,stroke='blue',fill='blue') d=.5 if ar<0: d=-.5 c.arrow(-0.5,-10-d,-0.5,-10.-d-sc*ar ,6,stroke='red',fill='red') c.group() c.close() ################################ fp=-.0024 ar=-.0004 fc=.002 v=20. sc=3000. sv=.05 c=svg_class(fname='reglow.svg',bbx=300,bby=300) #override defaults cyclone(c) ################################ fp=-.0024 ar=-.0144 fc=-.012 v=-120. sc=500. sv=.05 c=svg_class(fname='analow.svg',bbx=300,bby=300) #override defaults cyclone(c) ################################ c=svg_class(fname='reghi.svg',bbx=300,bby=300) #override defaults fp=.0016 ar=-.0004 fc=-.002 v=-20. sc=3000. sv=.05 cyclone(c) ################################ c=svg_class(fname='anahi.svg',bbx=300,bby=300) #override defaults fp=.0016 ar=-.0064 fc=-.008 v=-80. sc=500. sv=.05 cyclone(c)