例について

PVGeo は、 suites と呼ばれるさまざまなサブパッケージに展開されています。これらの suites は、地球科学的な処理と視覚化の一般的な領域に対して、一連のリーダー、フィルタ、ソース、またはライター・アルゴリズム(またはそれらの任意の組合せ)で構成されています。このページの以降のセクションでは、ParaView内で、またはPython環境で直接、各タイプのアルゴリズムを使用するための一般的な手順と構文を示します。

現時点で利用可能なすべての例の概要については、 Quick Examples を参照してください。

例えば、深刻な問題があると思われる場合は、 issues page の問題を開いて、迅速に修正できるようにしてください。

一般的な使用方法

PVGeo に展開されたすべてのアルゴリズムは、Python環境で以下の方法で使用できます。Python環境では、アルゴリズムを呼び出し、パラメータのキーワード引数でインスタンス化してから、入力データセットに適用できます。

import PVGeo
# PSEUDOCODE: Typical use of a PVGeo algorithm:
output = PVGeo.suite.Algorithm(**kwargs).apply(input)

あるいは、例えばさまざまな時間ステップを要求する必要がある場合に、繰り返し呼び出しのアルゴリズムをインスタンス化することもできます。

import PVGeo
# PSEUDOCODE: Typical use of a PVGeo algorithm:
alg = PVGeo.suite.Algorithm(**kwargs)
# Grab the output data object
output = alg.apply(input)
# Update the output to a desired time step
alg.UpdateTimeStep(6.0)

読み取りアルゴリズム

A reader takes data from files and puts them into the proper VTK data structures so that we can visualize that data on the VTK or ParaView pipeline. ParaView and PyVista come with a plethora of native data format readers but there are still many more formats in the geosciences that have not been implemented. By creating formats for common geoscientific formats, we hope to make the process of getting data into the ParaView pipeline or into PyVista data structures as simple as possible.

The file readers in PVGeo are available for use in the same manner as all algorithms in PVGeo. Readers are typically used in a manner that allows the reader algorithm to be repetitively called to request various time steps:

import PVGeo
# PSEUDOCODE: Typical use of a PVGeo reader:
reader = PVGeo.suite.Reader(**kwargs)
reader.AddFileName(['file%.2d' % i for i in range(20)])

# Grab the output data object
output = reader.apply() # NOTE: Readers have no input for the `apply()` call

# Update the output to a desired time step
reader.UpdateTimeStep(6.0)

It is worth noting that if you have only one file (one time step) to read, then readers can be used to immediately produce a data object:

import PVGeo
# PSEUDOCODE: Typical use of a PVGeo reader:
output = PVGeo.suite.Reader(**kwargs).apply('fname.txt')

ParaView Usage

The PVGeo readers aren't directly available in the GUI menus of ParaView but rather a dialog will appear for you to select the desired file reader when selecting File -> Open... within ParaView like the screen recording below:

Filter Algorithms

A filter modifies, transforms, combines, analyses, processes, etc. data in VTK data structures on either a VTK or ParaView pipeline. Filters provide a means for changing how we visualize data or create a means of generating topology for an input data source to better represent that data in a 3D rendering environment.

For example, we have developed a filter called Voxelize Points which takes a set of scattered points sampled on a rectilinear reference frame and generates voxels for every point such that the volume of data made by the points is filled with topologically connected cells. Or for another filter, maybe we might have a series of scattered points that we know represent the center of a tunnel or tube that represents a well. We can use a filter to transform those points into a connected line that we then construct a cylinder around. This allows us to save out minimal data (just XYZ points as opposed to complex geometries that make up the tunnel) to our hard drive while still having complex visualizations from that data.

Filters are typically used in a manner that parameters are set and an input dataset is provided to immediately produce an output. The parameters/options of the filter are set via the **kwargs upon construction and the input(s) is/are given to the apply() call:

import PVGeo
# PSEUDOCODE: Typical use of a PVGeo filter:
output = PVGeo.suite.Filter(**kwargs).apply(inputDataObject)
import PVGeo
# PSEUDOCODE: Typical use of a PVGeo filter with multiple inputs:
output = PVGeo.suite.Filter(**kwargs).apply(input0, input1)

It is also worth noting that filter algorithms can be used as their own entities to make repetitive calls on them much like we showed with readers:

import PVGeo
# PSEUDOCODE: Typical use of a PVGeo filter:
filt = PVGeo.suite.Filter(**kwargs)
output = filt.apply(inputDataObject)

# Change a parameter of the filter
filt.set_parameter(True) # PSEUDOCODE
filt.update() # Make sure to update the output after changing a parameter

# Request a different time step
filt.UpdateTimeStep(6.0)

ParaView Usage

Within ParaView, filters are available for selection directly from the GUI menus when an input data source is selected on the pipeline. All of the PVGeo filters are available under their own categories in the Filters menu.

Source Algorithms

A source takes input parameters from a user and generates a data object for visualization or export. In PVGeo, we have implemented the Model Building suite with many sources that allow for a user to specify attributes of a data set such as a model discretization and have a data source appear in the rendering environment alongside their other data for that scene.

Sources can be used like any algorithm in PVGeo and are typically called to immediately produce an output like below:

import PVGeo
# PSEUDOCODE: Typical use of a PVGeo source:
output = PVGeo.suite.Source(**kwargs).apply()

ParaView Usage

Within ParaView, sources are available for selection directly from the GUI menus. All of the PVGeo sources are available under their own categories in the Sources menu.

Writer Algorithms

PVGeo writers take VTK data structures and write them out to the disk in a non-VTK formats that might be a standard for geoscientific data. PVGeo readers are often deployed with their complimentary writer equivalents such that data can be imported to the pipeline using readers, transformed using filters, then output to the same format in memory for use in an external processing library.

Writers can be used like any algorithm in PVGeo and are typically called to immediately write out a data object like below.

import PVGeo
# PSEUDOCODE: Typical use of a PVGeo writer:
writer = PVGeo.suite.Writer(**kwargs)
filename = 'test-writer.grd'
writer.SetFileName(filename)
writer.Write(inputDataObject)

ParaView Usage

Demonstrated in the following video, a user can select File -> Save Data in ParaView with a selected dataset then choose one of PVGeo's writers. The first 1 minute in the video demonstrates the Extract Topography then the video shows how to save a vtkRectilinearGrid and its attributes to the UBC Tensor Mesh/Model formats using a PVGeo writer.