I would like to calculate summary statistics of rainfall based on year and
month.
I have the data in a text file (although could put in any format if it
helps) extending over approx 40 years:
YEAR MONTH    MeanRain
1972 Jan    12.7083199
1972 Feb    14.17007142
1972 Mar    14.5659302
1972 Apr    1.508517302
1972 May    2.780009889
1972 Jun    1.609619287
1972 Jul    0.138150181
1972 Aug    0.214346148
1972 Sep    1.322102228

I would like to be able to calculate the total rain annually:

YEAR   Annualrainfall
1972    400
1973    300
1974    350
....
2011     400

and also the monthly mean rainfall for all years:

YEAR  MonthlyMeanRain
Jan      13
Feb      15
Mar       8
.....
Dec       13


Is this something I can easily do?
I have started by simply importing the text file but data is not
represented as time so that is probably my first problem and then I am not
sure how to group them by month/year.

textfile=r"textfile.txt"
f=np.genfromtxt(textfile,skip_header=1)

Any feedback will be greatly appreciated.
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to