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

Home » Public Forums » archive » Looping through a bunch of files?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Looping through a bunch of files? [message #92864] Tue, 15 March 2016 11:29 Go to next message
wdolan is currently offline  wdolan
Messages: 29
Registered: June 2015
Junior Member
I am a total beginner, and would very much love any assistance!

So I am looking at .nc files. There is one file for every day of the year, they are all in the same folder called /home/nc_d/, and each file has the same internal structure, and are named in the format gc_daily.20130130, varying based only on the date.

I want to figure out how many files there are for each month, and then loop through all the files of a given month.

I'm not sure where to start!

I've used n_elements to tell how many files are in an array before, but that doesn't seem to apply to files....

Thanks for your help.
Re: Looping through a bunch of files? [message #92865 is a reply to message #92864] Tue, 15 March 2016 11:43 Go to previous messageGo to next message
wdolan is currently offline  wdolan
Messages: 29
Registered: June 2015
Junior Member
Just to clarify, I want a way to tell how many files (which each correspond to a day) there are for each month. Just to note, not all days have files, so I can't just assume that there are 28 files for February for example.

and I misspoke in my original post when I said how I used n_elements. It was used to tell the number of elements in an array. not the number of files.

On Tuesday, March 15, 2016 at 11:29:06 AM UTC-7, Wayana Dolan wrote:
> I am a total beginner, and would very much love any assistance!
>
> So I am looking at .nc files. There is one file for every day of the year, they are all in the same folder called /home/nc_d/, and each file has the same internal structure, and are named in the format gc_daily.20130130, varying based only on the date.
>
> I want to figure out how many files there are for each month, and then loop through all the files of a given month.
>
> I'm not sure where to start!
>
> I've used n_elements to tell how many files are in an array before, but that doesn't seem to apply to files....
>
> Thanks for your help.
Re: Looping through a bunch of files? [message #92866 is a reply to message #92865] Tue, 15 March 2016 13:28 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
http://www.harrisgeospatial.com/docs/FILE_SEARCH.html

One way would be to construct your "path specification" to reflect a
particular month.


On 03/15/16 14:43, Wayana Dolan wrote:
> Just to clarify, I want a way to tell how many files (which each
> correspond to a day) there are for each month. Just to note, not all
> days have files, so I can't just assume that there are 28 files for
> February for example.
>
> and I misspoke in my original post when I said how I used n_elements.
> It was used to tell the number of elements in an array. not the
> number of files.
>
> On Tuesday, March 15, 2016 at 11:29:06 AM UTC-7, Wayana Dolan wrote:
>> I am a total beginner, and would very much love any assistance!
>>
>> So I am looking at .nc files. There is one file for every day of
>> the year, they are all in the same folder called /home/nc_d/, and
>> each file has the same internal structure, and are named in the
>> format gc_daily.20130130, varying based only on the date.
>>
>> I want to figure out how many files there are for each month, and
>> then loop through all the files of a given month.
>>
>> I'm not sure where to start!
>>
>> I've used n_elements to tell how many files are in an array before,
>> but that doesn't seem to apply to files....
>>
>> Thanks for your help.
Re: Looping through a bunch of files? [message #92868 is a reply to message #92866] Tue, 15 March 2016 15:30 Go to previous message
wdolan is currently offline  wdolan
Messages: 29
Registered: June 2015
Junior Member
Hi Paul,

That worked, thank you!


On Tuesday, March 15, 2016 at 1:28:48 PM UTC-7, Paul van Delst wrote:
> http://www.harrisgeospatial.com/docs/FILE_SEARCH.html
>
> One way would be to construct your "path specification" to reflect a
> particular month.
>
>
> On 03/15/16 14:43, Wayana Dolan wrote:
>> Just to clarify, I want a way to tell how many files (which each
>> correspond to a day) there are for each month. Just to note, not all
>> days have files, so I can't just assume that there are 28 files for
>> February for example.
>>
>> and I misspoke in my original post when I said how I used n_elements.
>> It was used to tell the number of elements in an array. not the
>> number of files.
>>
>> On Tuesday, March 15, 2016 at 11:29:06 AM UTC-7, Wayana Dolan wrote:
>>> I am a total beginner, and would very much love any assistance!
>>>
>>> So I am looking at .nc files. There is one file for every day of
>>> the year, they are all in the same folder called /home/nc_d/, and
>>> each file has the same internal structure, and are named in the
>>> format gc_daily.20130130, varying based only on the date.
>>>
>>> I want to figure out how many files there are for each month, and
>>> then loop through all the files of a given month.
>>>
>>> I'm not sure where to start!
>>>
>>> I've used n_elements to tell how many files are in an array before,
>>> but that doesn't seem to apply to files....
>>>
>>> Thanks for your help.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Splitting large for loop over multiple processors
Next Topic: Saving/archiving IDL notebook

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

Current Time: Wed Oct 08 09:09:02 PDT 2025

Total time taken to generate the page: 0.00427 seconds