Example #1
0
 
    ustar = np.sqrt(stress/rho)
    wstar = maxw / 2.75
    
    limsmall = 0.5
    ustar[np.where(ustar<limsmall)] = limsmall
    
    ratio = wstar / ustar

    ratio = ((tsurf-temp)/temp)*(wstar/ustar)
    ratio[np.where(ratio<0.)] = 0.

    #ratio = (tsurf-temp)/temp
    ratio = tsurf-temp

    pl = ppplot.plot2d()    
    pl.f = ratio
    #pl.c = hgt
    pl.x = dd.xcoord
    pl.y = dd.ycoord
    #pl.vmin = 0.
    #pl.vmax = 3.
    pl.back = "ddmap"
    pl.proj = "cyl"
    pl.trans = 0.5
    pl.colorbar = "hot"
    pl.leftcorrect = True
    pl.make()
    ppplot.save(mode="png",filename="test"+str(ls))
    ppplot.close()
Example #2
0
#! /usr/bin/env python

from ppclass import pp
import planets
import ppplot

fi = "DRAG90days_DISSIP10000_year7_912791376_512_z5"
u,lon,lat,p,t = pp(file=fi+".nc",var="u",t=0,z=0,x="-180,180").getfd()

# index = acosphi*((omega*acosphi)+u) / (omega*a*a)
sindex = planets.Saturn.superrot(u=u,lat=lat)

pl = ppplot.plot1d()
pl.f = sindex*1000.
pl.x = lat
pl.ylabel = r'Local superrotation index $s = \mathcal{M}_u / \Omega a^2$ ($\times 10^{-3}$)'
pl.xmin = -10.
pl.xmax = 10.
pl.fmt = '%.0f'
pl.ymin = -30.
pl.ymax = 10.
pl.marker = ''
pl.xlabel = "Latitude (deg)"
pl.make()
ppplot.save(mode="png",filename=fi+"_superrot")




Example #3
0
# computations
wind = u**2 + v**2
wind = np.sqrt(wind)

# get evolution over season
ind = np.where(lon == dalon)

# make a simple plot
pl = ppplot.plot1d()
pl.x = range(0, 360, 30)
pl.xlabel = "L$_s$ ($^{\circ}$)"
pl.ylabel = "Wind speed (m s$^{-1}$)"
pl.out = "png"
pl.filename = "lsdune"

pl.f = u[ind][:, dalt]
pl.legend = "WE component"
pl.make()

pl.f = v[ind][:, dalt]
pl.legend = "SN component"
pl.make()

pl.f = wind[ind][:, dalt]
pl.legend = "total wind"
pl.make()

# save plot
ppplot.save(mode="png", filename="seasonal", includedate=False)
Example #4
0
# computations
wind = u**2 + v**2
wind = np.sqrt(wind)

# get evolution over season
ind = np.where(lon == dalon)

# make a simple plot
pl = ppplot.plot1d()
pl.x = range(0,360,30)
pl.xlabel = "L$_s$ ($^{\circ}$)"
pl.ylabel = "Wind speed (m s$^{-1}$)"
pl.out = "png"
pl.filename = "lsdune"

pl.f = u[ind][:,dalt]
pl.legend = "WE component"
pl.make()

pl.f = v[ind][:,dalt]
pl.legend = "SN component"
pl.make()

pl.f = wind[ind][:,dalt]
pl.legend = "total wind"
pl.make()

# save plot
ppplot.save(mode="png",filename="seasonal",includedate=False)
Example #5
0
sdg.legend = 'mcd'
sdg.marker = 's'
sdg.color = 'w'
sdg.make()


nnn=60
dd=10
ppplot.rainbow(cb="jet",num=nnn/dd)

ppp = ppplot.plot1d()
ppp.marker = '.'
ppp.ymax = 9000.
ppp.xlabel = 'temperature (K)'
ppp.ylabel = 'altitude (m)'

for iii in range(0,nnn,dd):
   if iii == 0: 
     sdg.verbose = True
   req.t = 258 + iii + utc/24.
   prof,xx,yy,zz,tt = req.getfd()
   ppp.x = prof
   ppp.f = zz*1000.
   ppp.legend = 'gcm sol 258+'+str(iii)
   ppp.make()

ppplot.save(mode="png",filename="comp")



Example #6
0
r.x = lats
r.y = press
r.invert = True
r.logy = True
r.vmin = -100.
r.vmax = 400.
r.xmin = -90.
r.xmax = 90.
r.colorbar = "spectral"
r.fmt = "%.0f"
r.swaplab = False
r.xlabel = "Latitude ($^{\circ}$N)"
r.ylabel = "Pressure (Pa)"
r.units = "m s$^{-1}$"
r.make()
ppplot.save(mode="png",filename="section",includedate=False)
ppplot.close()

