# HG changeset patch # User Ioannis # Date 1526897310 -10800 # Node ID 7c29ce781d9ae0e0202c0b1b63f962c78d9d7dc1 # Parent 968f8c944f90b352e5c8202a10bfe52401ba3277 Spliting draw function. diff -r 968f8c944f90 -r 7c29ce781d9a atmospheric_lidar/generic.py --- a/atmospheric_lidar/generic.py Thu Mar 29 17:30:39 2018 +0300 +++ b/atmospheric_lidar/generic.py Mon May 21 13:08:30 2018 +0300 @@ -1069,6 +1069,20 @@ else: data = self.matrix + self.draw_data(ax1, data, add_colorbar, cmap, cb_format, cmap_label, date_labels, power_limits, vmax, vmin, + z0, zoom) + + def draw_data(self, ax1, data, add_colorbar, cmap, cb_format, cmap_label, date_labels, power_limits, vmax, vmin, + z0, zoom): + + """ + This method plots generic lidar data in 2d Plot. + + Updated drawing routine, using pcolormesh. It is slower but provides more flexibility / precision + in time plotting. The 2 drawing routines should be merged. + + + """ hmax_idx = self._index_at_height(zoom[1]) hmin_idx = self._index_at_height(zoom[0]) @@ -1078,12 +1092,11 @@ else: ax1.set_ylabel('Altitude a.g.l. [km]') z0 = 0 + ax1.set_xlabel('Time UTC [hh:mm]') - ax1.set_xlabel('Time UTC [hh:mm]') # y axis in km, xaxis /2 to make 30s measurements in minutes. Only for 1064 # dateFormatter = mpl.dates.DateFormatter('%H.%M') # hourlocator = mpl.dates.HourLocator() - if date_labels: dayFormatter = mpl.dates.DateFormatter('%H:%M\n%d/%m/%Y') daylocator = mpl.dates.AutoDateLocator(minticks=3, maxticks=8, interval_multiples=True) @@ -1100,24 +1113,18 @@ time_cut = self.time[zoom[2]:zoom[3]] time_last = time_cut[-1] + dt # The last element needed for pcolormesh - time_all = time_cut + (time_last,) - t_axis = mpl.dates.date2num(time_all) - # Get the values of the z axis z_cut = self.z[hmin_idx:hmax_idx] - self.resolution / 2. z_last = z_cut[-1] + self.resolution - z_axis = np.append(z_cut, z_last) / 1000. + z0 / 1000. # Convert to km - # Plot im1 = ax1.pcolormesh(t_axis, z_axis, data.T[hmin_idx:hmax_idx, zoom[2]:zoom[3]], cmap=cmap, vmin=vmin, vmax=vmax, ) - if add_colorbar: if cb_format: cb1 = plt.colorbar(im1, format=cb_format, extend='both')