source: trunk/SRC/Interpolation/fromreg.pro @ 103

Last change on this file since 103 was 101, checked in by pinsard, 18 years ago

start to modify headers of Interpolation *.pro files for better idldoc output

  • Property svn:executable set to *
File size: 3.4 KB
Line 
1;+
2;
3; @file_comments interpolate data from a "regular/rectangular grid" to any grid.
4;   2 metods availables: bilinear and imoms3
5;   A "regular/rectangular grid" is defined as a grid for which each lontitudes lines have
6;   the same latitude and each latitudes columns have the same longitude.
7;   
8; @categories interpolation
9;
10; @examples 
11; dataout = fromreg(method, datain [, lonin, latin, lonout, latout])
12;
13;    @param method {in}{required}  a string defining the interpolation method.
14;            must be 'bilinear' or 'imoms3'
15;    @param datain {in}{required}  a 2D array the input data to interpolate
16;    @param lonin latin {in}{required}  longitude/latitude of the input data. optionals if
17;            WEIG and ADDR keywords used.
18;    @param lonout latout {in}{required}  longitude/latitude of the output data. optionals if
19;            WEIG and ADDR keywords used.
20;
21; @keyword     WEIG, ADDR 2D arrays, weig and addr are the weight and addresses used to
22;     perform the interpolation:
23;          dataout = total(weig*datain[addr], 1)
24;          dataout = reform(dataout, jpio, jpjo, /over)
25;     Those keywords can be set to named variables into which the values will be
26;     copied when the current routine exits. Next, they can be used to perform
27;     the interpolation whithout computing again those 2 parameters. In that
28;     case, lonin, latin, lonout and latout are not necessary.
29;
30; @keyword     /NONORTHERNLINE and /NOSOUTHERNLINE activate if you don't whant to take into
31;          account the northen/southern line of the input data when perfoming the
32;          interpolation.
33;
34; @returns 2D array: the interpolated data
35;
36; @restrictions We supposed the data are located on a sphere, with a
37; periodicity along the longitude.
38;
39; @examples 
40
41;  topa = fromreg('bilinear', tncep, xncep, yncep, glamt, gphit)
42;
43;  or
44;
45;  t1opa = fromreg('bilinear', t1ncep, xncep, yncep, glamt, gphit, WEIG = a, ADDR = b)
46;  help, a, b
47;  t2opa = fromreg('bilinear', t2ncep, xncep, WEIG = a, ADDR = b)
48;
49; @history
50;  November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr)
51;
52;-
53;
54;----------------------------------------------------------
55;----------------------------------------------------------
56;
57FUNCTION fromreg, method, datain, lonin, latin, lonout, latout $
58                  , WEIG = weig, ADDR = addr $
59                  , NONORTHERNLINE = nonorthernline $
60                  , NOSOUTHERNLINE = nosouthernline
61;
62  compile_opt strictarr, strictarrsubs
63;
64  IF NOT (keyword_set(weig) AND keyword_set(addr)) THEN BEGIN
65;---------------
66; atmospheric grid parameters
67;---------------
68    alon = lonin
69    alat = latin
70    get_gridparams, alon, alat, jpia, jpja, 1, /double
71;---------------
72; Oceanic grid parameters
73;---------------
74    olon = lonout
75    olat = latout
76    get_gridparams, olon, olat, jpio, jpjo, 2, /double
77;---------------
78; Compute weight and address
79;---------------
80    CASE method OF
81      'bilinear':compute_fromreg_bilinear_weigaddr, alon, alat, olon, olat, weig, addr, NONORTHERNLINE = nonorthernline, NOSOUTHERNLINE = nosouthernline
82      'imoms3':  compute_fromreg_imoms3_weigaddr,   alon, alat, olon, olat, weig, addr, NONORTHERNLINE = nonorthernline, NOSOUTHERNLINE = nosouthernline
83      ELSE:BEGIN
84        print, ' unknown interpolation method... we stop'
85        stop
86      ENDELSE
87    ENDCASE
88  ENDIF
89;
90  dataout = total(weig*datain[addr], 1)
91  dataout = reform(dataout, jpio, jpjo, /over)
92;
93  RETURN, dataout
94END
Note: See TracBrowser for help on using the repository browser.