def get_data_on_vertical_plane(self, varname, record, polyline_points, discretized_number=None): """ Extract values of plan in telemac-3d result file for the given variable @param varname (string) Name of variable for which to extract data @param record (int) Number of desired record @param polyline_points (list) List of points defining the polyline @param discretized_number (list) List of number of discretized points on each polyline segment @returns (numpy.array) """ if self.get_mesh_dimension() != 3: raise TelemacException("Action possible only on 3d mesh") if len(np.shape(np.array(polyline_points))) != 2: raise TelemacException('Warning problem with the list of '\ 'extraction points') if discretized_number is None: discretized_number = self.discretize_polyline(polyline_points) dim = np.shape(np.array(polyline_points))[1] if dim == 2: nplan = self.nplan polygone_discretized_points = linspace_poly(\ polyline_points, discretized_number) npoly = len(polygone_discretized_points) values_polylines = np.zeros((npoly, nplan), dtype=np.float64) abs_curv = curvilinear_abscissa(polygone_discretized_points) for plan in range(self.nplan): values = self.get_data_on_horizontal_plane(\ varname, record, plan) data_interp = mtri.LinearTriInterpolator(self.tri, values) pt_x = [pt[0] for pt in polygone_discretized_points] pt_y = [pt[1] for pt in polygone_discretized_points] values_polylines[:, plan] = data_interp(pt_x, pt_y) else: raise TelemacException('Warning the extraction on a polyline'\ ' of 2d points') return polygone_discretized_points, abs_curv, values_polylines
def get_data_on_polyline(self, varname, record, polyline_points, discretized_number=None): """ Extract values of points over time for the given variable for record @param varname (string) Name of variable for which to extract data @param record (int) Number of the desired record to extract @param polyline_points (list) List of points defining the polyline @param discretized_number (list) list of number of discretized points on each polyline segment if None given will use self.discretize_polyline @returns (numpy.array, numpy.array, numpy.array) """ if self.get_mesh_dimension() != 2: raise TelemacException("Action possible only on 2d mesh") if len(np.shape(np.array(polyline_points))) != 2: raise TelemacException('Warning problem with the list of '\ 'extraction points') if discretized_number is None: discretized_number = self.discretize_polyline(polyline_points) # dimension of the computation result dim = np.shape(np.array(polyline_points))[1] if dim == 2: polygone_discretized_points = linspace_poly(polyline_points,\ discretized_number) values_polylines = self.get_data_on_points(\ varname, record, polygone_discretized_points) abs_curv = curvilinear_abscissa(polygone_discretized_points) else: raise TelemacException('Warning the extraction on a polyline'\ ' is valid only in 2d') return polygone_discretized_points, abs_curv, values_polylines