comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » interpolation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
interpolation [message #78601] Wed, 07 December 2011 05:46
anil is currently offline  anil
Messages: 34
Registered: August 2009
Member
Hi,
I have many ascii files which contain a header , 5 columns of data .
Number of rows for each data is different. Here is an example of the
data:

7.5 14.552 17.698 14.551 12.7623
9.6 14.547 17.700 14.546 12.7648
14.6 14.462 17.713 14.460 12.7903
19.4 14.341 17.737 14.339 12.8307
24.4 14.161 17.780 14.158 12.8962
29.3 13.704 17.921 13.701 13.0851
34.6 12.313 17.986 12.309 13.3670
39.2 9.622 18.062 9.619 13.8134
44.5 8.659 18.165 8.655 14.0121
49.7 8.451 18.194 8.447 14.0590
54.3 8.221 18.257 8.217 14.1343
59.4 7.938 18.324 7.934 14.2180
64.8 7.808 18.441 7.803 14.3237
69.5 7.880 18.617 7.875 14.4536
74.5 7.923 18.924 7.917 14.6890
79.4 8.040 19.190 8.034 14.8840
84.3 8.100 19.372 8.093 15.0196
89.8 8.050 19.613 8.043 15.2137
94.6 8.069 19.781 8.062 15.3429
99.3 8.076 19.922 8.068 15.4524
109.7 8.235 20.314 8.226 15.7404
169.3 8.564 21.193 8.550 16.3880
179.3 8.602 21.269 8.587 16.4428
189.3 8.632 21.327 8.616 16.4844
199.1 8.659 21.378 8.642 16.5210
209.6 8.680 21.424 8.662 16.5544
219.3 8.708 21.482 8.689 16.5963
229.2 8.733 21.527 8.713 16.6283
239.4 8.755 21.570 8.734 16.6592
249.4 8.768 21.617 8.746 16.6944
259.3 8.777 21.649 8.754 16.7183
268.9 8.788 21.678 8.764 16.7397
278.9 8.796 21.700 8.771 16.7559
289.1 8.806 21.733 8.781 16.7805
298.9 8.834 21.764 8.808 16.8013
324.2 8.834 21.813 8.805 16.8398
349.1 8.854 21.864 8.823 16.8773
374.4 8.861 21.896 8.828 16.9017
399.5 8.861 21.916 8.825 16.9176
424.1 8.866 21.935 8.828 16.9321
449.1 8.871 21.958 8.831 16.9497
474.3 8.878 21.982 8.835 16.9678
499.5 8.881 22.005 8.836 16.9857
524.2 8.885 22.028 8.837 17.0034
549.1 8.889 22.048 8.839 17.0188
574.0 8.892 22.072 8.840 17.0375
599.0 8.895 22.100 8.840 17.0592
649.4 8.900 22.137 8.840 17.0881
699.5 8.907 22.169 8.842 17.1128
749.4 8.913 22.195 8.843 17.1329
799.3 8.921 22.215 8.847 17.1481
849.3 8.929 22.230 8.850 17.1595
899.5 8.938 22.246 8.853 17.1714
949.5 8.947 22.258 8.857 17.1803
999.3 8.954 22.266 8.859 17.1863
1049.6 8.965 22.276 8.865 17.1933
1099.1 8.971 22.282 8.866 17.1979
1149.0 8.980 22.288 8.870 17.2021
1198.9 8.989 22.294 8.873 17.2063
1249.3 8.996 22.297 8.875 17.2084
1299.4 9.003 22.301 8.877 17.2113
1349.4 9.011 22.304 8.879 17.2133
1399.0 9.018 22.305 8.881 17.2139
1449.1 9.025 22.308 8.882 17.2160
1499.2 9.033 22.309 8.885 17.2165
1549.2 9.040 22.311 8.886 17.2179
1551.8 9.041 22.311 8.887 17.2178

The columns are depth,temperature,salinity,potential temperature and
density respectively. The depth values are changing in each data set
(7.5 is 6.7 and 9.6 is 10 in the next data and so on...). In some data
files, depth values end at 300 or 400 etc... . What I want to do is to
interpolate these depth values and their corresponding
temperature,salinity, etc.. to certain levels i assign
[5,10,15,20,25.........200,210,220.... 300,325,350,.....] or to 1m
depth levels starting from 5m, such as (5,6,7,......50,....1550). The
problem here is with the 2nd and 4th column where the data first
descends to a certain level and then starts ascending again. Therefore
i can not use function interpol. I have done such an interpolation
earlier:

pval=100; depth value
ind=0
if (p[0] le pval) then begin
while (ind le (nrows-2) and p[ind] le 100) do ind=ind+1
tempx(i)=t[ind]-((p[ind]-100)/(p[ind]-p[ind-1])*(t[ind]-t[in d-1]))
salx(i)=s[ind]-((p[ind]-100)/(p[ind]-p[ind-1])*(s[ind]-s[ind -1]))
potempx(i)=q[ind]-((p[ind]-100)/(p[ind]-p[ind-1])*(q[ind]-q[ ind-1]))
denx(i)=d[ind]-((p[ind]-100)/(p[ind]-p[ind-1])*(d[ind]-d[ind -1]))
endif

; i is the data index( 1st file,2nd file etc..) and nrows is the
number of rows, which are assigned earlier in the code.

with this, I interpolate the values and obtain temperature,salinity
etc.., for this case at 100m.

I think i can find all the values i want with this way, but there
should be a much easier way I guess. I need help on this.
Regards
[Message index]
 
Read Message
Previous Topic: Constructing integer variables from two bytes?
Next Topic: Re: Coyote Graphics PDF Files

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:50:00 PDT 2025

Total time taken to generate the page: 0.07104 seconds