Jason Ng 15/May/91 HDF VSET 2.1beta These are additional routines that are added to version 2.0. Refer to the existing HDF Vset manual for a description of the entire Vset interface. Some terminology FIELD A field is defined by the user to describe data associated with one variable. It consists of a name, type and order. Users of Vsets typically have datasets of several variables, and hence define several fields. For example, a field can be defined for a pressure variable to be called "pres". Its type is FLOAT, and its order is 1. ORDER The number of distinct components in a field. Simple variables/fields like pressure have order 1 (one distinct component, ie itself). VGROUP A Vset element where links to other elements are stored. A vgroup is used to group related elements together. Elements can be vdatas, vgroups, and other HDF elements like raster images, palettes, etc. VDATA A Vset element where data is stored. One vdata can store data of one or several different fields. Fields can be of different types (integer, float, etc). See FIELD. VSET 2.1 VGROUP MANIPULATION ROUTINES Vflocate() Tests if a field exists in the vdatas belonging to a vgroup. Fortran: VFLOCC Vinqtagref() Tests if a given tag/ref pair is in a vgroup. Fortran: VFINGTR Velts() Returns the number of elements (links) in a vgroup. Fortran: VFELTS Vntagrefs() Returns a count of the number of tag/ref pairs in a vgroup. Fortran: VFNTR Vgettagrefs() Returns ALL the tag/ref pairs in a vgroup. Not to be confused with Vgettagref() [VFGTR in Fortran]. Fortran: VFGTTRS Vgettagref() Returns a tag/ref pair at a specific position in the vgroup. Not to be confused with Vgettagrefs() [VFGTRS in Fortran]. Fortran: VFGTTR Vaddtagref() Inserts a tag/ref pair into a vgroup. Can be the tag/ref of non-vset elements. Fortran: VFADTR VSET 2.1 HIGH-LEVEL WRITE ROUTINES VHstoredata() Stores data of a simple field into a vdata. Fortran: VHFSD VHstoredatam() Stores data of a compound field into a vdata. Fortran: VHFSDM VHmakegroup() Creates a vgroup given some tag/ref pairs. Fortran: VHFMKGP Quick creation of simple Vsets in the majority of cases can be achieved using only the High-Level Write routines. VHstoredata - creates a vdata of a simple variable VHstoredatam - creates a vdata of a compound variable VHmakegroup - creates a vgroup. VHstoredata() and VHstoredatam() are 2 routines used for storing data from arrays into a vdata. VHmakegroup() creates a new vgroup given a series of tag/ref pairs. VHstoredata() is used for storing a simple variable. VHstoredatam() is used only if a compound variable is to be stored as a single field of order > 1. C EXAMPLE Vset created by the C sample program: /* SAMPLE C PROGRAM HDF VSET 2.1 Jason Ng NCSA MAY 1991 This program demonstrates the use of the high-level VSET write routines. It shows how data can be stored in vdatas, and how vgroups can be created from vdatas, vgroups and other HDF elements. This example creates a file "vtesthi.hdf" that may be viewed using the vset utility "vshow". DETAILS This example shows how pressure data and color data can be stored as a vset. To store pressure data, a field named "PRES", is defined of float type. The routine VHstoredata() stores the pressure values in a vdata. Color data comprises 3 components (red, green, blue). These can be stored as 3 different fields in 3 vdatas. But this example shows that they can be treated as ONE field, and stored together as a compound field called "COLOR". The number of components of a field is called its order. In this case, "COLOR" has order-3. (whereas "PRES" above has order-1). The routine VHstoredatam() must be used to store values of a compound field. This is similar to VHstoredata() but has an extra argument for the order to be specified. Finally a vgroup is created, and the ids of the created vdatas are stored in the vgroup. This effectively groups the vdatas together. This example also shows that you can insert another vgroup, as well as a non-vset element (in this case, some element with tag=7777 and ref-1) into a vgroup. */ #include "vg.h" #define fs "vtesthi.hdf" #define NP 100 #define NC 60 #define ORDERC 3 /* 3 color components: rgb */ main (ac,av) int ac; char**av; { printf("%s: tests high-level routines\n", av[0]); printf("Creates 2 vdatas, a vgroup, and a non-vset element\n"); printf("then link them all into another vgroup\n"); printf("Vdata 1 contains an order-1 float field PRES\n"); printf("Vdata 2 contains an order-3 integer field COLOR\n\n"); printf("The non-vset element has tag=7777, ref=1\n"); doit(); printf("all done. created file %s\n", fs); } /*-------------------------------------------------------*/ doit() { DF * f; float pvals[NP]; int cvals[NC] [ORDERC]; int i,j; int16 pid, cid; /* refs of vdatas */ int16 eid; /* empty vgroup's ref */ int16 gid; /* vgroup's ref */ int16 tags[10], refs[16]; char *CLS = "EXAMPLE"; /* --- generate data here --- */ for(i=0;i