0
votes

I have trouble in 2D interpolation and i hope someone can help me here! So i have vertical profiles of various variables on 35 unevenly distanced points(LON,LAT) of a line. For example at point 1 (LON1,LAT1) a vertical profile of Temperature exists till a depth of 3000 meters (value for every meter). The same stands for all the points which gives me a 3000 x 35 matrix for temperature with some nans because not all the profiles extend to 3000. To simplify the problem I converted (LON,LAT) to distance and setting the first point to zero i ended up with an array of 35 distance points in kilometers.

0   13.5249503652868    26.9047913191185    40.2043227556737
53.5953927068063    68.7246541157708    83.7206504065805    
97.5329665289129    113.608485218156    128.552410860790    
143.601266260157    158.929110574795    174.278260638739    
190.336392346001    205.931557129132    221.494121174778      
237.794806612557    252.414908786647    295.134701527471    
351.170490753821    384.473960193564    417.021164159912    
449.490674248662    494.362302821843    539.125735599804    
563.275845776792    572.605248034065    581.877760791985    
591.155182195857    600.456986025726    609.789467543194    
619.084692254915    629.933920289878    640.788063270672    
644.719823183569

Now i want to interpolate the vertical profiles in a grid with spacing for example every 3km in the horizontal and every 10m in the vertical. NEW grid:[Xgrid Ygrid]=meshgrid(0:3:644.719823183569, 5:10:3000); , size:300x215

Thus i use

temp_int=griddata(distance,depth,temp,...Xgrid,Ygrid,'v4'); 

where distance=1x35, depth=3000x1 and temp as mentioned above 3000x35.

This give me the following error :

run out of memory

Any help with the above or alternative solution to my problem really appreciated :)

1
cannot you split the interpolation? Do you load a lot of other variables other the ones you strictly need for the interpolation?shamalaia
The only variables i load are the ones mentioned above. What are your thoughts on splitting the interpolation?kstelios
for example interpolating just the first half of the data and then the second. typically T data does not vary much on a 35km scale. the error would be minimal I thinkshamalaia

1 Answers

0
votes

You colud try using a scatteredInterpolant, it migth be better memorywise

An other idee might be to scale down your data, cast your data to single. You essentially half the necessary memory