Using the original three-dimensional (3D) volume’s first meridian slice (0 degrees east longitude), we can display a longitudinal average. NumPy can be used on arrays with multiple dimensions. Whole+1), axis=0) used as X axis for plot While performing the average can be done with one line of code with NumPy, it takes a few more lines of code to make it happen in ParaView, as we need to create a vtkTable to be able to make a plot in an XYChartView.ĭata = np.mean(inData.reshape(whole+1, For example, we can perform one-dimensional (1D) averages over latitude or longitude. Once the volume is resampled, the 2D array of data can be further processed. Zc_other = np.zeros(xc.size).reshape(xc.shape)Ĭoordinates = algs.make_vector(xc.ravel(), Pts.SetData(dsa.numpyTovtkDataArray(coordinates, Whole-whole+1, whole-whole+1])Ĭoordinates = algs.make_vector(Xc.ravel(), Whole = [executive.WHOLE_EXTENT().Get(outInfo, i) OutInfo = executive.GetOutputInformation(0)Įxts = [executive.UPDATE_EXTENT().Get(outInfo, i) We add the copies of the grid to a vtkMultiBlockDataset structure of a programmable source.įrom vtk.numpy_interface import algorithms as algs The first one has coordinates wrapped into cylindrical space to sample the output volume, and the second one is a flat sheet for printing. To do so, we create a two-dimensional (2D) vtkStructuredGrid at the required sampling resolution and use two copies of the grid.įigure 1: Cylindrical data resampling of the radial component of the magnetic field (Br). Our driving goal is to use a structured grid, instead of a vtkPolyData object, in order to further manipulate the resampled data using NumPy’s numerous methods of data analysis. We have prototyped sampling spherical data with cylinders and displaying the data as an unwrapped sheet with Python programmable sources and filters. The challenge is to get to the library from ParaView. VTK includes all of the mappings of the PROJ.4 library. Likewise, the display of constant-radius surfaces such as the outer surface of the Earth is traditionally done with well-known cartographic projections, such as the Mercator, Winkel, or Hammer projections, to cite just a few. However, it is best to display the data as an unwrapped sheet on a piece of paper. It is thus naturally more interesting to sample such spherical data with cylinders aligned with the poles. In the study of convection-driven dynamo models in Earth-like planets, the flow in rapidly rotating convection is dominated by columns aligned with the axis of rotation. Using a vtkStructuredGrid, we are able to maintain a spherical grid structure, enabling volume of interest (VOI) selection for certain radii or for latitudinal or longitudinal subsections. The Visualization Toolkit (VTK) does not have a native spherical grid structure for data based on spherical coordinates (R-, θ-, Φ). Some of the added features are generic enough to be used by other communities of users. This article provides details on the implementation of a selection of these filters as Python programmable filters. With the ability to write data sources and filters in Python code within a ParaView pipeline, we are able to quickly prototype added functionality that our geodynamic scientists are eager to use.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |