#NEWLINE# def count_per_time_interval( time , values , time_interval , ignore_nodata , nodata = None ) : #NEWLINE# #INDENT# def aggregate_ignore_nodata( values ) : #NEWLINE# #INDENT# return ( numpy . ones ( values . shape [ 1 : ] , dtype = numpy . uint8 ) * values . shape [ 0 ] ) . tolist ( ) #NEWLINE# #UNINDENT# def aggregate_dont_ignore_nodata( values ) : #NEWLINE# #INDENT# return numpy . sum ( ( values != nodata ) , 0 ) #NEWLINE# #UNINDENT# aggregate = { #NEWLINE# #INDENT# mds . constants . IGNORE_NODATA : aggregate_ignore_nodata , #NEWLINE# mds . constants . DONT_IGNORE_NODATA : aggregate_dont_ignore_nodata , #NEWLINE# #UNINDENT# } #NEWLINE# ( result_time , result_values ) = aggregate_per_time_interval ( time , values , DURATION_BY_TIME_INTERVAL [ time_interval ] , aggregate [ ignore_nodata ] ) #NEWLINE# return ( result_time , [ numpy . array ( result_values [ i ] , numpy . min_scalar_type ( numpy . max ( result_values [ i ] ) ) ) for i in xrange ( len ( ignore_nodata ) ) ] )