import vcs.testing.regression as regression x = regression.init() f = cdms2.open(os.path.join(vcs.sample_data, "thermo.nc")) temp = f('t') levels = temp.getLevel() time = temp.getTime() # Break up temp by level magnitudes = [temp[:, i] for i in range(temp.shape[1])] for i, mag in enumerate(magnitudes): mag.id = "%0.f %s" % (levels[i], levels.units) times = [] for t in time: reltime = cdtime.relativetime(t, time.units) comptime = reltime.tocomponent() times.append(comptime.hour) thetas = [times] * len(magnitudes) polar = vcsaddons.getpolar("diurnal") polar.markers = ["dot"] polar.markersizes = [3] polar.markercolors = vcs.getcolors(list(levels)) polar.magnitude_tick_angle = numpy.pi / 8 polar.plot(magnitudes, thetas, bg=True, x=x) fnm = "test_vcs_addons_polar_diurnal.png"
for row in timeaxis: print row lataxis = clt.getLatitude() lonaxis = clt.getLongitude() # So, if we want to know where a given point is... lat_index = 24 lon_index = 50 time_index = 60 # This is the module for easy use of time axis values import cdtime print "Value:", clt[time_index][lat_index][lon_index] # Times are stored as "relative times", or "time since X date" relative_time = cdtime.relativetime(timeaxis[time_index], timeaxis.units) # Component time is a more useful format, that has the date/time in human-readable attributes print "Time:", relative_time.tocomponent() print "Lat:", lataxis[lat_index] print "Lon:", lonaxis[lon_index] # Now we can plot clt at the specified time, and stick a marker at the lat/lon x = vcs.init() template = x.createtemplate() template.scale(0.66, "x") template.blank() template.data.priority = 1 x.plot(clt(time=time_index), template)
for row in timeaxis: print row lataxis = clt.getLatitude() lonaxis = clt.getLongitude() # So, if we want to know where a given point is... lat_index = 24 lon_index = 50 time_index = 60 # This is the module for easy use of time axis values import cdtime print 'Value:', clt[time_index][lat_index][lon_index] # Times are stored as "relative times", or "time since X date" relative_time = cdtime.relativetime(timeaxis[time_index], timeaxis.units) # Component time is a more useful format, that has the date/time in human-readable attributes print "Time:", relative_time.tocomponent() print "Lat:", lataxis[lat_index] print "Lon:", lonaxis[lon_index] # Now we can plot clt at the specified time, and stick a marker at the lat/lon x = vcs.init() template = x.createtemplate() template.scale(.66, "x") template.blank() template.data.priority = 1 x.plot(clt(time=time_index), template)
import testing.regression as regression x = regression.init() f = cdms2.open(os.path.join(vcs.sample_data, "thermo.nc")) temp = f('t') levels = temp.getLevel() time = temp.getTime() # Break up temp by level magnitudes = [temp[:,i] for i in range(temp.shape[1])] for i, mag in enumerate(magnitudes): mag.id = "%0.f %s" % (levels[i], levels.units) times = [] for t in time: reltime = cdtime.relativetime(t, time.units) comptime = reltime.tocomponent() times.append(comptime.hour) thetas = [times] * len(magnitudes) polar = vcsaddons.getpolar("diurnal") polar.markers = ["dot"] polar.markersizes = [3] polar.markercolors = vcs.getcolors(list(levels)) polar.magnitude_tick_angle = numpy.pi / 8 polar.plot(magnitudes, thetas, bg=True, x=x) fnm = "test_vcs_addons_polar_diurnal.png"