source: trunk/SRC/Interpolation/fromirr.pro @ 138

Last change on this file since 138 was 136, checked in by pinsard, 18 years ago

some improvements and corrections in some .pro file according to
aspell and idldoc log file

  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1;+
2;
3; @file_comments
4; interpolate data from an irregular 2D grid to any 2D grid.
5;   Only 1 method available = bilinear
6;
7; @categories interpolation
8;
9; @param method {in}{required}
10; a string defining the interpolation method. must be 'bilinear'
11;
12; @param datain {in}{required}
13; a 2D array the input data to interpolate
14;
15; @param lonin {in}{optional}
16; a 2D array defining the longitude of the input data
17;
18; @param latin {in}{optional}
19; a 2D array defining the latitude of the input data.
20;
21; @param mskin {in}{optional}
22; a 2D array, the land-sea mask of the input data (1 on ocean, 0 on land)
23;
24; @param lonout {in}{optional}
25; 1D or 2D array defining the longitude of the output data.
26;
27; @param latout {in}{optional}
28; 1D or 2D array defining the latitude of the output data.
29;
30; @param mskout {in}{required}
31; a 2D array, the land-sea mask of the ouput data (1 on ocean, 0 on land)
32;
33; @keyword WEIG (see ADDR)
34; @keyword ADDR 2D arrays, weig and addr are the weight and addresses used to
35; perform the interpolation:
36;          dataout = total(weig*datain[addr], 1)
37;          dataout = reform(dataout, jpio, jpjo, /over)
38; Those keywords can be set to named variables (that are undefined or equal to 0) into which the
39; values will be copied when the current routine exits. Next, they can be used to perform
40; the interpolation whithout computing again those 2 parameters. This greatly
41; speed-up the interpolation! In that case, lonin, latin, lonout and latout are not necessary.
42;
43; @returns
44; 2D array the interpolated data
45;
46; @restrictions
47; We supposed the data are located on a sphere, with a periodicity along
48; the longitude.
49; Note that the input data can contain the same cells several times
50; (like ORCA grid near the north pole boundary)
51;
52; @examples
53;
54; IDL> tncep = fromirr('bilinear', topa, glamt, gphit, tmask[*,*,0], lonout, latout, mskout)
55;
56;  or
57;
58; IDL> t1ncep = fromirr('bilinear', topa, glamt, gphit, tmask[*,*,0], lonout, latout, mskout $
59;                            , WEIG = a, ADDR = b)
60; IDL> help, a, b
61; IDL> t2ncep = fromirr('bilinear', topa, WEIG = a, ADDR = b)
62;
63; @history
64;  June 2006: Sebastien Masson (smasson\@lodyc.jussieu.fr)
65;
66; @version $Id$
67;
68;-
69;----------------------------------------------------------
70;----------------------------------------------------------
71;
72FUNCTION fromirr, method, datain, lonin, latin, mskin, lonout, latout, mskout $
73                  , WEIG = weig, ADDR = addr
74;
75  compile_opt strictarr, strictarrsubs
76;
77;---------------
78; atmospheric grid parameters
79;---------------
80    alon = lonin
81    alat = latin
82    get_gridparams, alon, alat, jpia, jpja, 2, /double
83;---------------
84; Oceanic grid parameters
85;---------------
86    olon = lonout
87    olat = latout
88    get_gridparams, olon, olat, jpio, jpjo, 2, /double
89;---------------
90; Compute weight and address
91;---------------
92  IF NOT (keyword_set(weig) AND keyword_set(addr)) THEN BEGIN
93    CASE method OF
94      'bilinear':compute_fromirr_bilinear_weigaddr, alon, alat, mskin, olon, olat, mskout, weig, addr
95      ELSE:BEGIN
96        print, ' unknown interpolation method... we stop'
97        stop
98      ENDELSE
99    ENDCASE
100  ENDIF
101;---------------
102; to the interpolation
103;---------------
104  dataout = total(weig*datain[addr], 1)
105  dataout = reform(dataout, jpio, jpjo, /over)
106;
107  RETURN, dataout
108END
Note: See TracBrowser for help on using the repository browser.