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

Home » Public Forums » archive » Auto-path finding when writing file
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
Auto-path finding when writing file [message #94593] Tue, 18 July 2017 07:23 Go to next message
thtran296 is currently offline  thtran296
Messages: 8
Registered: June 2017
Junior Member
Thank you so much guys for helping me with IDL recently.
I truly appreciate all the help and feedback.

So I have successfully written a loop that will write 365 separate files (named Day1, Day2, Day3, .. so on).
The problem is, all of these text files were placed in this directory: HDD-Users-Sam
This is messy.

I have already created 12 separate folders (named January to December). Ultimately, I want IDL to write the above 365 files to the appropriate folder.
For example, the file Day1 would be written in the folder January, and the file Day350 would be written in the folder December.

How would I do this?
Again, thank you very much.

Here's what I have so far:
data = .......... (my data goes in here)
arr = string(intarr(1,365))
for j = 0,364 do begin
arr(j) = 'Day'+ strtrim(string(j),2) + '.dat'
get_lun, unit
openw, unit, arr(j), /get_lun
printf, unit, data
close, unit
endfor
Re: Auto-path finding when writing file [message #94594 is a reply to message #94593] Tue, 18 July 2017 08:48 Go to previous message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On 07/18/2017 04:23 PM, thtran296@gmail.com wrote:
> Thank you so much guys for helping me with IDL recently.
> I truly appreciate all the help and feedback.
>
> So I have successfully written a loop that will write 365 separate files (named Day1, Day2, Day3, .. so on).
> The problem is, all of these text files were placed in this directory: HDD-Users-Sam
> This is messy.
>
> I have already created 12 separate folders (named January to December). Ultimately, I want IDL to write the above 365 files to the appropriate folder.
> For example, the file Day1 would be written in the folder January, and the file Day350 would be written in the folder December.
>
> How would I do this?
> Again, thank you very much.
>
> Here's what I have so far:
> data = .......... (my data goes in here)
> arr = string(intarr(1,365))
month=[replicate('jan',31),replicate('feb',28),replicate('ma r',31)]
> for j = 0,364 do begin
arr(j) = month[j]+'/Day'+ strtrim(string(j),2) + '.dat'
> get_lun, unit
> openw, unit, arr(j), /get_lun
> printf, unit, data
> close, unit
> endfor
you will need to put in the rest of the months... not to mention leap year.

see http://harrisgeospatial.com/docs/caldat.html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Writing to Multiple txt file with different names
Next Topic: converting xy to lon lat

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

Current Time: Wed Oct 08 07:23:54 PDT 2025

Total time taken to generate the page: 0.00392 seconds