###################################
ppplot.figuref(x=12,y=8)
##
r = ppplot.plot1d()
r.f = gmcbwind
r.x = gmcblat
r.marker = '.'
r.linestyle = ''
r.color = 'p'
r.legend = "Cassini ISS CB (GM11)"
r.make()
##
r = ppplot.plot1d()
Example #7
0
u = data[:, 3:15]
data = np.loadtxt("v.txt")
v = data[:, 3:15]

# computations
wind = u**2 + v**2
wind = np.sqrt(wind)

# make a simple plot
pl = ppplot.plot1d()
pl.x = range(0, 24, 2)
pl.xlabel = "Local time (Martian hours)"
pl.ylabel = "Wind speed (m s$^{-1}$)"
pl.out = "png"
pl.filename = "plotdune"

pl.f = u[0, :]
pl.legend = "WE component"
pl.make()

pl.f = v[0, :]
pl.legend = "SN component"
pl.make()

pl.f = wind[0, :]
pl.legend = "total wind"
pl.make()

# save plot
ppplot.save(mode="png", filename="plotdune", includedate=False)
Example #8
0
u = data[:,3:15]
data = np.loadtxt("v.txt")
v = data[:,3:15]

# computations
wind = u**2 + v**2
wind = np.sqrt(wind)

# make a simple plot
pl = ppplot.plot1d()
pl.x = range(0,24,2)
pl.xlabel = "Local time (Martian hours)"
pl.ylabel = "Wind speed (m s$^{-1}$)"
pl.out = "png"
pl.filename = "plotdune"

pl.f = u[0,:]
pl.legend = "WE component"
pl.make()

pl.f = v[0,:]
pl.legend = "SN component"
pl.make()

pl.f = wind[0,:]
pl.legend = "total wind"
pl.make()

# save plot
ppplot.save(mode="png",filename="plotdune",includedate=False)
Example #9
0
  p.f = sigma*np.nan # trick to make it transparent
  p.clev = [0.]
  p.ccol = "white"
  p.ccol = "red"
  p.x = specx
  p.y = spect / opt.dt  # /25000. Saturne
  p.invert = True

  for nnn in nutab:
   for n2n2 in n2tab:
     p.c = mypl.dispeqw(s,sigma,nu=nnn,lz=lz,N2=n2n2)
     p.make()

if opt.output is None: ppplot.show()
else: ppplot.save(mode="png",filename=opt.output)

####################################
# save a .sh file with the command #
####################################
command = ""
for arg in sys.argv: command = command + arg + ' '
if opt.output is not None:
  try:
    f = open(opt.output+'.sh', 'w')
    f.write(command)
  except IOError:
    print "!! WARNING !! not saved. Probably do not have permission to write here."


Example #10
0
anom.z = 0
anom.t = "0,1e10"
anom.compute = "pert_t"
anom.verbose = True
fanom = anom.getf()

wip = 100. * fanom / ffield

logfac = np.log(1.165 / 0.1e-2)
wip = 0.4 * ffield / logfac

pl = ppplot.plot2d()
pl.f = np.max(wip, axis=0)

w = np.where(pl.f <= 1.2)
pl.f[w] = 1.0

pl.colorbar = "copper_r"
pl.vmin = 1.0
pl.vmax = 1.5
pl.fmt = "%.2f"
pl.div = 20
pl.units = "m/s"
pl.xcoeff = 0.025
pl.ycoeff = 0.025
pl.xlabel = "x-axis (km)"
pl.ylabel = "y-axis (km)"
pl.make()

ppplot.save(mode="pdf", filename="tracks_" + fold)
Example #11
0
for yeah in [tttall]:
#for yeah in ["0"]:
  u.t = yeah
  u.compute = "nothing"
  ustm = u.getf()
  u.compute = "max" ; zemax = u.getf()
  u.compute = "min" ; zemin = u.getf()
  u.compute = "mean" ; zemean = u.getf()
  ppplot.figuref(x=4,y=4)
  dval = 0.05
  bins = np.arange(zemin,zemax,dval)
  hh = mpl.hist(np.ravel(ustm),bins,log=True)
  print hh
  mpl.title("$\mu$=%.2f / m=%.2f / M=%.2f" % (zemean,zemin,zemax))
  mpl.xlabel('Friction velocity $u_{\star}$ (m s$^{-1}$)')
  ppplot.save(mode="png",filename="roughness_hist")
  ppplot.close()


