예제 #1
0
def getzenithangle(declination, latitude, hourlyangle):
	result = None
	if cuda_can_help:
		func = mod_getzenitangle.get_function("getzenitangle")
		result = gpu._gpu_exec(func, hourlyangle, latitude, declination)
	else:
		hourlyangle = np.deg2rad(hourlyangle)
		lat = np.deg2rad(latitude)
		dec = np.deg2rad(declination)
		# TODO: Evaluate this situation. Shapes: dec:(252) ; lat:(242,384)
		result = np.rad2deg(np.arccos(np.sin(dec) * np.sin(lat) + np.cos(dec) * np.cos(lat) * np.cos(hourlyangle)))
	return result
예제 #2
0
def getdeclination(gamma):
	result = None
	if cuda_can_help:
		func = mod_getdeclination.get_function("getdeclination")
		#sh = gamma.shape
		#print "\n",
		#for i in range(sh[0]):
		#	print "\r--->" + str(i).zfill(3) + "/" + str(sh[0]-1).zfill(3),
		result = gpu._gpu_exec(func, gamma)
	else:
		gamma = np.deg2rad(gamma)
		result = np.rad2deg(0.006918 - 0.399912 * np.cos(gamma) + 0.070257 * np.sin(gamma) - 0.006758 * np.cos(2 * gamma) + 0.000907 * np.sin(2 * gamma) - 0.002697 * np.cos(3 * gamma) + 0.00148 * np.sin(3 * gamma))
	return result
예제 #3
0
def getexcentricity(gamma):
	result = None
	if cuda_can_help:
		func = mod_getexcentricity.get_function("getexcentricity")
		sh = gamma.shape
		show("")
		for i in range(sh[0]):
			show("\r--->" + str(i).zfill(3) + "/" + str(sh[0]-1).zfill(3))
			gamma[i] = gpu._gpu_exec(func, gamma[i])
		result = gamma
	else:
		gamma = np.deg2rad(gamma)
		result = 1.000110 + 0.034221 * np.cos(gamma) + 0.001280 * np.sin(gamma) + 0.000719 * np.cos(2 * gamma) + 0.000077 * np.sin(2 * gamma)
	return result
예제 #4
0
def getalbedo(radiance, totalirradiance, excentricity, zenitangle):
	result = None
	if cuda_can_help:
		func = mod_getalbedo.get_function("getalbedo")
		sh = radiance.shape
		show("")
		for i in range(sh[0]):
			show("\r--->" + str(i).zfill(3) + "/" + str(sh[0]).zfill(3))
			radiance[i] = gpu._gpu_exec(func, radiance[i], totalirradiance, excentricity[i], zenitangle[i])
		result = radiance
	else:
		zenitangle = np.deg2rad(zenitangle)
		result = (np.pi * radiance)/(totalirradiance * excentricity * np.cos(zenitangle))
	return result
예제 #5
0
def getsatellitalzenithangle(lat, lon, sub_lon):
	result = None
	rpol = 6356.5838
	req = 6378.1690
	h = 42164.0
	if cuda_can_help:
		func = mod_getsatellitalzenithangle.get_function("getsatellitalzenithangle")
		lat = gpu._gpu_exec(func, lat, lon, sub_lon, rpol, req, h)
		result = lat
	else:
		lat = np.deg2rad(lat)
		lon_diff = np.deg2rad(lon - sub_lon)
		lat_cos_only = np.cos(lat)
		re = rpol /(np.sqrt(1-(req**2 - rpol**2)/(req**2)*np.power(lat_cos_only,2)))
		lat_cos = re * lat_cos_only
		r1 = h - lat_cos * np.cos(lon_diff)
		r2 = - lat_cos * np.sin(lon_diff)
		r3 = re * np.sin(lat)
		rs = np.sqrt(r1**2 + r2**2 + r3**2)
		result = np.rad2deg(np.pi - np.arccos((h**2 - re**2 - rs**2)/(-2 * re * rs)))
	return result