Dear all,

I have files which contain lines like this:

30516F5  Sep    1985  1-Day Rain    Trace   0.2    3.2   Trace   0.0
0.0    0.0    0.0    0.2    0.0   Trace  29.2    0.0    0.0    0.0
0.0    1.8
30516F5  Sep    1985  1-Day Snow    Trace   0.0    0.0    0.0   14.8
10.1   Trace   0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0
Trace  Trace   0.0
30516F5  Sep    1985  1-Day Pcpn.   Trace   0.2    3.2   Trace  18.9
9.8   Trace   0.0    0.2    0.0   Trace  29.2    0.0    0.0    0.0
Trace   1.8    0.0
30516F5  May    1986  Max. Temp.     Misg   Misg   Misg   Misg   Misg
Misg   9.0    8.0    8.0    0.0    6.0    1.0    1.0   -3.0    3.
30516F5  May    1986  Min. Temp.     Misg   Misg   Misg   Misg   Misg
Misg   Misg  -1.0   -2.0   -6.0   -5.0   -5.0   -3.0   -7.0   -6.0   -5.0
-3.0


different columns were separated by blank spaces. with the first column as
sitename, second as month name, then year, then variable name and data.

I want to read them line by line into a list, and then connect all the
numerical data within one year into a list, and then combining different
year data into one masked ndarray,
in this process, I check the flags (Trace, Misg, etc.) and replace them as
unique values (or missing values). and then begin to analyse the data. each
file contains only one site,
it can be big or small depending on the number of years.

I don't know what's the good way to do this job. what I am thinking is to
read one file line by line, and then divide this line by blank space, and
replace special flag. but during this process,
I need to do type conversion.

any suggestion would be appreciated.

Chao

-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to