The "transform" subroutine library is the method for users to link their own code into IVE. The transform routines handle such things as array index to physical coordinate transformations and the calculation of user-derived fields. Users need not supply IVE with a complete set of customized transform routines; IVE will use the default version of any transform subroutine that does not appear in the user's package of customized routines. Customized transform packages may be loaded automatically by setting the environment variable 'IVETRANSFILE' to the full path name of the file containing the customized transforms. Transform routines can also be loaded at any time during an IVE session using the command TRANSFORM_FILE .

The following is the list of standard transform subroutines that may be called during an IVE session. The default IVE transform package is available in both C and Fortran. To download the default transform package, click HERE.

IVE Transform Subroutines

NEW_FILE
This routine is called every time a new file is read in. IVE passes the routine the id of the open netCDF file. The routine can then read any data or attributes off the netCDF file. Quantities that are read by the default version of `new_file' include the global attributes and the data in coordinate variables. Customized versions of `new_file' might read additional data fields such as an array of bottom topography or auxillary data to be used in calculating derived fields.
NEW_FIELD
This routine is called every time a new field is specified. Before calling `new_field' IVE reads in the variable and its attributes IVE passes the routine the name of the field, the data values and the dimensions of the data array. This routine can be used to get and store the physical coordinate values for use by the coordinate transform routines. This routine also can be used to reorder the data array and dimensions.
INDEX_2_PHYS
This routine is used to convert from array indices to physical coordinates. IVE provides a vector containing the array indices The routine should return the corresponding physical coordinates.
PHYS_2_INDEX
This routine is used to convert from physical coordinates to array indices. IVE provides a vector containing the physical coordinates. The routine should return the corresponding array indices. A negative index indicates that this data point should be assigned the missing value (e.g. a point under the terrain) .
HORIZ_TER
This routine is used to provide IVE with an array of terrain heights for a horizontal cross-section. If you have no terrain, this routine should return an array of zeroes.
VERT_TER
This routine is used to provide IVE with an array of terrain heights for a vertical cross-section. If you have no terrain, this routine should return an array of zeroes.
PHYS_2_LONLAT
This routine is used to convert from physical coordinates to longitude-latitude coordinates for the purposes of drawing maps. IVE provides a vector containing the physical coordinates. This routine should return the corresponding longitude-latitude coordinates.
LONLAT_2_PHYS
This routine is used to convert from longitude-latitude coordinates to physical coordinates for the purposes of drawing maps. IVE provides a vector containing the longitude-latitude coordinates. This routine should return the corresponding physical coordinates.
DEFAULT_MAP
This routine returns the map settings when the default map is specified in IVE.
DATA_SLICER_1D
This routine returns the computational points at which a 1d slice should be taken. This is used if IVE cannot figure out on its own which points to use. Normally, IVE will try to space points evenly in computational space if possible. If data_slicer_1d is not available, IVE will evenly space the points in physical space.
DATA_SLICER_2D
This routine returns the computational points at which a 2d slice should be taken. This is used if IVE cannot figure out on its own which points to use. Normally, IVE will try to space points evenly in computational space if possible. If data_slicer_2d is not available, IVE will evenly space the points in physical space.
DATA_SLICER_3D
This routine returns the computational points at which a 3d slice should be taken. This is used if IVE cannot figure out on its own which points to use. Normally, IVE will try to space points evenly in computational space if possible. If data_slicer_3d is not available, IVE will evenly space the points in physical space.
CALC_FIELD
This routine is used to give the user the ability to compute their own derived fields. IVE provides the name of the field requested by the user. The routine computes the derived field and returns it.
HEADING
This routine allows the users to change the main headings on a plot.
FILE_COORDINATE
This routine allows the users to change the current value of the file coordinate used for reading a variable over multiple files (see the MULTIPLE_READ command and the section "Splitting data into multiple files" in IVE Data Format for more details).
Miscellaneous
Users may include any other routines they need as part of the computations for the transform routines. If you start the name of the routine, or any common blocks, with "t_", they will not conflict with the name of any IVE external.

Calling IVE subroutines from the transforms

You may need to call IVE subroutines as part of the transforms. The following is a list of useful routines (Fortran callable):

Programming considerations for writing transforms in FORTRAN

Some of the routines above (for example read_var) deal with pointers to arrays. Standard FORTRAN does not have a concept of pointers. The Sun and DEC FORTRAN compilers have extensions that allow primitive pointer manipulations. The problem is that FORTRAN wants to deal with the arrays and variables themselves, not the pointers. Getting to the object a pointer reference is called "dereferencing a pointer". The method for dereferencing a pointer "p" is to use the built in function "%val(p)". However, this function can only be used in a subroutine or function call, i.e.
    call junk(%val(p))
Subroutine "junk" can then work with the object to which p points. If "p" points to an array, you should also pass to "junk" the array dimensions for use by junk. As an example of this procedure, examine at the FORTRAN version of the default transform discussed below and see how a pointer to a 1D array is dereferenced in the function "t_val".

Examples

There are currently two examples of transforms. The first example consists of the default transforms. The default transforms are sufficiently flexible to handle several types of netcdf files. The second example consists of the transforms to handle real time Numerical Product grids from NMC.

EXAMPLE 1: THE DEFAULT TRANSFORMS

default.c and default.f are C and Fortran versions of the default transforms. The default transforms and IVE can handle the following types of netCDF files:

EXAMPLE 2: TRANSFORMS FOR NMC GRIDS

nps.c is the transform used to handle the real time (HDS/NPS) grids from NMC. The extra features in these transforms are:

back to index