u.x = None
u.y = None
u.t = tttall
u.compute = "max"
u.xcoeff = 0.01
u.ycoeff = 0.01
u.xlabel = "x (km)"
u.ylabel = "y (km)"
u.title = 'maximum $u\star$'
u.vmin = 0.4
u.vmax = 1.1
u.div = 70
Example #12
0
#! /usr/bin/env python

from ppclass import pp
import planets
import ppplot

fi = "DRAG90days_DISSIP10000_year7_912791376_512_z5"
u, lon, lat, p, t = pp(file=fi + ".nc", var="u", t=0, z=0,
                       x="-180,180").getfd()

# index = acosphi*((omega*acosphi)+u) / (omega*a*a)
sindex = planets.Saturn.superrot(u=u, lat=lat)

pl = ppplot.plot1d()
pl.f = sindex * 1000.
pl.x = lat
pl.ylabel = r'Local superrotation index $s = \mathcal{M}_u / \Omega a^2$ ($\times 10^{-3}$)'
pl.xmin = -10.
pl.xmax = 10.
pl.fmt = '%.0f'
pl.ymin = -30.
pl.ymax = 10.
pl.marker = ''
pl.xlabel = "Latitude (deg)"
pl.make()
ppplot.save(mode="png", filename=fi + "_superrot")
Example #13
0
    p.f = sigma * np.nan  # trick to make it transparent
    p.clev = [0.0]
    p.ccol = "white"
    p.ccol = "red"
    p.x = specx
    p.y = spect / opt.dt  # /25000. Saturne
    p.invert = True

    for nnn in nutab:
        for n2n2 in n2tab:
            p.c = mypl.dispeqw(s, sigma, nu=nnn, lz=lz, N2=n2n2)
            p.make()

if opt.output is None:
    ppplot.show()
else:
    ppplot.save(mode="png", filename=opt.output)

####################################
# save a .sh file with the command #
####################################
command = ""
for arg in sys.argv:
    command = command + arg + " "
if opt.output is not None:
    try:
        f = open(opt.output + ".sh", "w")
        f.write(command)
    except IOError:
        print "!! WARNING !! not saved. Probably do not have permission to write here."
Example #14
0
#! /usr/bin/env python
import ppplot
import numpy as np

# load data
# http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html
p,z,t,dew,hum,mix,wdir,wknot,thta,thte,thtv \
    = np.loadtxt("sounding.txt",skiprows=8,unpack=True)

# make a simple plot
sdg = ppplot.plot1d()
sdg.f = z
sdg.x = t
sdg.makeshow()

# Tweaking a little bit the plot
sdg.linestyle = '-'
sdg.marker = '.'
sdg.color = 'r'
sdg.ycoeff = 1.e-3
sdg.title = "A random terrestrial sounding"
sdg.legend = "Fort Smith 00Z 26 Sep 2013"
sdg.xlabel = "Temperature ($^{\circ}$C)"
sdg.ylabel = "Altitude (km)"
sdg.makeshow()

sdg.make()
ppplot.save(mode="png", filename="plot", res=50, includedate=False)
pl.colorbar = "hot"
pl.ymax = ymax
pl.ymin = ymin
pl.showcb = False
pl.div = 40
pl.make()

import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter

ax = plt.gca()
ax.yaxis.set_minor_formatter(FormatStrFormatter("%.1f"))

plt.contour(time, period, sig95, [-99, 1], colors='g')

ppplot.save(mode="png",filename="wavelet")

exit()




###############################################







#------------------------------------------------------ Plotting
#! /usr/bin/env python
import ppplot
import numpy as np

# load data
# http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html
p,z,t,dew,hum,mix,wdir,wknot,thta,thte,thtv \
    = np.loadtxt("sounding.txt",skiprows=8,unpack=True)

# make a simple plot
sdg = ppplot.plot1d()
sdg.f = z
sdg.x = t
sdg.makeshow()

# Tweaking a little bit the plot
sdg.linestyle = '-'
sdg.marker = '.'
sdg.color = 'r'
sdg.ycoeff = 1.e-3
sdg.title = "A random terrestrial sounding"
sdg.legend = "Fort Smith 00Z 26 Sep 2013"
sdg.xlabel = "Temperature ($^{\circ}$C)"
sdg.ylabel = "Altitude (km)"
sdg.makeshow()

sdg.make()
ppplot.save(mode="png",filename="plot",res=50,includedate=False)