VTK Export API Reference

Mera renders volumes two ways. volumerender and its camera helpers volumelook, volumeorbit and volumepath render inside Julia; see Volume Rendering. This page is the VTK export route instead: Mera writes VTK files and you open those in ParaView, the narrative guides are Intro, Hydro and Particles, which cover the ParaView side: colormaps, lighting and camera work all happen there, not in Julia.

Export

Mera.export_vtk — Function
export_vtk(gas::HydroDataType, outprefix::String; scalars=[:rho], scalars_unit=[:nH], kwargs...)
export_vtk(part::PartDataType, outprefix::String; scalars=[:mass], scalars_unit=[:Msol], kwargs...)

Write cells or particles to VTK files, for 3-D viewers such as ParaView.

Cells are written as points at their centres, one file per level (<outprefix>_L<level>.vtu, and <outprefix>_vec_L<level>.vtu for a vector), with multiblock files that collect them (<outprefix>_scalar.vtm, <outprefix>_vector.vtm). Particles are written as points to one file, <outprefix>.vtu.

Arguments

  • gas, part: the data to export, or a selection.
  • outprefix::String: the start of the file names, with its folder, e.g. "vtk/galaxy".

Keywords

Data:

  • scalars, scalars_unit: the quantities to write and one unit each; anything getvar computes. Defaults: [:rho] in [:nH] for cells, [:mass] in [:Msol] for particles.
  • scalars_log10::Bool = false: write log10 of the scalars. Zero becomes -30, and negative values are written as log10 of their absolute value, with a count of them.
  • vector = [missing, missing, missing]: three components of a vector, e.g. [:vx, :vy, :vz].
  • vector_unit::Symbol = :km_s, vector_name = "velocity", vector_log10::Bool = false: its unit, its name in the file, and log10.
  • positions_unit::Symbol = :standard: the unit of the positions; :standard means code length.

Levels (cells only):

  • lmin = gas.lmin, lmax = gas.lmax: the levels to write.
  • interpolate_higher_levels::Bool = true: average cells finer than lmax onto level lmax; with false they are left out.
  • max_cells::Int = 100_000_000: the most points per level; above it, the points with the most finer cells under them are kept.

Limits and output:

  • max_particles::Int = 100_000_000: particles only; the first max_particles rows are written.
  • compress::Bool: compress the files; on by default for cells, off for particles.
  • chunk_size::Int = 50000: not used at present.
  • verbose::Bool = true: print progress.
  • myargs::ArgumentsType: set verbose in one object.

Examples

julia> export_vtk(gas, "vtk/galaxy"; scalars=[:rho, :T], scalars_unit=[:nH, :K],
                  scalars_log10=true, vector=[:vx, :vy, :vz], positions_unit=:kpc)

julia> export_vtk(stars, "vtk/stars"; scalars=[:mass, :age], scalars_unit=[:Msol, :Myr])

See also savedata.

Returns, for cells, the written paths (scalar_files, vector_files, scalar_vtm, vector_vtm), with vector_vtm empty without a vector; for particles, nothing.

For maps you can display directly in Julia: see the Projections API and Off-axis Projection API. Mera's Makie support activates automatically once a Makie backend such as CairoMakie is loaded.


Every docstring in the package is also on the Complete API Reference.