This directory contains a set of useful macros. To learn what a specific macro
does, see the comment for the macro (which is accessible either from the
Help..Application Comment option, or from the Open File dialog box).
A few of these macros require data sets to be Import'd. These data sets are
located in ../data.
-
AntiAlias.net
(view/run it)
This macro will create an anti-aliased version of your image. It has
as inputs the object to be rendered (typically whatever you are
passing to the Image tool), along with the camera used for your
desired view (the second output of your image tool). You can also
choose whether or not to write out the anti-aliased image to a file.
Note that screen objects (captions and colorbars) will end up half as
large in the anti-aliased version of the image. Thus you should
increase the "height" parameter of a caption or the "shape" parameter
of a colorbar by a factor of 2 before passing the collected object to
AntiAlias.
Also note that lines (showconnections, for example, or line fonts)
will tend to become dimmer after passing through the anti-aliasing
process. You may want to brighten the colors first using
Mark(object,"colors")-> Compute(2*a) ->Unmark(object).
-
AutoRegrid.net
(view/run it)
Given a set of scattered points, this macro interpolates the scattered
points onto a regular grid computed from the bounding box and the
number of points using Regrid. Refer to the description of Regrid for
more information.
-
BandColors.net
(view/run it)
This macro takes as input a 2D scalar field, a scalar list with n
items and a list of colornames with n+1 items. It creates as output a
banded version of the 2D field, colored using the list of given colors
from min_of_data to max_of_data. As a second output, it gives the
colormap, for use with the ColorBar module, for example.
This macro requires the macro ConvertColorNameList, also found in this
directory.
-
CDF_EPOCHbreakdown.net
(view/run it)
Converts a CDF EPOCH into its component parts as Import'd by DX as the
position value for a series.
-
CDF_GlobalAttributes.net
(view/run it)
Extracts NSSDC standard CDF Global Attributes as Import'd by DX.
-
CDF_VariableAttributes.net
(view/run it)
Extract NSSDC standard attributes for a CDF variable as Import'd by DX
as field attributes.
-
Clock.net
(view/run it)
Creates a clock with a single sweep hand with the hand at a specific
position. The color and opacity may be specified. The range in value
corresponding to a full sweep may be specified.
-
ClosedIsosurface.net
(view/run it)
This macro "caps the holes" in an isosurface. These holes may be
present if the isosurface intersects the boundary of the data set. The
macro uses ShowBoundary, Band, and Include to determine the necessary
caps for the isosurface. The user needs to specify whether the
"inside" of the isosurface contains values larger than, or smaller
than, the isovalue given.
-
ComputeGroupMemberMeans.net
(view/run it)
Given a group or series, creates a list of the mean values of each
member.
-
ConvertColorNameList.net
(view/run it)
This macro takes as input a list of colorname strings (such as "red",
"linen", "cyan", "light goldenrod", etc.) and converts it to a list
of rgb vectors.
-
ConvertToCellCentered.net
(view/run it)
This program converts a field from positions-dependent to
connections-dependent without interpolating data as would be the case
for Post. This program is intended to be used for cases where data
can only be imported as positions-dependent because the original
structure does not make a distinction between positions-dependent and
connections-dependent and Data Explorer assumes a default of
positions-dependent (i.e., CDF, netCDF and HDF). Since that
information is not typically imbedded in the file, only the user would
be aware that such a transformation would be required. In such cases,
the bounding box for the data is not exactly correct, which Post
preserves. This program would make the appropriate adjustment. This
problem occurs often for gridded observational data in the earth and
space sciences.
-
Decrement.net
(view/run it)
This simple macro simply decrements a value by 1.
-
Equals.net
(view/run it)
This simple macro outputs 1 if two inputs are equal, and outputs 0
otherwise.
-
ExtractBoundingBox.net
(view/run it)
Extracts and separates the coordinates of the bounding box of an
object.
-
FindPosWithLargestData.net
(view/run it)
This macro, given a data field, extracts the position(s) associated
with the largest (or smallest) data value(s).
If you know that only *one* position has the extreme data value, this
macro could be simplified a great deal, removing all the get and set
pairs and simply outputing the outputs of the two Selects near the
left side of the macro, with the which parameter of the Selects set to
0.
Sort is used to first sort the data field by data field, in either
descending or ascending order. Thus the extreme data values are all
near the beginning of the data component. The associated positions are
of course also now at the beginning of the positions component.
There are several Get/Set pairs in this macro. One holds a counter for
selecting from the data and positions components. Another holds the
last data value, for comparison with the current value. This will
control the termination of the macro. Another two Get and Set pairs
are used to create the list of data values and list of positions, for
the situation when there is more than one extreme data value.
-
GreaterThan.net
(view/run it)
If the first input is greater than the second input, this macro
outputs 1. Otherwise it outputs 0.
-
Increment.net
(view/run it)
This simple macro increments a value by 1.
-
IsoColor.net
(view/run it)
This macro creates a combined realization of pseudo-colored
(AutoColor) contour lines of specified increment and range overlaid on
a pseudo-color image of a scalar field. Either technique or both may
be the result. Data may be treated as either connection- or
position-dependent.
IsoColor provides the user with less flexibility and fewer options than does
the macro IsoImage.
-
IsoImage.net
(view/run it)
This macro creates a combined realization of pseudo-colored contour
lines of specified increment and range overlaid on a pseudo-color
image of a scalar field or filled contours. Outputs include the
pseudo-colored field only, contour lines, and the colored field
combined with contours, Data may be treated as either connection- or
position-dependent for the pseudo-color image. The user provides
colors for the contours and image.
-
JulianDayToMonthDay.net
(view/run it)
Given a year and Julian day for that year, a year, month and day of
month string is created in two formats: dd-mmm-yyy and yyyymmdd, where
mmm is a string month (i.e., Jan, Feb, etc.) and mm is the month
number.
-
Laplacian.net
(view/run it)
The Laplacian of a scalar field is computed by computing the gradient
of the field and dotting the resultant vector field with itself.
-
MakeBox.net
(view/run it)
The macro accepts as input an [x, y] location and [delta_x, delta_y].
The former is used to define the center of a rectangle. The latter is
used to define the size of the rectangle. The user can also specify
the color of the rectangle, which will consist of lines.
-
MakeOneField.net
(view/run it)
If you are importing data using the general array format, and you
specify that there are "n" different fields in the file, it will be
imported as a group with "n" members.
This macro converts this group into a single field, with a number of
components, where the component names are the given field names. This
is sometimes a more useful structure. Note that you will generally
need to use Mark to mark a particular component as "data" in order to
use most DX modules, which expect the data to be in a component named
"data".
-
MapOnStates.net
(view/run it)
This macro maps a given field onto the 48 continental states in the
U.S. It is assumed that the positions of the input field contains a
list of the integers 0 to 47, where each integer represents one of the
48 states in strict alphabetical order. The data component of the
input field will be mapped onto the shapes of the states.
-
Not.net
(view/run it)
If the input is non-zero, this macro outputs 0, else it outputs 1.
-
ReduceTriangles.net
(view/run it)
Does a crude simplification of a triangular mesh to provide the
"equivalent" of Reduce for unstructured meshes.
-
ReverseFrontAndBack.net
(view/run it)
This program reverses the front and back faces of an object. This
program can change both the direction of the normals and the
orientation of the connections. By default it assumes that the normals
and the connections of the input object are already consistent with
one another (see the discussion of "Standard Components" in Chapter 3
of the Data Explorer User Guide). Therefore as it flips the
connections (which changes the definition of "front" and "back") it
also flips the orientation of the normals. If your normals are *not*
consistent with the orientation of your connections, then you should
set the "reverse_normals" parameter of this macro to 0.
-
ShowBackSides.net
(view/run it)
This macro, given a 3D data set with regular connections, returns just
three sides of the boundary of the data set. This is sometimes useful
as a "backdrop" for other realizations in a data set, such
-
StreamlineArrow.net
(view/run it)
Generates streamlines, optionally colored (e.g., fixed or
pseudo-colored by magnitude), which show the direction of the vector
field with small arrows. In some sense, this tool emulates the
well-known and venerable STRMLN function of NCAR graphics. Currently
this tool only operates correctly with 2d vector
-
SubSample.net
(view/run it)
Subsamples a field with regular connections as a way of reducing the
resolution. It will be faster than Reduce, but will not do
interpolation. Hence, there will not be smoothing, but some local
information will be lost. The field may be sampled uniformly along
each axis or at a different level for each dimension.
-
SumList.net
(view/run it)
This macro accumulates the values in a list.
The user specifies the list and an initial value for the accumulation
(which defaults to 0). The accumulation is automatically reset each
time the macro is rerun.
-
SurfaceFlux.net
(view/run it)
Given a surface and a vector flux field, this macro computes the
integrated flux through the surface. The user has the option of
reversing the sign of the flux through a third parameter (the default
behavior is that positive flux flows through connection elements from
"back" to "front" as defined by the orientation of the connection
elements).
-
TextureMap.net
(view/run it)
This macro takes a rectangular surface and an image and arranges it so
that the image is texture mapped onto the surface at rendering time.
The detail in the final picture is obtained from the image which is
input to this macro, not from the number of quads in the input
surface. To see a texture mapped image you must be using the hardware
rendering option in the Image macro, and you must be running on a
system which supports texture mapping (currently systems which use
OpenGL for rendering - the dec alpha and ibm6000s with OpenGL
support. See the -hwrender option of the dx command by running "dx
-morehelp" for more information on ibm6000 options.)
The first input to this macro is the rectangular surface to be shown.
The second input is the orientation of this surface. It is a number
between 0 and 7; see the Reorient module for an explanation of how to
specify a specific orientation (or just try some numbers out). For
good performance there should be as few quads in the surface as
possible - use Reduce before putting the surface into this macro to
reduce the number of quads. The surface can be a single quad
constructed with the Construct module; this will have the best
possible performance.
The third input is the image to be mapped onto the surface. The
fourth input is the orientation of this image relative to the
surface. Again, see the Reorient module for an explanation of how to
specify orientations.
The last input controls the size of the texture map. The input must
be a number between 6 and 12 (default 7) which specifies what power of
2 the size will be. 2**6 is 64, 2**7 is 128, etc. Since hardware
requires that the texture map be a power of 2 in resolution, this
macro resamples the image into a 32x32, 64x64 etc image. The original
image can be any size. The smaller the size of the texture map the
faster the rendering, with some loss of precision relative to the
original image. There is usually a limit in the hardware card for the
maximum size of a texture map; if the size exceeds that limit the
rendering will either fail or will become drastically slower as main
memory may be used instead of memory local to the hardware rendering
card.
If the surface is to be deformed, the texture must first be mapped to
the flat surface and then the RubberSheet module can be used to deform
the underlying surface. If the resulting image looks bright with no
relief discernable use the Shade module to enable shading. If the
image then looks dark, it may be because the hardware card is
interpreting the front of the image as the back. Use the following
sequence of 3 modules to invert the shading: Mark(object, "normals")
-> Compute(object, expression="-a") -> Unmark(object). Use this
sequence after the Shade module and before the Image module.
-
TranslateToOrigin.net
(view/run it)
This simple macro translates an object to the origin, so that if you
use Rotate, the object will rotate about its center.
-
UniformSample.net
(view/run it)
This macros samples the selected manifold at a set of more-or-less
uniformly spaced samples on a surface of quads or within a volume of
cubes. The parameter density, which is the approximate number of
points that result, controls the spacing of the samples. The method
by which the sample points are selected is different than that of
Sample, which does not always produce a uniform distribution. The
output of this macro is a set of unconnected positions. Any
components in the original field manifold that are dependent on either
positions or connections are mapped onto the resulting samples. In
either case the dependency of the component in the output field will
be dependent on the positions.
-
UnsquishGlyph.net
(view/run it)
Often people are visualizing data which has vastly different extents
in the different dimensions. Scale is used to modify the appearance of
the final image. If Scale is used immediately prior to the Image tool,
then any AutoAxes used will display the correct, unscaled values along
the axes. Unfortunately, if glyphs are used in the image, the glyphs
will be scaled as well, and will show up as "squished".
This macro provides a simple solution for the "squished glyph
syndrome". You give the macro the scale factor which you plan to use
for the entire image. The macro produces an inversely squished glyph
which you in turn give as a "user-given glyph" (see the man page for
AutoGlyph if you're interested). Simply pass the output of the macro
to the second tab of Glyph or AutoGlyph (the "type" parameter.
You need to tell the macro whether you want a scalar or vector glyph,
and the "quality" of the glyph (a number from 0 to 1, or one of the
defined glyph types (again, see the AutoGlyph man page).
-
VolumeIntegrate.net
(view/run it)
Given a volume and a scalar field, this macro computes the integrated
field within the volume.
Note that if you just want the volume contained within a surface, the
Measure module will do this.