;+
;
; @file_comments
; calculate the norm of vectors field located on Arakawa C-grid
;
; @obsolete
;
; @param COMPOSANTEU {in}{required}
; Matrix representing the zonal coordinates (at U/V point) of a field of vectors
; A 2D (xy), 3D (xyz or yt), 4D (xyzt) or a structure readable by
; litchamp and containing a 2D (xy), 3D (xyz or yt), 4D (xyzt) array.
; Note that the dimension of the array must suit the domain dimension.
;
; @param COMPOSANTEV {in}{required}
; Matrix representing the meridional coordinates (at V/U point) of a field of vectors
; A 2D (xy), 3D (xyz or yt), 4D (xyzt) or a structure readable by
; litchamp and containing a 2D (xy), 3D (xyz or yt), 4D (xyzt) array.
; Note that the dimension of the array must suit the domain dimension.
;
; @keyword BOXZOOM
; boxzoom on which do the average (by default the domain selected
; by the last domdef done)
;
; @keyword DIREC
; 't' 'x' 'y' 'z' 'xys' 'xz' 'yz' 'xyz' 'xt' 'yt' 'zt' 'xyt'
; 'xzt' 'yzt' 'xyzt' Direction on which do averages
;
; @returns
; A 2D (xy), 3D (xyz or yt), 4D (xyzt) Array
;
; @uses
; common
;
; @restrictions
; The norm is calculated on points T. To do this calculation, we average
; field U and V on points T before calculate the norme. At the edge of
; coast and of domain, we can not calculate fields U and V at points T,
; that is why these points are at value !values.f_nan.
;
; When we calculate on a reduce geographic domain, field U and V have not
; necessarily the same number of point. In this case, we recut U and V to
; keep only common points. We profit of this to redo a domdef which redefine
; a geographic domain on which fields U and V are extracted on same points
;
; To know what type of array we work with, we test its size and dates
; gave by time[0] and time[jpt-1] to know if thee is a temporal dimension.
; Before to start norme, make sure that time and jpt are defined how
; they have to!
;
; @examples
; To calculate the average of the norme of streams on all the domain
; between 0 and 50:
; IDL> res=norme(un,vn,boxzoom=[0,50],dir='xyz')
;
; @history
; 9/6/1999 Sebastien Masson (smasson\@lodyc.jussieu.fr)
; December 2007: Sebastien Masson, move to obsolete
;
;
; @version
; $Id$
;
;-
FUNCTION norme, composanteu, composantev $
, BOXZOOM=boxzoom, DIREC=direc, _EXTRA=ex
;
compile_opt idl2, strictarrsubs
;
@cm_4mesh
@cm_4data
@cm_4cal
IF NOT keyword_set(key_forgetold) THEN BEGIN
@updatenew
@updatekwd
ENDIF
;------------------------------------------------------------
if keyword_set(boxzoom) then BEGIN
Case 1 Of
N_Elements(Boxzoom) Eq 1:bte = [lon1, lon2, lat1, lat2, 0., boxzoom[0]]
N_Elements(Boxzoom) Eq 2:bte = [lon1, lon2, lat1, lat2, boxzoom[0], boxzoom[1]]
N_Elements(Boxzoom) Eq 4:bte = [Boxzoom, vert1, vert2]
N_Elements(Boxzoom) Eq 5:bte = [Boxzoom[0:3], 0, Boxzoom[4]]
N_Elements(Boxzoom) Eq 6:bte = Boxzoom
Else: return, report('wrong number of element in Boxzoom')
ENDCASE
domdef, boxzoom
ENDIF
;------------------------------------------------------------
return, norm(composanteu, composantev, DIREC = direc, _EXTRA = ex)
end