Read and Write IDL SAVE files! [message #23679] |
Mon, 12 February 2001 03:45  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
I am pleased to release a library for reading writing and
interrogating IDL SAVE files on my web page:
http://cow.physics.wisc.edu/~craigm/idl/idl.html
Interactive users will probably appreciate the ability of CMSAVEDIR to
list the contents of a SAVE file without restoring it. I personally
find this procedure very useful, because I often create save files and
later forget what they contain. You may find the download worth it
just for this feature! They will also probably like the /APPEND
keyword of CMSAVE to append additional data to any SAVE file.
Programmers will probably use the library to write their own data, and
to read user's existing data. The library provides higher-, middle-
and lower-level routines for reading writing and querying a SAVE file.
There are flexible ways to selectively save and restore variables
under programmatic control. Using the CMSAVEDIR procedure it is
possible to extract a wealth of information about the save file
without actually reading the data.
The library supports all save file formats written by IDL version 4
and later. However there are some caveats. As we explored on this
newsgroup, it will not be possible to save and restore objects, but JD
Smith's solution will be greatly facilitated by the NAMED_CLASSES
keyword of CMSAVEDIR. It is also not possible to read or write
compressed files, or files larger than 2 gigabytes. Still I think
people will find a lot of applications for the library.
I encourage you to give it a try. As usual, all the files are
documented, and the web page contains some overall documentation. You
can get started almost right away, and some examples are provided on
the web page, listed under Questions and Answers. The first thing you
can try is the CMSV_TEST procedure which will make sure you have a
fully functional library. Hopefully there will be relatively few bugs
to shake out! :-)
Have fun with it,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
|
Re: Read and Write IDL SAVE files! [message #23739 is a reply to message #23679] |
Thu, 15 February 2001 07:35  |
Christopher W. O'Dell
Messages: 20 Registered: February 2001
|
Junior Member |
|
|
thanks craig, i was just messing around with your programs, but when I would really
use CMRESTORE at
this point would be to selectively restore variables, so everything's fine. ANd,
as we have a site license here,
and there's now that cool trick to make gif's with 5.4, i'll probably
upgrade...thanks much!
Chris
Craig Markwardt wrote:
> "Christopher W. O'Dell" <odell@cmb.physics.wisc.edu> writes:
>
>> Craig,
>>
>> Your library looks GREAT. I'm still using v5.2, however, and your CMRESTORE
>> routine had some problems restoring
>> a file written with SAVE (v5.2), giving the following error for each variable
>> in the file:
>>
>> %CMRESTORE: WARNING: could not create variable QFINALMAP in calling routine.
>> ...
>>
>> However, when i do
>>
>> idl> CMRESTORE, filename, qfinalmap
>>
>> it restorest that variable just fine. Any ideas?
>
> Yes, you really have two choices:
>
> * upgrade to IDL 5.3, or;
> * define the variables before you call CMRESTORE.
>
> Before IDL 5.3, there was no programmatic way to *create* a variable
> at the caller's level, but you can modify an existing one.
>
> When you type,
>
> CMRESTORE, filename, qfinalmap
>
> you are passing by argument, which is something completely different.
> The values are returned by argument, so CMRESTORE doesn't have to try
> to deposit them in the caller's level. This should proceed without a
> hitch.
>
> I should note that it doesn't matter *how* you define the variable, or
> even that you give it a defined value! As long as it exists as a
> named variable you should be fine.
>
> This leads me to my recommended procedures:
>
> * if you are simply trying to restore all the variables, go ahead and
> use RESTORE.
>
> * if you want to restore selected variables, then use one of these:
> CMRESTORE, filename, qfinalmap ; or
> CMRESTORE, x0, x1, names=['filename', 'qfinalmap']
>
> * if you are writing a program then there are some other helpful ways
> to exchange data, using either pointers, or a structure.
>
> Have fun Chris!
> Craig
>
> --
> ------------------------------------------------------------ --------------
> Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> ------------------------------------------------------------ --------------
|
|
|
Re: Read and Write IDL SAVE files! [message #23744 is a reply to message #23679] |
Wed, 14 February 2001 12:10  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
"Christopher W. O'Dell" <odell@cmb.physics.wisc.edu> writes:
> Craig,
>
> Your library looks GREAT. I'm still using v5.2, however, and your CMRESTORE
> routine had some problems restoring
> a file written with SAVE (v5.2), giving the following error for each variable
> in the file:
>
> %CMRESTORE: WARNING: could not create variable QFINALMAP in calling routine.
> ...
>
> However, when i do
>
> idl> CMRESTORE, filename, qfinalmap
>
> it restorest that variable just fine. Any ideas?
Yes, you really have two choices:
* upgrade to IDL 5.3, or;
* define the variables before you call CMRESTORE.
Before IDL 5.3, there was no programmatic way to *create* a variable
at the caller's level, but you can modify an existing one.
When you type,
CMRESTORE, filename, qfinalmap
you are passing by argument, which is something completely different.
The values are returned by argument, so CMRESTORE doesn't have to try
to deposit them in the caller's level. This should proceed without a
hitch.
I should note that it doesn't matter *how* you define the variable, or
even that you give it a defined value! As long as it exists as a
named variable you should be fine.
This leads me to my recommended procedures:
* if you are simply trying to restore all the variables, go ahead and
use RESTORE.
* if you want to restore selected variables, then use one of these:
CMRESTORE, filename, qfinalmap ; or
CMRESTORE, x0, x1, names=['filename', 'qfinalmap']
* if you are writing a program then there are some other helpful ways
to exchange data, using either pointers, or a structure.
Have fun Chris!
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: Read and Write IDL SAVE files! [message #23745 is a reply to message #23679] |
Wed, 14 February 2001 11:48  |
Christopher W. O'Dell
Messages: 20 Registered: February 2001
|
Junior Member |
|
|
Craig,
Your library looks GREAT. I'm still using v5.2, however, and your CMRESTORE
routine had some problems restoring
a file written with SAVE (v5.2), giving the following error for each variable
in the file:
%CMRESTORE: WARNING: could not create variable QFINALMAP in calling routine.
...
However, when i do
idl> CMRESTORE, filename, qfinalmap
it restorest that variable just fine. Any ideas?
Chris
|
|
|
Re: Read and Write IDL SAVE files! [message #23748 is a reply to message #23679] |
Wed, 14 February 2001 09:39  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Craig Markwardt wrote:
>
> Reimar Bauer <r.bauer@fz-juelich.de> writes:
>
>> Craig Markwardt wrote:
>>>
>>> I am pleased to release a library for reading writing and
>>> interrogating IDL SAVE files on my web page:
>>>
>>> http://cow.physics.wisc.edu/~craigm/idl/idl.html
>>>
>>
>> Dear Craig,
>>
>> that's wonderful. This saves me a lot of future work, because I am
>> working on an idea how to write IDL SAV files by C/Fortran or LabView.
>>
>> RSI won't like to give me the specifications of this format.
>>
>> So I am waiting for your documentation.
>
> You mean you can't figure it out from the code? :-)
I am sure I can. Because I have solved it already for some types
but not for all as yours. On the other hand if a description already
is available some non idl programmers are able to understand
the format too.
> Writing it in C or FORTRAN would in some ways be easier, but in some
> ways more difficult. I use the benefit of being able to EXECUTE
> expressions in order to build up named structures for example. The
> dynamic typing is also a real boon. This would be harder in C or
> FORTRAN. However, if you are just interested in simple things --
> arrays and scalars -- then the format is quite straightforward. It
> would be somewhat faster to execute in a compiled language.
>
> Craig
>
> --
> ------------------------------------------------------------ --------------
> Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> ------------------------------------------------------------ --------------
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
=============================================
a IDL library at ForschungsZentrum J�lich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
http://www.fz-juelich.de/zb/text/publikation/juel3786.html
|
|
|
Re: Read and Write IDL SAVE files! [message #23757 is a reply to message #23679] |
Tue, 13 February 2001 14:46  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Reimar Bauer <r.bauer@fz-juelich.de> writes:
> Craig Markwardt wrote:
>>
>> I am pleased to release a library for reading writing and
>> interrogating IDL SAVE files on my web page:
>>
>> http://cow.physics.wisc.edu/~craigm/idl/idl.html
>>
>
> Dear Craig,
>
> that's wonderful. This saves me a lot of future work, because I am
> working on an idea how to write IDL SAV files by C/Fortran or LabView.
>
> RSI won't like to give me the specifications of this format.
>
> So I am waiting for your documentation.
You mean you can't figure it out from the code? :-)
Writing it in C or FORTRAN would in some ways be easier, but in some
ways more difficult. I use the benefit of being able to EXECUTE
expressions in order to build up named structures for example. The
dynamic typing is also a real boon. This would be harder in C or
FORTRAN. However, if you are just interested in simple things --
arrays and scalars -- then the format is quite straightforward. It
would be somewhat faster to execute in a compiled language.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
|