I am interpolating satellite data (lat, lon, temperature) from a
irregular grid to a regular lat, lon grid using:
pro get_gridded_temp_image, ....
.
.
.
grid_lat=findgen(31)*2.0+30.0 ;30 to 90 deg @2 deg
grid_lon=findgen(181)*2.0 ;0 to 360 deg @2 deg
qhull, x, y, tri, /delaunay, sphere = s
temp_grid = griddata( x, y, z, /sphere, /deg, $
/grid, xout = grid_lon, yout = grid_lat, $
method = 'NaturalNeighbor', $
triangles=tri, $
missing = !values.f_nan)
where x,y are longitude, latitude, and z is temperature (patterned
after Example 5 in the IDL help for griddata.pro)
Usually this procedure works fine, over thousands of different cases.
However, today I tried it and got the error message:
GRIDDATA: Triangle 652 not in counterclockwise order.
Execution halted at: GET_GRIDDED_TEMP_IMAGE 184
The ranges of the input variables are (mve is a routine that prints
the stats on a variable):
IDL> mve,x
Variable type mean std dev minimum
maximum n_elements NaN or I
Float 178.55 102.79 0.070000
358.05 (529) = 529 0
IDL> mve,y
Variable type mean std dev minimum
maximum n_elements NaN or I
Float 54.660 19.100 20.340
82.930 (529) = 529 0
IDL> mve,z
Variable type mean std dev minimum
maximum n_elements NaN or I
Float 214.63 9.7416 192.56
233.31 (529) = 529 0
IDL> mve, tri
Variable type mean std dev minimum
maximum n_elements NaN or Inf
Longword integer 249.43 149.12 0.00000
528.00 (3,966) = 2898 0
Note: I tried the routine sph_scat which is also advertised to regrid
on a sphere. However, the interpolated values are way off scale:
IDL> r=sph_scat(x,y,z,bounds=[0,30.0,360,90],gs=[2,2],bout=bout)
IDL> mve,r
Variable type mean std dev minimum
maximum n_elements NaN or Inf
Double float 208.09 96.313 -480.31
869.93 (181,31) = 5611 0
Any suggestions on how to trouble shoot, fix?
Thanks,
Bill Gallery
|