[Tutor] Filling in Missing Data from Txt Files - Resubmitted

Benson, Randall Randall.Benson at iberdrolaren.com
Tue Jan 11 17:41:16 CET 2011


Thank you kindly in advance for help on this topic:

 

I am almost finished with writing a program that averages 10-minute
column data and outputs the 10-minute data into hourly averages in a
separate txt file - the program executes and outputs to the output file
perfectly for use by another program.  A sample of the input file is
attached below.  The 0 column is the date in yymmdd, the 1st column is
the time in hhmm form and the other columns are wind data.  This last
step of my program requires me to fill in missing hours with a value
such as -9999 for the hour in which all of the data is missing for that
hour as shown below.  In the sample below there is no data for hours
1000, 1100, 1200 and 1300.  For these missing data rows I need to insert
the correct date, time and -9999 for the other missing data columns
(columns 2-6). 

 

080618 0950  5.10  7.40 224.0  -3.54  -3.67   

080618 1000  4.62  7.00 227.0  -3.38  -3.15   

080618 1410  5.19  7.30 232.0  -4.09  -3.20   

 

In my program I am reading all the data from the input txt file in a
large "for loop" shown below - whereby fileObj is my open statement to
the txt data input file:

 

for line in fileObj:

        lineList = line.strip().split()

 

 

 

 

Thank you,

 

Randall P. Benson 

 


Please be advised that email addresses for Iberdrola Renewables personnel have changed to first.last at iberdrolaREN.com effective Aug. 16, 2010.  Please make a note.  Thank you.

This message is intended for the exclusive attention of the recipient(s) indicated.  Any information contained herein is strictly confidential and privileged.  If you are not the intended recipient, please notify us by return e-mail and delete this message from your computer system. Any unauthorized use, reproduction, alteration, filing or sending of this message and/or any attached files may lead to legal action being taken against the party(ies) responsible for said unauthorized use. Any opinion expressed herein is solely that of the author(s) and does not necessarily represent the opinion of the Company. The sender does not guarantee the integrity, speed or safety of this message, and does not accept responsibility for any possible damage arising from the interception, incorporation of viruses, or any other damage as a result of manipulation.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110111/63960d9d/attachment.html>


More information about the Tutor mailing list