当前位置: 首页>>代码示例>>Python>>正文


Python Parallel.copy方法代码示例

本文整理汇总了Python中joblib.Parallel.copy方法的典型用法代码示例。如果您正苦于以下问题:Python Parallel.copy方法的具体用法?Python Parallel.copy怎么用?Python Parallel.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在joblib.Parallel的用法示例。


在下文中一共展示了Parallel.copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from joblib import Parallel [as 别名]
# 或者: from joblib.Parallel import copy [as 别名]
	def __init__(self):
		global transport 

		variables = ['zonal_transport','meridional_transport','psi']
		num_cores = 6

		data = np.ones((len(variables),len(scow.months),scow.latitude.shape[0],scow.longitude.shape[0]))*np.nan

		f = c.f.repeat(scow.longitude.shape[0]).reshape((c.f.shape[0],scow.longitude.shape[0]))

		for i in xrange(scow.data.shape[1]):
			zonal_transport = scow.data[1,i,:,:]/(f*c.rho)
			meridional_transport = -scow.data[0,i,:,:]/(f*c.rho)

			transport = meridional_transport.copy()

			psi = Parallel(n_jobs=num_cores)(delayed(integration)(lat) for lat in scow.latitude)
			psi = np.array(psi)

			D = np.array([zonal_transport.copy()/1.e+6,meridional_transport.copy()/1.e+6,psi.copy()/1.e+6])
			data[:,i,:,:] = D			

		del transport

		# "Isolating" the subtropical gyre 
		ibad = (np.abs(scow.latitude) <= 5) | (np.abs(scow.latitude) >= 50)
		data[:,:,ibad,:] = np.nan

		self.latitude = scow.latitude
		self.longitude = scow.longitude
		self.variables = variables
		self.data = data
开发者ID:tiagobilo,项目名称:tiagobilo.github.io,代码行数:34,代码来源:compute_ekman_sverdrup_circulation.py

示例2: abs

# 需要导入模块: from joblib import Parallel [as 别名]
# 或者: from joblib.Parallel import copy [as 别名]
    # Now lets try and work out how many unique events we have just to compare
    # with the GeoNet catalog of 20 events on this day in this sequence
    for master in detections:
        keep = True
        for slave in detections:
            if not master == slave and\
               abs(master.detect_time - slave.detect_time) <= 6.0:
                # If the events are within 6s of each other then test which
                # was the 'best' match, strongest detection
                if not master.detect_val > slave.detect_val:
                    keep = False
                    break
        if keep:
            unique_detections.append(master)

print('We made a total of ' + str(len(unique_detections)) + ' detections')

for detection in unique_detections:
    print('Detection at :' + str(detection.detect_time) + ' for template ' +
          detection.template_name + ' with a cross-correlation sum of: ' +
          str(detection.detect_val))
    # We can plot these too
    stplot = st.copy()
    template = templates[template_names.index(detection.template_name)]
    lags = sorted([tr.stats.starttime for tr in template])
    maxlag = lags[-1] - lags[0]
    stplot.trim(starttime=detection.detect_time - 10,
                endtime=detection.detect_time + maxlag + 10)
    plotting.detection_multiplot(stplot, template,
                                 [detection.detect_time.datetime])
开发者ID:kstaniek,项目名称:EQcorrscan,代码行数:32,代码来源:match_filter.py


注:本文中的joblib.Parallel.copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。