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

Last change on this file since 214 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
RevLine 
[2]1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
[142]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...
[2]12;
[142]13; @categories
[157]14; Without loop
[2]15;
[163]16; @param LEVEL {in}{required}{type=2d array}
[142]17; A 2d level array
[2]18;
[142]19; @returns
20; a 2d indexes array
[2]21;
[142]22; @history
[157]23; Sebastien Masson (smasson\@lodyc.jussieu.fr)
[142]24;                      24/11/1999
[2]25;
[142]26; @version
27; $Id$
[2]28;
29;-
30;------------------------------------------------------------
31;------------------------------------------------------------
32;------------------------------------------------------------
33FUNCTION level2index, level
[142]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
[114]38;
39  compile_opt idl2, strictarrsubs
40;
[2]41   taille = size(level)
42   nx = taille[1]
43   ny = taille[2]
[142]44; array k*(nx*ny)
[2]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.