comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Specification for a new array slicing function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Specification for a new array slicing function [message #15437] Wed, 19 May 1999 00:00 Go to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Please find below a suggested specification for a new array slicing
function, formatted as a standard IDL prolog. The intention here is to
provide a means to extract n-dimensional array 'slices' from an existing
array in memory. The caller can choose to skip elements along any or all
dimensions if desired.

Comments are invited. There's no code yet, so now is the time.

Cheers,
Liam.

;+
; NAME:
; ARRAY_SLICE
;
; PURPOSE:
; Extract an n-dimensional slice from an array in memory.
;
; CATEGORY:
; Array processing.
;
; CALLING SEQUENCE:
; RESULT = ARRAY_SLICE( ARRAY )
;
; INPUTS:
; ARRAY The array from which data will be extracted.
; ARRAY must be defined and have one or more
; dimensions, otherwise execution will halt.
;
; OPTIONAL INPUTS:
; None.
;
; INPUT KEYWORD PARAMETERS:
; START Set this keyword to a vector containing the start
; position for extraction along each dimension
; (default is [0,0,...,0]).
; START must have the same number of dimensions
; as ARRAY, otherwise execution will halt.
; START is automatically limited to minimum and
; maximum values suitable for ARRAY.
; STRIDE Set this keyword to a vector containing the
; sampling interval along each dimension
; (default is [1,1,...1] for contiguous extraction).
; STRIDE must have the same number of dimensions
; as ARRAY, otherwise execution will halt.
; STRIDE is automatically limited to minimum and
; maximum values suitable for ARRAY.
; COUNT Set this keyword to a vector containing the
; number of items to extract along each dimension
; (default is to extract all data).
; COUNT must have the same number of dimensions
; as ARRAY, otherwise execution will halt.
; COUNT is automatically limited to minimum and
; maximum values suitable for ARRAY.
;
; OUTPUT KEYWORD PARAMETERS:
; None.
;
; OUTPUTS:
; RESULT The extracted array (all dimensions are left intact).
; If none of START, STRIDE, COUNT are specified,
; returns a copy of the input array.
;
; OPTIONAL OUTPUTS:
; None.
;
; COMMON BLOCKS:
; None.
;
; SIDE EFFECTS:
; None.
;
; RESTRICTIONS:
; None.
;
; EXAMPLE:
;
; ;Extract every other element along each dimension
;
; array = findgen( 1, 10, 5, 6, 7 )
; ndims = size( array, /n_dimensions )
; stride = replicate( 2L, ndims )
; result = array_slice( array, stride=stride )
; help, result
;
; ;RESULT FLOAT = Array[1, 5, 2, 3, 3]
;
; MODIFICATION HISTORY:
; $Id: array_slice.pro,v 1.1 1999/05/19 19:44:27 gumley Exp $
;-

---
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Still IDL's Table Widget
Next Topic: Skipping a line while reading a file.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:26:29 PDT 2025

Total time taken to generate the page: 0.00430 seconds