Merge from 148:e422bc5fcc7e

Thu, 21 Jun 2018 16:41:32 +0300

author
Iannis <i.binietoglou@impworks.gr>
date
Thu, 21 Jun 2018 16:41:32 +0300
changeset 149
6be372caf9fd
parent 147
d6a27ff6df88 (current diff)
parent 148
7c29ce781d9a (diff)
child 150
a2be81b7ace3
child 151
0ec29d360d15

Merge from 148:e422bc5fcc7e

--- a/atmospheric_lidar/generic.py	Thu Apr 12 11:33:51 2018 +0300
+++ b/atmospheric_lidar/generic.py	Thu Jun 21 16:41:32 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')

mercurial