Skip to content

Instantly share code, notes, and snippets.

@josephhardinee
Created October 5, 2015 15:23
Show Gist options
  • Save josephhardinee/248a322be3d59ee8579e to your computer and use it in GitHub Desktop.
Save josephhardinee/248a322be3d59ee8579e to your computer and use it in GitHub Desktop.
from mayavi import mlab
from numpy import *
import pyart
from matplotlib import pyplot as plt
filename = '/Users/jhardin/Data/iflood/npol/ppi/np1130503061041.RAWCJA2'
radar = pyart.io.read(filename)
#ZH = radar.fields['reflectivity_horizontal']['data'][0:1024,:]
#az = radar.azimuth['data'][0:1024]
#el = radar.elevation['data'][0:1024]
#r = radar.range['data']
#x = np.outer(r, np.sin(90-el)*np.cos(90-az)).T
#y = np.outer(r, np.sin(90-el)*np.sin(90-az)).T
#z = np.outer(r, np.cos(90-el)).T
grids = pyart.map.grid_from_radars(
(radar,),
grid_shape=(101, 101, 11),
grid_limits= ((-100.0*1000.0, 0.*1000.0), (-100.00*1000.0, 0.*1000.0), (0, 11000)),
fields=['reflectivity'],
refl_field='reflectivity',
max_refl=100.)
ZH = grids.fields['reflectivity']['data']
Q = ZH.data
Q[Q<-20]=-20
mlab.pipeline.iso_surface(mlab.pipeline.scalar_field(Q), contours=[15], opacity=0.25)
mlab.pipeline.iso_surface(mlab.pipeline.scalar_field(Q), contours=[30], opacity=0.5)
mlab.pipeline.iso_surface(mlab.pipeline.scalar_field(Q), contours=[45], opacity=1)
plt.figure()
plt.imshow(squeeze(Q[2,:,:]))
#src = mlab.pipeline.scalar_scatter(x, y, z, ZH)
#g = mlab.pipeline.glyph(src, mode='point')
#gs = mlab.pipeline.gaussian_splatter(src)
#gs.filter.radius = .5
#o = mlab.pipeline.outline(gs)
#cp = mlab.pipeline.scalar_cut_plane(gs)
#iso = mlab.pipeline.iso_surface(gs, contours=[45,], warp_scale='auto')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment