Re: saving pointers in structures to FITS files? [message #65296 is a reply to message #65097] |
Tue, 24 February 2009 14:47   |
Christopher Thom
Messages: 66 Registered: October 2006
|
Member |
|
|
Hi Reimar,
Thanks for your tips. I'll look into netCDF...and in the meantime, I just
defaulted to using .sav files. But maybe a quick wrapper to my FITS reader
would do the trick. Will have to think about it some more...
cheers
chris
Quoth Reimar Bauer:
> Christopher Thom schrieb:
>> Hi all,
>>
>> I have some code that uses to a structure to store a bunch of information.
>> In the structure, I need to hold an array whose size will be defined (and
>> modified) at run-time. I figured the easiest way was just to hold a
>> pointer in the structure, and populate the heap variable at runtime.
>>
>> However...I'd like for the structure to be persistent between idl
>> sessions, and I'd like the on-disk file to be fairly portable between
>> collaborators/idl versions. I've tried all manifestations of FITS routines
>> for dumping this, but mwrfits seems to just convert the data to a regular
>> array, and I lose the ability to modify the length of the array when i
>> read it back in.
>>
>> Does anyone have suggestions for drop-in replacements for the FITS binary
>> tables? I've had problems with save files across idl versions before. Are
>> there better alternatives? Or is there a magic keyword to mwrfits/mrdfits
>> that I should be specifying? Or do I just have to suck it up and use a
>> save file?
>>
>> cheers
>> chris
>
> Hi Christoper
>
> no one has answered because you have to look for one who has run in the
> same trouble so he can understood your problem.
>
> I have no idea what FITS is.
>
> But I can tell that you won't have problems with save files if you just
> save your own variables and not everything.
>
> If the problem is that the pointer is replaced by it's content why don't
> you recreate the pointer again?
>
> you can do this by
> http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl _html/dbase/struct2ptr_struct_dbase.pro.html
> http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl _work/rb_lib/struct2ptr_struct.pro
>
> struct={A:1,b:FINDGEN(10)}
>
> HELP,struct,/str
> ** Structure <1052378>, 2 tags, length=44, refs=1:
> A INT 1
> B FLOAT Array[10]
> result=struct2ptr_struct(struct)
> HELP,result,/str
> ** Structure <10551e8>, 2 tags, length=8, refs=1:
> A POINTER
> B POINTER
>
> Also you could save your data in an hdf SD or netCDF file. Those files
> can be read by various programs/languagees so one can choose how to
> operate with that data. It is always good to keep the dependencies low.
>
>
> cheers
> Reimar
>
>
>
>
|
|
|