import arcpy import math import numpy from arcpy import env from numpy import * pointshape = arcpy.GetParameterAsText (0) # Eingabe des Punkte-Shapefiles raster = arcpy.GetParameterAsText (1) # Eingabe der Rasterdatei (DHM/DEM) solar_azimuth = arcpy.GetParameterAsText (2) # Eingabe des Azimuts der Sonne solar_height = arcpy.GetParameterAsText (3) # Eingabe des Höhenwinkels der Sonne tilt = arcpy.GetParameterAsText (4) # Neigung der Solarmodule output_raster = arcpy.GetParameterAsText (5) def calculate_angles(ET_ANGLE): #Calculating IN-Vector phi_in = math.radians(180 - solar_azimuth) theta_in = math.radians(90 - solar_height) r = 1 x = -(r * math.sin(theta_in) * math.cos(phi_in)) y = -(r * math.sin(theta_in) * math.sin(phi_in)) z = -(r * math.cos(theta_in)) VSonneIn = numpy.matrix([, , ]) # Calculating Module-Vector phi_modul = math.radians(180 - ET_ANGLE) theta_modul = math.radians(tilt) # r = 1 from above u = r * math.sin(theta_modul) * math.cos(phi_modul) v = r * math.sin(theta_modul) * math.sin(phi_modul) w = r * math.cos(theta_modul) # Defining Transformation-Matrix MReflexion = numpy.matrix([[1-2*u*u, -2*u*v, -2*u*w], [-2*u*v, 1-2*v*v, -2*v*w], [-2*u*w, -2*v*w, 1-2*w*w]]) VSonneOut = MReflexion * VSonneIn # Calculating OUT-Angles theta_out = math.degrees(math.acos(VSonneOut[2]/(math.sqrt(VSonneOut[0]*VSonneOut[0]+VSonneOut[1]*VSonneOut[1]+VSonneOut[2]*VSonneOut[2])))) # VERT1 = (90 - theta_out) # return VERT1 if (VSonneOut[0] > 0): phi_out = math.degrees(math.atan(VSonneOut[1]/VSonneOut[0])) elif (VSonneOut[0] == 0): phi_out = math.degrees(numpy.sign(VSonneOut[1])*(math.pi/2)) elif (VSonneOut[1] >= 0): phi_out = math.degrees(math.atan(VSonneOut[1]/VSonneOut[0])+math.pi) else: phi_out = math.degrees(math.atan(VSonneOut[1]/VSonneOut[0])-math.pi) AZIMUTH1 = (180 - phi_out) return AZIMUTH1
calculate_angles(float(!ET_ANGLE!))
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.