source: trunk/SRC/ToBeReviewed/GRILLE/f2v.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: 5.0 KB
RevLine 
[2]1;+
2;
[142]3; @file_comments
[231]4; Allows to pass a field referring to the grid F on the grid V,
5; thanks to the average:
6; res = 0.5*(res + shift(res, 1, 0))
[2]7;
[231]8; @categories
[157]9; Grid
[2]10;
[142]11; @param TEMP {in}{required}
12; A 2, 3 or 4d array
[2]13;
[142]14; @returns
[268]15; a 2d, 3d or 4d array
[2]16;
[142]17; @uses
18; common.pro
[2]19;
[231]20; @restrictions
21; Force parameters of the zoom on the grid V to be the same as
[142]22; those on the grid T.
[2]23;
[231]24; @restrictions
25; Points which can not be calculated are put at the value NaN
[142]26; consecrated by IDL: !values.f_nan
[2]27;
[142]28; @history
29; From Marina Levy's programs
[157]30; Sebastien Masson (smasson\@lodyc.jussieu.fr):
[142]31; Validation. 5/6/2000
[2]32;
[142]33; @version
34; $Id$
[2]35;
36;-
37FUNCTION f2v, temp
[114]38;
39  compile_opt idl2, strictarrsubs
40;
[13]41@cm_4mesh
42@cm_4data
43@cm_4cal
44  IF NOT keyword_set(key_forgetold) THEN BEGIN
45@updatenew
46  ENDIF
47;---------------------------------------------------------
[2]48   res = temp
[142]49;We force nxt=nxf, etc ...
[13]50   firstxv = firstxf
51   lastxv = lastxf
52   firstyv = firstyf
53   lastyv = lastyf
[2]54   nxv = nxf
55   nyv = nyf
56   vargrid = 'V'
57   if NOT keyword_set(valmask) then valmask = 1e20
[13]58   lon1 = glamv[firstxv, 0]
59   lon2 = glamf[lastxf, 0]
[2]60
[142]61; case on tha array's size and application
[2]62   taille = size(temp)
[231]63   CASE taille[0] OF
[2]64      1: res = -1
[231]65      2: BEGIN
[2]66         case 1 of
67            taille[1] eq nxf and taille[2] eq nyf:
68            taille[1] eq jpi and taille[2] eq jpj: $
[13]69             res=res[firstxf:lastxf, firstyf:lastyf]
[2]70            else: $
71             return, report('Probleme d''adequation entre les tailles du domaine et de la boite.')
72         endcase
[13]73         mask = (fmask())[firstxf:lastxf, firstyf:lastyf, 0]
[231]74         terre = where(mask EQ 0)
[2]75         IF terre[0] NE -1 THEN res[terre] = !values.f_nan
76         res = 0.5*(res + shift(res, 1, 0))
[13]77         if NOT (keyword_set(key_periodic) AND nxf EQ jpi) then res[0, *] = !values.f_nan
78         mask = (vmask())[firstxf:lastxf, firstyf:lastyf, 0]
[231]79         terre = where(mask EQ 0)
[2]80         IF terre[0] NE -1 THEN res[terre] = valmask
81      END
[231]82      3: BEGIN
[2]83         case 1 of
84            taille[1] eq nxf and taille[2] eq nyf AND taille[3] EQ nzt:
85            taille[1] eq nxf and taille[2] eq nyf AND taille[3] EQ jpk: $
[13]86             res=res[*, *, firstzt:lastzt]
[2]87            taille[1] eq nxf and taille[2] eq nyf AND taille[3] EQ jpt:
88            taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpk: $
[13]89             res=res[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt]
[2]90            taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpt: $
[13]91             res=res[firstxf:lastxf, firstyf:lastyf, *]
[2]92            else: $
93             return, report('Probleme d''adequation entre les tailles du domaine et de la boite.')
94         ENDCASE
95         if taille[3] EQ jpt then begin
[13]96            mask = (fmask())[firstxf:lastxf, firstyf:lastyf, lastzt*(nzt NE jpk)]
[2]97            mask = temporary(mask[*])#replicate(1, jpt)
98            mask = reform(mask, nxf, nyf, jpt, /over)
[13]99         ENDIF ELSE mask = (fmask())[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt]
[231]100         terre = where(temporary(mask) EQ 0)
[2]101         IF terre[0] NE -1 THEN res[temporary(terre)] = !values.f_nan
102         res = 0.5*(res + shift(res, 1, 0, 0))
[13]103         if NOT (keyword_set(key_periodic) AND nxf EQ jpi) then res[0, *, *] = !values.f_nan
[2]104         if taille[3] EQ jpt then BEGIN
[13]105            mask = tmask[firstxf:lastxf, firstyf:lastyf, lastzt*(nzt NE jpk)]
[2]106            mask = temporary(mask[*])#replicate(1, jpt)
107            mask = reform(mask, nxf, nyf, jpt, /over)
[13]108         ENDIF ELSE mask = (vmask())[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt]
[231]109         terre = where(temporary(mask) EQ 0)
[2]110         IF terre[0] NE -1 THEN res[temporary(terre)] = valmask
111      END
[231]112      4: BEGIN
[2]113         case 1 of
114            taille[1] eq nxf and taille[2] eq nyf AND taille[3] EQ nzt AND taille[4] EQ jpt:
115            taille[1] eq nxf and taille[2] eq nyf AND taille[3] EQ jpk AND taille[4] EQ jpt: $
[13]116             res=res[*, *, firstzt:lastzt, *]
[2]117            taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpk AND taille[4] EQ jpt: $
[13]118             res=res[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt, *]
[2]119            else: $
120             return, report('Probleme d''adequation entre les tailles du domaine et de la boite.')
121         ENDCASE
[13]122         mask = (fmask())[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt]
[2]123         mask = temporary(mask[*])#replicate(1, jpt)
124         mask = reform(mask, nxf, nyf, nzt, jpt, /over)
[231]125         terre = where(temporary(mask) EQ 0)
[2]126         IF terre[0] NE -1 THEN res[temporary(terre)] = !values.f_nan
127         res = 0.5*(res + shift(res, 1, 0, 0, 0))
[13]128         if NOT (keyword_set(key_periodic) AND nxf EQ jpi) then res[0, *, *, *] = !values.f_nan
129         mask = (vmask())[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt]
[2]130         mask = temporary(mask[*])#replicate(1, jpt)
131         mask = reform(mask, nxf, nyf, nzt, jpt, /over)
[231]132         terre = where(temporary(mask) EQ 0)
[2]133         IF terre[0] NE -1 THEN res[temporary(terre)] = valmask
134      END
135   endcase
136
[13]137   IF NOT keyword_set(key_forgetold) THEN BEGIN
138   @updateold
[231]139   ENDIF
140
[2]141   return, res
142END
Note: See TracBrowser for help on using the repository browser.