filename = "./Test_reads.csv" ;---Open CSV file and read as array of strings lines = asciiread(filename,-1,"string") nlines = dimsizes(lines)-1 ;---Read the 2nd and 3rd columns of data, convert to float jul_day = tofloat(str_get_field(lines(1:),2,",")) rainfall = tofloat(str_get_field(lines(1:),3,",")) ;---Parse the Time field by "," first, then ":", convert to integer hh_mm_ss = str_get_field(lines(1:),1,",") hh = toint(str_get_field(hh_mm_ss,1,":")) mm = toint(str_get_field(hh_mm_ss,2,":")) ss = toint(str_get_field(hh_mm_ss,3,":")) rainfall@long_name = "Rainfall" hh@long_name = "hours" mm@long_name = "minutes" ss@long_name = "seconds" ;---Look at your data! printMinMax(rainfall,0) printMinMax(hh,0) printMinMax(mm,0) printMinMax(ss,0) ; ; Get all indexes of all hours between 8 and 10 and take average ; of the rainfall data at those locations. ; z9_inds = ind(hh.ge.8.and.hh.le.10) ; this includes all values from 08:00:00 to 10:59:59 z9_rain_avg = avg(rainfall(z9_inds)) print("Rainfall average for hours between 8 and 10 = " + z9_rain_avg) print("# of values averaged for these hours = " + dimsizes(z9_inds))