Opening Datasets

Vapor supports a variety of scientific data formats. This notebook shows how to open a dataset and query its metadata.

import example_utils
from vapor import session, renderer, dataset, camera
Warning: sysroot "/Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" not found (ignoring for now).
Vapor 3.9.3
Python 3.9.19 (/opt/anaconda3/envs/vapor)
OpenGL 4.1 Metal - 83.1
print("Supported dataset types:", dataset.Dataset.GetDatasetTypes())
Supported dataset types: ['vdc', 'wrf', 'cf', 'mpas', 'bov', 'ugrid']
ses = session.Session()
data = example_utils.OpenExampleDataset(ses)

# Examples of opening real data
#
# data = ses.OpenDataset(dataset.WRF, ["data/wrf_out.0001", "data/wrf_out.0002"])
# data = ses.OpenDataset(dataset.VDC, ["master.vdc"])
# data = ses.OpenDataset(dataset.MPAS, ["x1.static.nc", "diag.2021-03-04_10.30.00.nc"])

Dump the dataset metadata

data
Dataset: PYTHON_RAM_DATASET
Dimensions:
  __regDim_64: 64
Coordinate Variable Names: ['__regCoord_64_x', '__regCoord_64_y', '__regCoord_64_z']
Data Variables:
  U10
    Dimensionality: 2
    Number of Timesteps: 1
    Coordinates: ['__regCoord_64_x', '__regCoord_64_y']
    Data Range: [-1.9993805885314941, 1.9994730949401855]
  V10
    Dimensionality: 2
    Number of Timesteps: 1
    Coordinates: ['__regCoord_64_x', '__regCoord_64_y']
    Data Range: [-0.2711198925971985, 0.2711198925971985]
  V
    Dimensionality: 3
    Number of Timesteps: 1
    Coordinates: ['__regCoord_64_x', '__regCoord_64_y', '__regCoord_64_z']
    Data Range: [-0.3319709300994873, 0.3319709300994873]

Render the first 2D variable as a wireframe

ren = data.NewRenderer(renderer.WireFrameRenderer)
ren.SetVariableName(data.GetDataVarNames(2)[0]) # Set to first 2D data variable

ses.GetCamera().ViewAll()
ses.Show()
../_images/af12914d7fea8183f70c1f96894ad094d2fd4033c8674d07ad9ff0cc742709e3.png