Re: Matching Structure Tag Lengths [message #31226] |
Fri, 28 June 2002 00:12  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Nate Doyle wrote:
>
> Hi there everyone. I've got a kind of confusing question that I can't
> quite figure out.
>
> I've got a bunch of data that is stored in two different structures,
> structure P and structure S. Structure P has 16 tags each of which is
> approximately an eighth of size of the tags in structure S (Structure
> S has 21 tags but that's pretty inconsequential).
>
> What I need to do is do some sort of interpolation between the two
> structures to make the arrays in Structure P the same size as the
> arrays in Structure S. I have an array in each structure that I know
> starts and ends at the same number so I'm trying to use this to do the
> interpolation. My code is below. I'm trying to use the replicate
> function but it doesn't seem to do the trick. I think I'm doing
> something wrong. Any help would be appreciated.
>
> p2=replicate(P[0],n_elements(S)) ; n_elements is a function that
> determines the number of elements
>
> for i=0,n_tags(P)-4 do begin
> temp=interp1(P.ms,P.(i),S.ms)
> P2.(i)=temp
> endfor
>
> the last three elements of P are meaningless hence the -4. The .ms is
> the array that I know to be equal.
>
> This is as far as I've gotten. Unfortunately I cannot do this at work
> as my computer won't connect to the board and allow me to post.
>
> Thanks in advance.
>
> Nate Doyle
My suggestion.
P has less tags and this tags are all given in S.
result=struct2ptr_struct(P)
tn=tag_names(p)
pos=tag_position(S,tn)
n=n_elements(tn)
FOR I=0,n-1 do $
*result.(I)=interp1(P.(i),S.(pos[i]))
; I don't know this routine interp1
result=ptr_struct2struct(result,/free)
needed routines:
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/struct2ptr_struct.tar.gz
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/tag_position.tar.gz
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/ptr_struct2struct.tar.gz
for further routines and licensing please have a look at
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
regards
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
============================================================ =======
|
|
|