def draw_transection(self, start_yx, end_yx, start_lalo=None, end_lalo=None): """Plot the transect as dots""" self.ax_txn.cla() # loop for all input files for i in range(self.num_file): # get transection data if start_lalo is not None: # use lat/lon whenever it's possible to support files with different resolutions txn = ut.transect_lalo(self.data_list[i], self.atr_list[i], start_lalo, end_lalo, interpolation=self.interpolation) else: txn = ut.transect_yx(self.data_list[i], self.atr_list[i], start_yx, end_yx, interpolation=self.interpolation) # plot self.ax_txn.scatter(txn['distance'] / 1000.0, txn['value'] - self.offset[i], c=pp.mplColors[i], s=self.marker_size**2) self.outfile_base = 'transect_Y{}X{}_Y{}X{}'.format( start_yx[0], start_yx[1], end_yx[0], end_yx[1]) # title msg = 'y/x: ({}, {}) --> ({}, {})'.format(start_yx[0], start_yx[1], end_yx[0], end_yx[1]) if 'Y_FIRST' in self.atr.keys(): lat0, lon0 = self.coord.radar2geo(start_yx[0], start_yx[1])[0:2] lat1, lon1 = self.coord.radar2geo(end_yx[0], end_yx[1])[0:2] msg += '\nlat/lon: ({:.4f}, {:.4f}) --> ({:.4f}, {:.4f})'.format( lat0, lon0, lat1, lon1) self.ax_txn.set_title(msg, fontsize=self.font_size) # axis format self.ax_txn.yaxis.set_minor_locator(ticker.AutoMinorLocator(10)) self.ax_txn.set_xlabel('Distance (km)', fontsize=self.font_size) self.ax_txn.set_ylabel(self.disp_unit, fontsize=self.font_size) self.ax_txn.tick_params(which='both', direction='in', labelsize=self.font_size, bottom=True, top=True, left=True, right=True) self.ax_txn.set_xlim(0, txn['distance'][-1] / 1000.0) self.fig.canvas.draw() return
def draw_transection(self, start_yx, end_yx, start_lalo=None, end_lalo=None): """Plot the transect as dots""" self.ax_txn.cla() # loop for all input files for i in range(self.num_file): # get transection data if start_lalo is not None: # use lat/lon whenever it's possible to support files with different resolutions txn = ut.transect_lalo(self.data_list[i], self.atr_list[i], start_lalo, end_lalo, interpolation=self.interpolation) else: txn = ut.transect_yx(self.data_list[i], self.atr_list[i], start_yx, end_yx, interpolation=self.interpolation) # distance unit and scaling if txn.get('distance_unit', 'm') == 'pixel': dist_scale = 1.0 dist_unit = 'pixel' else: dist_scale = 0.001 dist_unit = 'km' # plot self.ax_txn.scatter(txn['distance'] * dist_scale, txn['value'] - self.offset[i], c=pp.mplColors[i], s=self.marker_size**2) y0, x0, y1, x1 = start_yx + end_yx self.outfile_base = f'transect_Y{y0}X{x0}_Y{y1}X{x1}' # title msg = f'y/x: ({y0}, {x0}) --> ({y1}, {x1})' if 'Y_FIRST' in self.atr.keys(): lat0, lon0 = self.coord.radar2geo(start_yx[0], start_yx[1])[0:2] lat1, lon1 = self.coord.radar2geo(end_yx[0], end_yx[1])[0:2] msg += f'\nlat/lon: ({lat0:.4f}, {lon0:.4f}) --> ({lat1:.4f}, {lon1:.4f})' self.ax_txn.set_title(msg, fontsize=self.font_size) # axis format self.ax_txn.tick_params(which='both', direction='in', labelsize=self.font_size, bottom=True, top=True, left=True, right=True) self.ax_txn.yaxis.set_minor_locator(ticker.AutoMinorLocator(10)) self.ax_txn.set_ylabel(self.disp_unit, fontsize=self.font_size) self.ax_txn.set_xlabel(f'Distance [{dist_unit}]', fontsize=self.font_size) self.ax_txn.set_xlim(0, txn['distance'][-1] * dist_scale) self.fig.canvas.draw() return