#NEWLINE# def solar_position_numba( unixtime , lat , lon , elev , pressure , temp , delta_t , atmos_refract , numthreads , sst = False ) : #NEWLINE# #INDENT# 'Calculate the solar position using the numba compiled functions\n    and multiple threads. Very slow if functions are not numba compiled.\n    ' #NEWLINE# loc_args = np . array ( [ lat , lon , elev , pressure , temp , delta_t , atmos_refract , sst ] ) #NEWLINE# ulength = unixtime . shape [ 0 ] #NEWLINE# result = np . empty ( ( 6 , ulength ) , dtype = np . float64 ) #NEWLINE# if ( unixtime . dtype != np . float64 ) : #NEWLINE# #INDENT# unixtime = unixtime . astype ( np . float64 ) #NEWLINE# #UNINDENT# if ( ulength < numthreads ) : #NEWLINE# #INDENT# pvl_logger . warning ( ( 'The number of threads is more than the length of' + ' the time array. Only using %s threads.' ) , ulength ) #NEWLINE# numthreads = ulength #NEWLINE# #UNINDENT# if ( a0 <= 1 ) : #NEWLINE# #INDENT# pvl_logger . debug ( 'Only using one thread for calculation' ) #NEWLINE# solar_position_loop ( unixtime , loc_args , result ) #NEWLINE# return result #NEWLINE# #UNINDENT# split0 = np . array_split ( unixtime , numthreads ) #NEWLINE# split2 = np . array_split ( result , numthreads , axis = 1 ) #NEWLINE# chunks = [ [ a0 , loc_args , split2 [ i ] ] for ( i , a0 ) in enumerate ( split0 ) ] #NEWLINE# threads = [ threading . Thread ( target = solar_position_loop , args = chunk ) for chunk in chunks ] #NEWLINE# for thread in threads : #NEWLINE# #INDENT# thread . start ( ) #NEWLINE# #UNINDENT# for thread in threads : #NEWLINE# #INDENT# thread . join ( ) #NEWLINE# #UNINDENT# return result