Convert MATLAB data to Vapor

4 posts / 0 new
Last post
brea.pedro_660549
Convert MATLAB data to Vapor
So I need to convert MATLAB data into VAPOR to visualize turbulent flows but I have no clue how to do this. Can anyone shed some light on the subject?
clyne

If you have your data stored in memory as a MabLab array then the most simple way would be to save your arrays to disk as *raw* binary files, and used VAPOR's vdfcreate and raw2vdc commands to convert the raw data to VAPOR's VDC format. The conversion process (once you have raw data saved on disk) is described here:

 

https://www.vapor.ucar.edu/docs/usage/vapor-data-preparation

noahw_664630
Can you provide any more details on how to save arrays to disk as *raw* binary files? 1) Using the MatLab function fwrite I generate the binary file 'nine.bin' from an array that has the dimensions 620x1144x300 2) I have created a vdf file foo.vdf using vdfcreate: vdfcreate -dimension 620x1144x300 -numts 1 -level 0 -varnames vx:vy:vz foo.vdf 3) I attempt to transform the raw data nine.bin to vdf format: raw2vdf -ts 0 -varname vx:vy:vz foo.vdf nine.bin The output is 'Unknown variable "vx:vy:vz"'
clyne

A couple of things:

 

1. I'm not a mablab user, so I don't know what the fwrite function does. But you should verify that the size of the file created on disk matches your expectations. I.e. for a variable with dimensions 620 x 1144  x 300 the size of the output file should be 620 * 1144 * 300 * 4 bytes (assuming 32-bit precision floats)

 

The first vapor command, vdccreate, is generating a .vdf file with three data variables named, "vx", "vy", and "vz".

 

Using the second command, raw2vdf, you can populate the resulting .vdf file from the previous command, but it must be done *one variable at a time*. Hence, you should invoke raw2vdf once for each variable. E.g. 

raw2vdf -varname vx ...

raw2vdf -varname vy ...

raw2vdf -varname vz ...

 

That is, assuming you do indeed have three variables.