[314] | 1 | ;+ |
---|
| 2 | ; |
---|
| 3 | ; @file_comments |
---|
| 4 | ; calculate the norm of vectors field located on Arakawa C-grid |
---|
| 5 | ; |
---|
| 6 | ; @obsolete |
---|
| 7 | ; |
---|
| 8 | ; @param COMPOSANTEU {in}{required} |
---|
| 9 | ; Matrix representing the zonal coordinates (at U/V point) of a field of vectors |
---|
| 10 | ; A 2D (xy), 3D (xyz or yt), 4D (xyzt) or a structure readable by |
---|
| 11 | ; <pro>litchamp</pro> and containing a 2D (xy), 3D (xyz or yt), 4D (xyzt) array. |
---|
| 12 | ; Note that the dimension of the array must suit the domain dimension. |
---|
| 13 | ; |
---|
| 14 | ; @param COMPOSANTEV {in}{required} |
---|
| 15 | ; Matrix representing the meridional coordinates (at V/U point) of a field of vectors |
---|
| 16 | ; A 2D (xy), 3D (xyz or yt), 4D (xyzt) or a structure readable by |
---|
| 17 | ; <pro>litchamp</pro> and containing a 2D (xy), 3D (xyz or yt), 4D (xyzt) array. |
---|
| 18 | ; Note that the dimension of the array must suit the domain dimension. |
---|
| 19 | ; |
---|
| 20 | ; @keyword BOXZOOM |
---|
| 21 | ; boxzoom on which do the average (by default the domain selected |
---|
| 22 | ; by the last <pro>domdef</pro> done) |
---|
| 23 | ; |
---|
| 24 | ; @keyword DIREC |
---|
| 25 | ; 't' 'x' 'y' 'z' 'xys' 'xz' 'yz' 'xyz' 'xt' 'yt' 'zt' 'xyt' |
---|
| 26 | ; 'xzt' 'yzt' 'xyzt' Direction on which do averages |
---|
| 27 | ; |
---|
| 28 | ; @returns |
---|
| 29 | ; A 2D (xy), 3D (xyz or yt), 4D (xyzt) Array |
---|
| 30 | ; |
---|
| 31 | ; @uses |
---|
[370] | 32 | ; <pro>common</pro> |
---|
[314] | 33 | ; |
---|
| 34 | ; @restrictions |
---|
| 35 | ; The norm is calculated on points T. To do this calculation, we average |
---|
| 36 | ; field U and V on points T before calculate the norme. At the edge of |
---|
| 37 | ; coast and of domain, we can not calculate fields U and V at points T, |
---|
| 38 | ; that is why these points are at value !values.f_nan. |
---|
| 39 | ; |
---|
| 40 | ; When we calculate on a reduce geographic domain, field U and V have not |
---|
| 41 | ; necessarily the same number of point. In this case, we recut U and V to |
---|
| 42 | ; keep only common points. We profit of this to redo a <pro>domdef</pro> which redefine |
---|
| 43 | ; a geographic domain on which fields U and V are extracted on same points |
---|
| 44 | ; |
---|
| 45 | ; To know what type of array we work with, we test its size and dates |
---|
| 46 | ; gave by time[0] and time[jpt-1] to know if thee is a temporal dimension. |
---|
| 47 | ; Before to start norme, make sure that time and jpt are defined how |
---|
| 48 | ; they have to! |
---|
| 49 | ; |
---|
| 50 | ; @examples |
---|
| 51 | ; To calculate the average of the norme of streams on all the domain |
---|
| 52 | ; between 0 and 50: |
---|
[371] | 53 | ; IDL> res=norme(un,vn,boxzoom=[0,50],dir='xyz') |
---|
[314] | 54 | ; |
---|
| 55 | ; @history |
---|
| 56 | ; 9/6/1999 Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
| 57 | ; December 2007: Sebastien Masson, move to obsolete |
---|
| 58 | ; |
---|
| 59 | ; |
---|
| 60 | ; @version |
---|
| 61 | ; $Id$ |
---|
| 62 | ; |
---|
| 63 | ;- |
---|
[327] | 64 | FUNCTION norme, composanteu, composantev $ |
---|
| 65 | , BOXZOOM=boxzoom, DIREC=direc, _EXTRA=ex |
---|
[314] | 66 | ; |
---|
| 67 | compile_opt idl2, strictarrsubs |
---|
| 68 | ; |
---|
| 69 | @cm_4mesh |
---|
| 70 | @cm_4data |
---|
| 71 | @cm_4cal |
---|
| 72 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 73 | @updatenew |
---|
| 74 | @updatekwd |
---|
| 75 | ENDIF |
---|
| 76 | ;------------------------------------------------------------ |
---|
| 77 | if keyword_set(boxzoom) then BEGIN |
---|
| 78 | Case 1 Of |
---|
| 79 | N_Elements(Boxzoom) Eq 1:bte = [lon1, lon2, lat1, lat2, 0., boxzoom[0]] |
---|
| 80 | N_Elements(Boxzoom) Eq 2:bte = [lon1, lon2, lat1, lat2, boxzoom[0], boxzoom[1]] |
---|
| 81 | N_Elements(Boxzoom) Eq 4:bte = [Boxzoom, vert1, vert2] |
---|
| 82 | N_Elements(Boxzoom) Eq 5:bte = [Boxzoom[0:3], 0, Boxzoom[4]] |
---|
| 83 | N_Elements(Boxzoom) Eq 6:bte = Boxzoom |
---|
| 84 | Else: return, report('wrong number of element in Boxzoom') |
---|
| 85 | ENDCASE |
---|
| 86 | domdef, boxzoom |
---|
| 87 | ENDIF |
---|
| 88 | ;------------------------------------------------------------ |
---|
| 89 | return, norm(composanteu, composantev, DIREC = direc, _EXTRA = ex) |
---|
| 90 | end |
---|