vde2000--Notes on exploring dataset #2

pahsieh at usgs.gov pahsieh at usgs.gov
Sat Apr 8 12:20:19 EDT 2000


If you are interested in visualizing dataset #2 for
vde-2000, the following notes might be useful. These
are notes for Windows 95/98/NT, Visual C++ development
environment.

This is an interesting data set and is worth the time
to explore it. I also learned a lot about how to handle
big data sets.

Downloading
-----------
The entire dataset (cduskData.tar.gz) is 1.4 Gigabytes.
If you download it via Internet Explorer, then you'll need
double that amount of space. Even if you tell IE to save
the file in a given folder, IE will first download the
whole thing to a folder called "Temporary Internet Files"
and then copy it to your designated folder. So make sure
the "Temporary Internet Files" folder is in a drive with
sufficient space.

Unpacking
---------
Again, make sure you have enough disk space. When you
open cduskData.tar.gz in Winzip, Winzip will extract the
tar file (about 1.6 Gigabytes) to a temporary working directory
(e.g., C:\TEMP), then when you extract individual data
files, you'll use another 1.6 Gigabytes.

Reading the data files
----------------------
The data files are in "hdf" format. You can find out about
hdf from

http://daac.gsfc.nasa.gov/REFERENCE_DOCS/HDF/gdaac_hdf.html

You'll need to download the hdf software library, which is needed
to read the data files. Although the user's guide is over a
hundred pages long, the procedure for reading the cdusk data is
actually quite simple and is described below.

1. From the above-cited web page, follow the links to download the
file hdf41r3.zip. This is the "windowsNT-95 precompiled binaries".
You get only the library for building in the "release" configuration.
If you want to build in "debug" configuration, you'll need to download
hdf41r3s.zip (source code) and build the debug library yourself.
Installation instructions are given in the file INSTALL_NT_95.txt.

2. Unzip the library to your hard disk.

3. If you want to have a quick look at one of the cdusk data files,
you can use the "hdp" utility program in the "bin" directory. Open up
a Command Prompt window and run the hdp program with a line command
such as

hdp dumpsds C:\vde2000\data2\cduskcD1334.hdf > cduskcD1334.txt

This would create a 43 Megabytes text file. Open this in a text
editor and search for the word "index" to get to the header information
for each data set. There are a total of 8 data sets:

Index       Description
  0         x-coordinates of the structured points grid for density
  1         y-coordinates   "   "
  2         z-coordinates   "   "
  3         density values, ordered same as vtk.
            (Don't know why some density values are negative)
  4         x-coordinates of the structured points grid for radial velocity
  5         y-coordinates   "   "
  6         z-coordinates   "   "
  7         radial velocity values, ordered same as vtk.


4. Create a VC++ project for your vtk program as usual. Then do the
following to read hdf files.

5. Set your build configuration to "release". (If you want to build
in "debug" configuration, you must first build the debug hdf library.)

6. Click Project->Settings to open up the project settings dialog
box.

7. Select the "C++" tab, then select the "Code Generation" category.
Set the run-time library to either "Single-threaded" or "Multithreaded
DLL".

8. Select the "Preprocessor" category. In the box below
"Additional include directories", put the path to the hdf
header files, e.g., c:\MyHdfStuff\HDF4.1r3\include.

9. Select the "Link" tab. Then select the "Input" category.
In the box below "Object library modules", add "ws2_32.lib" (no quotes)
to whatever is already there. This is a library that comes with VC++.
Next, in the box below "Additional library paths", add the path to
the hdf library. For example, if you selected "single-threaded" in
step 7, you would add something like

c:\MyHdfStuff\HDF4.1r3\lib

If you selected "Multithreaded DLL" in step 6, you would add something
like

c:\MyHdfStuff\HDF4.1r3\dlllib

Note that you don't need to add the actual names of the library files
(e.g., hd413.lib and hm413.lib) because the header files are set up
to automatically load them, as long as you specify the folder where
they are located.

10. Close the project settings dialog box by clicking OK.

11. In you vtk program, add the following include statement

#include "mfhdf.h"

12. The procedure to read the hdf file is quite simple, and
is illustrated by the following code segment:


     float *density = new float[150*150*75];
     float *velocity = new float[150*150*75];

     // Define variables used for hdf access
     int32 sd_id, sds_id, index;
     int32 start[3], edges[3];
     intn  status;
     start[0] = 0;
     start[1] = 0;
     start[2] = 0;
     edges[0] = 75;
     edges[1] = 150;
     edges[2] = 150;

     // Change this to where ever the cdusk data are located
     char *fileName = "D:\\vde2000\\data2\\cduskcD1334.hdf";

     // Open the hdf file
     sd_id = SDstart (fileName, DFACC_READ);

     // Select data set specified by index = 3, which is "density"
     index = 3;
     sds_id = SDselect (sd_id, index);

     // Read the data into the "density" array
     status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)density);

     // Terminate access to the data set.
     status = SDendaccess (sds_id);

     // Select data set specified by index = 7, which is "velocity".
     index = 7;
     sds_id = SDselect (sd_id, index);

     // Read the data into the "velocity" array
     status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)velocity);

     // Terminate access to the data set.
     status = SDendaccess (sds_id);

     // Close the file.
     status = SDend (sd_id);

     // The density and velocity arrays are now ready for visualization by
vtk.
      // Since this is a structured points data set, I didn't bother
      // to read the x, y, and z coordinates.


Have fun!

--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list