Greetings:
There is no direct way to transform a mixed matrix into a fixed grid without some sort of test of check inside a loop.
FOR i = 0, n_elements(data) DO data2[lon[i], lat[i]]=data[i], assuming lon and lat are integer indices that match the [360, 180] requirements.
However, it did occur to me that the reason you need speed is that you are doing this repeatedly. In the case where all the lat-lon sets are unchanging, and the only difference is the values of the data, there is a speedier solution for all but the first data input.
What you do is create an index table that translates each DATA value to the index location of DATA2. Then, DATA2[table[0,*]] = DATA[table[1,*] for all subsequent values.
Hope this helps.
D. Klotter
|