CSPICE_WNVALD forms a valid double precision window from the contents of a window array. For important details concerning this module's function, please refer to the CSPICE routine wnvald_c.
Given: size the scalar, integer size of the window to validate. This is the maximum number of endpoints that the cell used to implement the window is capable of holding at any one time. n the scalar, integer number of endpoints in the input cell. window on input, is a (possibly uninitialized) cell array containing n endpoints of (possibly unordered and non-disjoint) intervals. the call: cspice_wnvald, size, n, window returns: window on output, is a window containing the union of the intervals in the input cell.
Any numerical results shown for this example may differ between platforms as the results depend on the SPICE kernels used as input and the machine specific arithmetic implementation. ;; ;; Create a cell containing a double ;; precision 30-vector. ;; win1 = cspice_celld( 30 ) ;; ;; Set up the input array. ;; darray = [ [ 0.d, 0.0], [ 10.0, 12.0 ], [ 2.0, 7.0], $ [13.0,15.0], [ 1.0, 5.0 ], [23.0,29.0], $ [ 0.0, 0.0], [ 0.0, 0.0 ], [ 0.0, 0.0], $ [ 0.0, 0.0] ] ;; ;; Fill in the window data. ;; in_start = win1.data in_end = in_start + n_elements( darray ) -1 win1.base[in_start:in_end] = darray ;; ;; Validate window win1. ;; cspice_wnvald, 30, 20, win1 ;; ;; Calculate the number of intervals in the ;; return window 'win1'. ;; no_intervals = cspice_wncard(win1) ;; ;; Output the intervals. ;; for i= 0, (no_intervals -1 ) do begin cspice_wnfetd, win1, i, left, right print, left, right endfor IDL outputs: 0.0000000 0.0000000 1.0000000 7.0000000 10.000000 12.000000 13.000000 15.000000 23.000000 29.000000
The user must create any needed window structures with cspice_celld prior to use regardless of whether the routine uses the window as input or returns it as output. This routine takes as input a cell array containing pairs of endpoints and validates it to form a window. On input, 'window' is a cell of 'size' containing 'n' endpoints. During validation, the intervals are ordered, and overlapping intervals are merged. On output, the cardinality of 'window' is the number of endpoints remaining, and 'window' is ready for use with any of the window routines. Because validation is done in place, there is no chance of overflow.
-Icy Version 1.0.2, 26-NOV-2007, EDW (JPL) Implemented use of cspice_wncard function to return window cardinality. -Icy Version 1.0.1, 12-SEP-2006, EDW (JPL) Correct Required Reading citation CELL.REQ to CELLS.REQ. -Icy Version 1.0.0, 08-AUG-2004, EDW (JPL)
validate a d.p. window
Wed Apr 5 17:58:05 2017