source: trunk/SRC/ToBeReviewed/GRILLE/f2v.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: 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
15; res, a 2, 3 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;-
[231]37;
[2]38FUNCTION f2v, temp
[114]39;
40  compile_opt idl2, strictarrsubs
41;
[13]42@cm_4mesh
43@cm_4data
44@cm_4cal
45  IF NOT keyword_set(key_forgetold) THEN BEGIN
46@updatenew
47  ENDIF
48;---------------------------------------------------------
[2]49   res = temp
[142]50;We force nxt=nxf, etc ...
[13]51   firstxv = firstxf
52   lastxv = lastxf
53   firstyv = firstyf
54   lastyv = lastyf
[2]55   nxv = nxf
56   nyv = nyf
57   vargrid = 'V'
58   if NOT keyword_set(valmask) then valmask = 1e20
[13]59   lon1 = glamv[firstxv, 0]
60   lon2 = glamf[lastxf, 0]
[2]61
[142]62; case on tha array's size and application
[2]63   taille = size(temp)
[231]64   CASE taille[0] OF
[2]65      1: res = -1
[231]66      2: BEGIN
[2]67         case 1 of
68            taille[1] eq nxf and taille[2] eq nyf:
69            taille[1] eq jpi and taille[2] eq jpj: $
[13]70             res=res[firstxf:lastxf, firstyf:lastyf]
[2]71            else: $
72             return, report('Probleme d''adequation entre les tailles du domaine et de la boite.')
73         endcase
[13]74         mask = (fmask())[firstxf:lastxf, firstyf:lastyf, 0]
[231]75         terre = where(mask EQ 0)
[2]76         IF terre[0] NE -1 THEN res[terre] = !values.f_nan
77         res = 0.5*(res + shift(res, 1, 0))
[13]78         if NOT (keyword_set(key_periodic) AND nxf EQ jpi) then res[0, *] = !values.f_nan
79         mask = (vmask())[firstxf:lastxf, firstyf:lastyf, 0]
[231]80         terre = where(mask EQ 0)
[2]81         IF terre[0] NE -1 THEN res[terre] = valmask
82      END
[231]83      3: BEGIN
[2]84         case 1 of
85            taille[1] eq nxf and taille[2] eq nyf AND taille[3] EQ nzt:
86            taille[1] eq nxf and taille[2] eq nyf AND taille[3] EQ jpk: $
[13]87             res=res[*, *, firstzt:lastzt]
[2]88            taille[1] eq nxf and taille[2] eq nyf AND taille[3] EQ jpt:
89            taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpk: $
[13]90             res=res[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt]
[2]91            taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpt: $
[13]92             res=res[firstxf:lastxf, firstyf:lastyf, *]
[2]93            else: $
94             return, report('Probleme d''adequation entre les tailles du domaine et de la boite.')
95         ENDCASE
96         if taille[3] EQ jpt then begin
[13]97            mask = (fmask())[firstxf:lastxf, firstyf:lastyf, lastzt*(nzt NE jpk)]
[2]98            mask = temporary(mask[*])#replicate(1, jpt)
99            mask = reform(mask, nxf, nyf, jpt, /over)
[13]100         ENDIF ELSE mask = (fmask())[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt]
[231]101         terre = where(temporary(mask) EQ 0)
[2]102         IF terre[0] NE -1 THEN res[temporary(terre)] = !values.f_nan
103         res = 0.5*(res + shift(res, 1, 0, 0))
[13]104         if NOT (keyword_set(key_periodic) AND nxf EQ jpi) then res[0, *, *] = !values.f_nan
[2]105         if taille[3] EQ jpt then BEGIN
[13]106            mask = tmask[firstxf:lastxf, firstyf:lastyf, lastzt*(nzt NE jpk)]
[2]107            mask = temporary(mask[*])#replicate(1, jpt)
108            mask = reform(mask, nxf, nyf, jpt, /over)
[13]109         ENDIF ELSE mask = (vmask())[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt]
[231]110         terre = where(temporary(mask) EQ 0)
[2]111         IF terre[0] NE -1 THEN res[temporary(terre)] = valmask
112      END
[231]113      4: BEGIN
[2]114         case 1 of
115            taille[1] eq nxf and taille[2] eq nyf AND taille[3] EQ nzt AND taille[4] EQ jpt:
116            taille[1] eq nxf and taille[2] eq nyf AND taille[3] EQ jpk AND taille[4] EQ jpt: $
[13]117             res=res[*, *, firstzt:lastzt, *]
[2]118            taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpk AND taille[4] EQ jpt: $
[13]119             res=res[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt, *]
[2]120            else: $
121             return, report('Probleme d''adequation entre les tailles du domaine et de la boite.')
122         ENDCASE
[13]123         mask = (fmask())[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt]
[2]124         mask = temporary(mask[*])#replicate(1, jpt)
125         mask = reform(mask, nxf, nyf, nzt, jpt, /over)
[231]126         terre = where(temporary(mask) EQ 0)
[2]127         IF terre[0] NE -1 THEN res[temporary(terre)] = !values.f_nan
128         res = 0.5*(res + shift(res, 1, 0, 0, 0))
[13]129         if NOT (keyword_set(key_periodic) AND nxf EQ jpi) then res[0, *, *, *] = !values.f_nan
130         mask = (vmask())[firstxf:lastxf, firstyf:lastyf, firstzt:lastzt]
[2]131         mask = temporary(mask[*])#replicate(1, jpt)
132         mask = reform(mask, nxf, nyf, nzt, jpt, /over)
[231]133         terre = where(temporary(mask) EQ 0)
[2]134         IF terre[0] NE -1 THEN res[temporary(terre)] = valmask
135      END
136   endcase
137
[13]138   IF NOT keyword_set(key_forgetold) THEN BEGIN
139   @updateold
[231]140   ENDIF
141
[2]142   return, res
143END
Note: See TracBrowser for help on using the repository browser.