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

Home » Public Forums » archive » How to pass NCDF files name to text files names?
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: How to pass NCDF files name to text files names? [message #72745 is a reply to message #72660] Thu, 30 September 2010 06:36 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Cameron Homeyer writes:

> I do this often and it is pretty easy to accomplish using STRING
> operators. You can use something like this for the code above:
>
> txt_list = STRARR(nosFiles)
>
> FOR i = 0, nosFiles -1 DO $
> txt_list[i] = STRMID(list[i], STRLEN(pathName), STRLEN(list[i]) - $
> STRLEN(pathName) - 2) + 'txt'
>
> Keep in mind, these do not have path names on them, but you can add
> those in the OPENW.

Oh, I see what he was talking about. I usually do this with
FSC_Base_Filename like this:

outputFiles = StrArr(nosFiles)
FOR j=0,nosFiles-1 DO BEGIN
rootname = FSC_Base_Filename(list[i])
outputFiles[j] = Filepath(ROOT_DIR=outputDir, rootname + '.txt')
ENDFOR

You can find FSC_Base_Filename here.

http://www.dfanning.com/programs/fsc_base_filename.pro

You could also use the IDL routine FILE_BASENAME in this case.

rootname = File_Basename(list[i], '.nc')

I just find the features of FSC_Base_Filename more amenable to
what I am trying to do, usually.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Coyote Facts
Next Topic: Accelerating a one-line program doing matrix multiplication

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

Current Time: Sat Oct 11 15:17:10 PDT 2025

Total time taken to generate the page: 1.03890 seconds