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 #72746 is a reply to message #72660] Thu, 30 September 2010 06:06 Go to previous message
Cameron Homeyer is currently offline  Cameron Homeyer
Messages: 1
Registered: September 2010
Junior Member
In article
<eed8d361-81dc-4c81-926f-23e78bd74d6f@28g2000yqm.googlegroups.com>,
Dave Poreh <d.poreh@gmail.com> wrote:

> Folks
> I am reading some NCDF files like this:
> pathName="d:\p\"
> List = findfile(pathName+"*.nc")
> nosFiles=N_ELEMENTS(List)
> data = ptrarr(nosFiles)
> for i = 0, nosFiles - 1 do begin
> ncid = NCDF_OPEN(list[i])
> NCDF_VARGET, ncid, 0, lon
> NCDF_VARGET, ncid, 1, lat
> NCDF_VARGET, ncid, 2, concentration
> NCDF_CLOSE, ncid ; Close the NetCDF file
> *Here I need to save all of my files (in text format) in arrays with 3
> columns and with name of NCDF file that I am reading (for instance:
> L3b_20070716.txt, L3b_20070717 and so on)*
> Endfor
> In another word I need to pass my NCDF files name to text files names.
> I don�t know how. Will you please help me?
> Cheers,
> Dave

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.

Cheers,
Cameron
[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:38 PDT 2025

Total time taken to generate the page: 0.48053 seconds