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

Last change on this file since 325 was 325, checked in by pinsard, 17 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

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