300 |
300 |
301 #Laser shots |
301 #Laser shots |
302 temp_v = f.createVariable('Laser_Shots','i',('time','channels')) |
302 temp_v = f.createVariable('Laser_Shots','i',('time','channels')) |
303 for (channel,n) in zip(channels, range(len(channels))): |
303 for (channel,n) in zip(channels, range(len(channels))): |
304 time_length = len(self.variables['Raw_Data_Start_Time'][self.variables['id_timescale'][channel]]) |
304 time_length = len(self.variables['Raw_Data_Start_Time'][self.variables['id_timescale'][channel]]) |
305 temp_v[:time_length, n] = params.channel_parameters[channel]['Laser_Shots'] |
305 # Array slicing stoped working as usual ex. temp_v[:10] = 100 does not work. ??? np.ones was added. |
306 |
306 temp_v[:time_length, n] = np.ones(time_length) * params.channel_parameters[channel]['Laser_Shots'] |
|
307 |
307 #Raw lidar data |
308 #Raw lidar data |
308 temp_v = f.createVariable('Raw_Lidar_Data','d',('time', 'channels','points')) |
309 temp_v = f.createVariable('Raw_Lidar_Data','d',('time', 'channels','points')) |
309 for (channel,n) in zip(channels, range(len(channels))): |
310 for (channel,n) in zip(channels, range(len(channels))): |
310 c = self.channels[channel] |
311 c = self.channels[channel] |
311 temp_v[:len(c.time),n, :c.points] = c.matrix |
312 temp_v[:len(c.time),n, :c.points] = c.matrix |
509 else: |
510 else: |
510 if show_plot: |
511 if show_plot: |
511 plt.show() |
512 plt.show() |
512 #plt.close() ??? |
513 #plt.close() ??? |
513 |
514 |
514 def draw_plot(self,ax1, cmap = plt.cm.jet, signal_type = 'rc', zoom = [0,12000,0,-1], z0 = None, cmap_label = 'a.u.', vmin = 0, vmax = 1.3 * 10 ** 7): |
515 def draw_plot(self,ax1, cmap = plt.cm.jet, signal_type = 'rc', zoom = [0,12000,0,-1], z0 = None, cmap_label = 'a.u.', cb_format = None, vmin = 0, vmax = 1.3 * 10 ** 7): |
515 |
516 |
516 if signal_type == 'rc': |
517 if signal_type == 'rc': |
517 if len(self.rc) == 0: |
518 if len(self.rc) == 0: |
518 self.calculate_rc() |
519 self.calculate_rc() |
519 data = self.rc |
520 data = self.rc |
559 vmax = vmax, |
560 vmax = vmax, |
560 #vmax = data[:,10:400].max() * 0.9, |
561 #vmax = data[:,10:400].max() * 0.9, |
561 extent = [ts1,ts2,self.z[zoom[0]]/1000.0 + z0/1000., self.z[hmax_idx]/1000.0 + z0/1000.], |
562 extent = [ts1,ts2,self.z[zoom[0]]/1000.0 + z0/1000., self.z[hmax_idx]/1000.0 + z0/1000.], |
562 ) |
563 ) |
563 |
564 |
564 cb1 = plt.colorbar(im1) |
565 if cb_format: |
|
566 cb1 = plt.colorbar(im1, format = cb_format) |
|
567 else: |
|
568 cb1 = plt.colorbar(im1) |
565 cb1.ax.set_ylabel(cmap_label) |
569 cb1.ax.set_ylabel(cmap_label) |
566 |
570 |
567 # Make the ticks of the colorbar smaller, two points smaller than the default font size |
571 # Make the ticks of the colorbar smaller, two points smaller than the default font size |
568 cb_font_size = mpl.rcParams['font.size'] - 2 |
572 cb_font_size = mpl.rcParams['font.size'] - 2 |
569 for ticklabels in cb1.ax.get_yticklabels(): |
573 for ticklabels in cb1.ax.get_yticklabels(): |
570 ticklabels.set_fontsize(cb_font_size) |
574 ticklabels.set_fontsize(cb_font_size) |
571 cb1.ax.yaxis.get_offset_text().set_fontsize(cb_font_size) |
575 cb1.ax.yaxis.get_offset_text().set_fontsize(cb_font_size) |
572 |
576 |
573 def index_at_height(self, height): |
577 def index_at_height(self, height): |
574 idx = np.array(np.abs(self.z - height).argmin()) |
578 idx = np.array(np.abs(self.z - height).argmin()) |
575 if idx.size >1: |
579 if idx.size > 1: |
576 idx =idx[0] |
580 idx =idx[0] |
577 return idx |
581 return idx |
578 |
582 |
579 def netcdf_from_files(LidarClass, filename, files, channels, measurement_ID): |
583 def netcdf_from_files(LidarClass, filename, files, channels, measurement_ID): |
580 #Read the lidar files and select channels |
584 #Read the lidar files and select channels |