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

Home » Public Forums » archive » Re: Copying files in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Copying files in IDL [message #31190] Thu, 20 June 2002 00:14 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Marc Schellens wrote:
>
> Reimar Bauer wrote:
>>
>> Sean Raffuse wrote:
>>>
>>> Hello folks. I would like to make a copy of an hdf file, changing only to
>>> filename and the content of one of datasets in the hdf. I have no problem
>>> putting in the new content, but this overwrites the old file, which I need
>>> to preserve. How do I copy and/or rename the file in IDL? I don't want to
>>> have to rebuild the entire hdf file and it's dozens of attributes. Just a
>>> near exact copy with a different name.
>>>
>>> Thanks in advance,
>>>
>>> Sean
>>
>> Dear Sean,
>>
>> what's with this primitive way.
>>
>> spawn,'cp file.hdf new_file.hdf'
>>
>> and then operations on then new file.
>>
>> regards
>
> The disadvantage of this solution is that it's not portable.
> If the filesize is not to large, you can do something like:
>
> openr,1,'file.hdf'
> fs=fstat(1)
> b=bytarr(fs.size)
> readu,1,b
> close,1
> openw,1,'new_file.hdf'
> writeu,1,b
> close,1
>
> cheers,
> marc

Then we should do a feature request for file_copy
probably using this routine with /GET_LUN.

If bytarr is replaced with b=make_array(/nozero,ft.size,/byte)
the routine is much faster if filesize is big.


One problem could occure if HDF file size is very large.
Because data is named and index sequentiell organized in this file
and there is no reason by reading/writing with HDF commands
of the whole file at once.
HDF filesize could be bigger than 1 or 10 Giga Byte .

In this case a system command will be better and
you can do a case depending of !version.os_family.


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
============================================================ =======
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: 3-d viz
Next Topic: .idl data format

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

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

Total time taken to generate the page: 0.00417 seconds