Hello everyone. I have a set of weather data, wind in the East-West direction downloaded from the ECMWF. It is avaiable freely here, albeit it needs some processing.
I want to use the Shannon interpolation to obtain an analytic representation of the two-dimensional field. I have done it in the attached Mathematica code. Unfortunately, as you can see, it takes a huge number of terms to propperly reproduce the original field.
As far as I know, Shannon interpolation is quite useful since it usually needs very few terms, so, I would like to ask if anybody can suggest me a way to reduce the number of terms without having to sacrifice much of the precission.
Some time ago, a professor of mine sent me a sample code in 1D where Y=f(X) in which before using Shannon, he made two extensions of the data, one on the left side and another in the right side using BSplineFunction as
{xmin, leftY} = First@data ; (* saving data min *)
{xmax, rightY} = Last@data ;(* saving data max *)(*y=f(x)*)
dDelta = (xmax - xmin)/10 (* step *)
leftF = BSplineFunction[{{xmin, leftY}, {xmin - dDelta,
leftY - dDelta (rightY - leftY)/(xmax - xmin)}, {xmin - 2 dDelta,
0}, {xmin - 3 dDelta,
0}}];(* computing bspline for the left extension *)
rightF = BSplineFunction[{{xmax, rightY}, {xmax + dDelta,
rightY + dDelta (rightY - leftY)/(xmax - xmin)}, {xmax + 2 dDelta,
0}, {xmax + 3 dDelta,
0}}]; (* computing bspline for the right extension *)
(*generating the extended data set *)
data1 = SortBy[
Join[Table[leftF[t/4], {t, 1, 4}], data,
Table[rightF[t/4], {t, 1, 4}]],
First]; (* concatenating left extension, original data and right \
extension *)
And then putting this data1 into ifunc. Perhaps is this what I need, but I don't know how to do something similar in 2D, since I am using data where Z=f(X,Y).
Does anybody can aid me with reducing the number of terms or extending to 2D the previous code? any answer is appreciated.
Best regards.
Jaime.
Attachments: