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

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

improvements/corrections of some *.pro headers

  • 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;-
[231]27;
[2]28FUNCTION level2index, level
[231]29; An element of 3d array (whose the two first dimensions are nx and ny) whose
[142]30; coordinates are i, j and k have for index in the same 3d array i + j*nx + k*(nx*ny)
31; level given, for  each point of level, we know i, j et k,
32; so we can calculate the index
[114]33;
34  compile_opt idl2, strictarrsubs
35;
[2]36   taille = size(level)
37   nx = taille[1]
38   ny = taille[2]
[142]39; array k*(nx*ny)
[2]40   tabknxny = (nx*ny)*long(level)
41;
42;
43   return, lindgen(nx, ny)+tabknxny
44end
Note: See TracBrowser for help on using the repository browser.