Call Us: US - +1 845 478 5244 | UK - +44 20 7193 7850 | AUS - +61 2 8005 4826

Storage and Index Order

2 Storage and Index Order – Conventions in Popular Software Environments FORTRAN, IDL, and MATLAB arrays are stored in First_Index_Fastest (column-major) order; all other major programming languages store arrays in Last_Index_Fastest (row-major) order. Both storage orders were permitted in PDS3 data, but Last_Index_Fastest (row-major) was the default and recommended storage order. FITS format uses First_Index_Fastest storage order if one assumes that the shape of the array is defined by (NAXIS1, NAXIS2, …). However, the popular FITS programming libraries cfitsio and pylab describe the arrays as Last_Index_Fastest, i.e., with the shape (…, NAXIS2, NAXIS1). VICAR indices are listed in First_Index_Fastest order, although this only affects the definitions of keywords N1, N2, N3, and N4. In practice, VICAR mixes together the issues of storage order and axis meaning, using other keywords NS, NL, NB, and ORG. ISIS produces arrays in First_Index_Fastest storage order by default. ISIS has an output parameter switch that allows arrays to be produced in Last_Index_Fastest order. 4A.3 Array Storage Elements PDS accommodates only binary data in arrays (no character formats). Characteristics of the homogeneous elements (or pixels) in an array must be described using the Element_Array class. PDS Standards Reference 1.11.0 2018-10-01 23 4A.4 Axis Meaning In an N-dimensional array, each axis needs to be assigned a meaning. Common uses of axes are for spatial coordinates, RGB color, frequency or wavelength, and time. PDS uses the terms Line and Sample to distinguish the two axes of a displayed array. It shares this usage with VICAR and ISIS, but not FITS. The relationship is defined exclusively by the storage order in the file, with the line number increasing more slowly than the sample number. This means that, for Last_Index_Fastest ordering of a 2-D array, the first index would be the slower varying or the Line dimension, while the second index would be the faster varying or Sample dimension; the array would have index order (Line, Sample). In an array with two spatial dimensions and one spectral dimension, PDS uses the term Band to designate the spectral axis. A spectral axis may vary faster than both spatial axes, slower than both, or in between the two. An array in which the band axis varies slower than the two spatial axes is typically referred to as band sequential. An array in which the band axis varies faster than the two spatial axes is typically identified as sample interleaved or band interleaved by pixel. An array in which the band axis varies slower than the Sample axis, but faster than the Line axis, is referred to as line interleaved or band interleaved by line. For Last_Index_Fastest storage, a 3-D band sequential array (sometimes known as a ‘cube’) would have index order (Band, Line, Sample), a sample interleaved array would have index order (Line, Sample, Band), and a line interleaved array would have index order (Line, Band, Sample). To maximize the efficiency of playing potentially large movies (Array_3D_Movie), the temporal axis should be the slowest varying axis. Particle data often have one or more look directions (for example, polar and azimuthal angles) and an energy dimension. While these data have similarities to ‘band sequential’ formats, they are not image data in the traditional sense. The characteristics of each array axis are modeled using the Axis_Array class. There must be one (and only one) Axis_Array class present in the label for each dimension of an array.