source: trunk/SRC/ToBeReviewed/CALCULS/level2index.pro @ 163

Last change on this file since 163 was 163, checked in by navarro, 18 years ago

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
6; @file_comments
7; We want, from a 3d matrix, to extract a 2d (x,y) array whose each element
8; has been extract from a level specified by the 2d level array (typically,
9; we want to obtain the salinity along an isopycn we have repered by its level).
10; level2index is a function who give, in function of level, a 2d indexes array
11; which will allow to extract the 2d array from the 3d array...
12;
13; @categories
14; Without loop
15;
16; @param LEVEL {in}{required}{type=2d array}
17; A 2d level array
18;
19; @returns
20; a 2d indexes array
21;
22; @history
23; Sebastien Masson (smasson\@lodyc.jussieu.fr)
24;                      24/11/1999
25;
26; @version
27; $Id$
28;
29;-
30;------------------------------------------------------------
31;------------------------------------------------------------
32;------------------------------------------------------------
33FUNCTION level2index, level
34; An element of 3d array (whose the two first dimensions are nx and ny) whose
35; coordinates are i, j and k have for index in the same 3d array i + j*nx + k*(nx*ny)
36; level given, for  each point of level, we know i, j et k,
37; so we can calculate the index
38;
39  compile_opt idl2, strictarrsubs
40;
41   taille = size(level)
42   nx = taille[1]
43   ny = taille[2]
44; array k*(nx*ny)
45   tabknxny = (nx*ny)*long(level)
46;
47;
48   return, lindgen(nx, ny)+tabknxny
49end
Note: See TracBrowser for help on using the repository browser.