FUNCTION GRIDDATA_EXAMPLE, OLAT = olat, OLON = olon, $ TRIMETHOD = trimethod, SPHERE = sphere, METHOD = method COMPILE_OPT IDL2 On_Error, 2 if n_elements(trimethod) EQ 0 then trimethod = "qhull" if n_elements(method) EQ 0 then method = "NaturalNeighbor" ; here follows the info for the irregular-in-latitdue grid nLat = 510 & latRange = [-30.023445, 30.563103] nLon = 730 & lonRange = [ 30.375000, 121.500000] PS = [(lonRange[1]-lonRange[0])/nLon, 0.0] ;pixel size - varies in Y ;longitude has regular spacing lon = FINDGEN(nLon) * PS[0] + lonRange[0] ;latitude has irregular spacing lat = $ [ 30.563103, 30.455408, 30.347595, 30.239664, 30.131615, 30.023445, $ 29.915159, 29.806755, 29.698233, 29.589594, 29.480837, 29.371964, $ 29.262974, 29.153868, 29.044645, 28.935307, 28.825853, 28.716284, $ 28.606602, 28.496803, 28.386890, 28.276863, 28.166723, 28.056469, $ 27.946102, 27.835623, 27.725029, 27.614325, 27.503508, 27.392578, $ 27.281538, 27.170387, 27.059126, 26.947754, 26.836271, 26.724678, $ 26.612976, 26.501165, 26.389246, 26.277216, 26.165079, 26.052835, $ 25.940483, 25.828022, 25.715456, 25.602783, 25.490004, 25.377117, $ 25.264128, 25.151031, 25.037828, 24.924524, 24.811113, 24.697599, $ 24.583982, 24.470263, 24.356438, 24.242512, 24.128485, 24.014355, $ 23.900124, 23.785791, 23.671358, 23.556826, 23.442192, 23.327461, $ 23.212629, 23.097698, 22.982670, 22.867542, 22.752319, 22.636997, $ 22.521578, 22.406063, 22.290451, 22.174746, 22.058943, 21.943045, $ 21.827053, 21.710968, 21.594790, 21.478516, 21.362150, 21.245691, $ 21.129141, 21.012499, 20.895765, 20.778942, 20.662027, 20.545023, $ 20.427929, 20.310745, 20.193472, 20.076111, 19.958662, 19.841127, $ 19.723503, 19.605795, 19.487997, 19.370117, 19.252150, 19.134098, $ 19.015961, 18.897741, 18.779436, 18.661049, 18.542580, 18.424028, $ 18.305393, 18.186678, 18.067883, 17.949007, 17.830050, 17.711014, $ 17.591900, 17.472706, 17.353436, 17.234085, 17.114660, 16.995157, $ 16.875578, 16.755922, 16.636192, 16.516386, 16.396507, 16.276554, $ 16.156528, 16.036428, 15.916256, 15.796012, 15.675697, 15.555311, $ 15.434855, 15.314327, 15.193731, 15.073067, 14.952333, 14.831532, $ 14.710663, 14.589726, 14.468724, 14.347655, 14.226521, 14.105323, $ 13.984059, 13.862732, 13.741342, 13.619888, 13.498372, 13.376794, $ 13.255155, 13.133454, 13.011694, 12.889874, 12.767994, 12.646055, $ 12.524059, 12.402004, 12.279893, 12.157724, 12.035501, 11.913220, $ 11.790885, 11.668495, 11.546052, 11.423554, 11.301004, 11.178402, $ 11.055747, 10.933042, 10.810286, 10.687479, 10.564622, 10.441716, $ 10.318763, 10.195760, 10.072710, 9.949614, 9.826470, 9.703281, $ 9.580048, 9.456768, 9.333445, 9.210078, 9.086668, 8.963216, $ 8.839721, 8.716186, 8.592608, 8.468991, 8.345335, 8.221639, $ 8.097904, 7.974132, 7.850322, 7.726475, 7.602592, 7.478673, $ 7.354719, 7.230730, 7.106707, 6.982651, 6.858562, 6.734440, $ 6.610287, 6.486102, 6.361887, 6.237642, 6.113367, 5.989064, $ 5.864732, 5.740373, 5.615986, 5.491573, 5.367134, 5.242669, $ 5.118179, 4.993666, 4.869129, 4.744568, 4.619986, 4.495381, $ 4.370755, 4.246108, 4.121441, 3.996755, 3.872049, 3.747326, $ 3.622584, 3.497825, 3.373050, 3.248259, 3.123452, 2.998630, $ 2.873794, 2.748945, 2.624082, 2.499207, 2.374320, 2.249422, $ 2.124513, 1.999594, 1.874665, 1.749728, 1.624782, 1.499829, $ 1.374868, 1.249901, 1.124928, 0.999949, 0.874966, 0.749979, $ 0.624988, 0.499994, 0.374997, 0.249999, 0.125000, -0.000000, $ -0.125000, -0.249999, -0.374997, -0.499994, -0.624988, -0.749979, $ -0.874966, -0.999949, -1.124928, -1.249901, -1.374868, -1.499829, $ -1.624782, -1.749728, -1.874665, -1.999594, -2.124513, -2.249422, $ -2.374320, -2.499207, -2.624082, -2.748945, -2.873794, -2.998630, $ -3.123452, -3.248259, -3.373050, -3.497825, -3.622584, -3.747326, $ -3.872049, -3.996755, -4.121441, -4.246108, -4.370755, -4.495381, $ -4.619986, -4.744568, -4.869129, -4.993666, -5.118179, -5.242669, $ -5.367134, -5.491573, -5.615986, -5.740373, -5.864732, -5.989064, $ -6.113367, -6.237642, -6.361887, -6.486102, -6.610287, -6.734440, $ -6.858562, -6.982651, -7.106707, -7.230730, -7.354719, -7.478673, $ -7.602592, -7.726475, -7.850322, -7.974132, -8.097904, -8.221639, $ -8.345335, -8.468991, -8.592608, -8.716186, -8.839721, -8.963216, $ -9.086668, -9.210078, -9.333445, -9.456768, -9.580048, -9.703281, $ -9.826470, -9.949614, -10.072710, -10.195760, -10.318763, -10.441716, $ -10.564622, -10.687479, -10.810286, -10.933042, -11.055747, -11.178402, $ -11.301004, -11.423554, -11.546052, -11.668495, -11.790885, -11.913220, $ -12.035501, -12.157724, -12.279893, -12.402004, -12.524059, -12.646055, $ -12.767994, -12.889874, -13.011694, -13.133454, -13.255155, -13.376794, $ -13.498372, -13.619888, -13.741342, -13.862732, -13.984059, -14.105323, $ -14.226521, -14.347655, -14.468724, -14.589726, -14.710663, -14.831532, $ -14.952333, -15.073067, -15.193731, -15.314327, -15.434855, -15.555311, $ -15.675697, -15.796012, -15.916256, -16.036428, -16.156528, -16.276554, $ -16.396507, -16.516386, -16.636192, -16.755922, -16.875578, -16.995157, $ -17.114660, -17.234085, -17.353436, -17.472706, -17.591900, -17.711014, $ -17.830050, -17.949007, -18.067883, -18.186678, -18.305393, -18.424028, $ -18.542580, -18.661049, -18.779436, -18.897741, -19.015961, -19.134098, $ -19.252150, -19.370117, -19.487997, -19.605795, -19.723503, -19.841127, $ -19.958662, -20.076111, -20.193472, -20.310745, -20.427929, -20.545023, $ -20.662027, -20.778942, -20.895765, -21.012499, -21.129141, -21.245691, $ -21.362150, -21.478516, -21.594790, -21.710968, -21.827053, -21.943045, $ -22.058943, -22.174746, -22.290451, -22.406063, -22.521578, -22.636997, $ -22.752319, -22.867542, -22.982670, -23.097698, -23.212629, -23.327461, $ -23.442192, -23.556826, -23.671358, -23.785791, -23.900124, -24.014355, $ -24.128485, -24.242512, -24.356438, -24.470263, -24.583982, -24.697599, $ -24.811113, -24.924524, -25.037828, -25.151031, -25.264128, -25.377117, $ -25.490004, -25.602783, -25.715456, -25.828022, -25.940483, -26.052835, $ -26.165079, -26.277216, -26.389246, -26.501165, -26.612976, -26.724678, $ -26.836271, -26.947754, -27.059126, -27.170387, -27.281538, -27.392578, $ -27.503508, -27.614325, -27.725029, -27.835623, -27.946102, -28.056469, $ -28.166723, -28.276863, -28.386890, -28.496803, -28.606602, -28.716284, $ -28.825853, -28.935307, -29.044645, -29.153868, -29.262974, -29.371964, $ -29.480837, -29.589594, -29.698233, -29.806755, -29.915159, -30.023445] ;transform to 2d arrays of locations - but hold them in vectors lon = REFORM(lon # replicate(1.0 ,nLat), nLon * nLat) lat = REFORM(replicate(1.0 ,nLon) # lat, nlon * nlat) ;makeup some data zValue = REFORM(hanning(nLon, nLat), nLon * nLat) ;here follow the specs for the "output" regular grid upon which ;I want to interpolate the above data oPS = [0.166667, 0.166667] oLonRange = [30.500, 121.667] oLatRange = [-30.1667, 30.500] oNLon = (oLonRange[1]-oLonRange[0])/oPS[0] + 1 oNLat = (oLatRange[1]-oLatRange[0])/oPS[1] + 1 oLon = FINDGEN(oNLon) * oPS[0] + oLonRange[0] oLat = FINDGEN(oNLat) * oPS[1] + oLatRange[0] ;transform output coords to 2d arrays oLon = oLon # replicate(1.0, oNLat) oLat = replicate(1.0, oNLon) # oLat CASE StrLowCase(trimethod) of "qhull": QHULL, lon, lat, tr, /DELAUNAY "triangulate": TRIANGULATE, lon, lat, tr, /DEGREES ELSE: Message, "Method not recognized: " + trimethod ENDCASE Z = GRIDDATA(lon, lat, zValue, /DEGREES, SPHERE = KEYWORD_SET(sphere), $ METHOD = method, MISSING = 0.0, $ XOUT = oLon, YOUT = oLat, TRIANGLES = tr ) RETURN, REFORM(Z, oNLon, oNLat) END