Beispiel #1
0
def load_horizon_array(array, loca = None):                                                                                                                     
    if   loca:     place = th.location(loca)
    else:          place = th.location('default')
    #place = s.location('akb')
    gamma = np.deg2rad(np.array([v[0] for v in array]))
    alpha = np.deg2rad(np.array([v[1] for v in array]))
    return horizon(gamma,alpha,place)
Beispiel #2
0
def load_horizon_array(array, loca=None):
    if loca: place = th.location(loca)
    else: place = th.location('default')
    #place = s.location('akb')
    gamma = np.deg2rad(np.array([v[0] for v in array]))
    alpha = np.deg2rad(np.array([v[1] for v in array]))
    return horizon(gamma, alpha, place)
Beispiel #3
0
def load_horizon(fname,loca):
    '''Open SolarShading app's csv output, and returns horizon data arrays'''
    fin   = open(fname,'r')
    h     = np.array(fin.readline().rstrip(',\n').split(','),dtype=float) # header line
    gamma = np.deg2rad(np.array(fin.readline().rstrip(',\n').split(','),dtype=float)) # azimuth angle [deg]
    alpha = np.deg2rad(np.array(fin.readline().rstrip(',\n').split(','),dtype=float)) # altitude angle [deg]
    pname = re.sub('\..+','',fname)
    if   loca:     place = th.location(loca)
    elif len(h)>3: # for android .csv files.
        place = s.location('default',h[0],-h[1],h[2])
        #gamma = gamma - pi
    else:          place = th.location('default')
    fin.close()
    return horizon(gamma,alpha,place) #place, hor
Beispiel #4
0
def load_horizon(fname, loca):
    """Open SolarShading app's csv output, and returns horizon data arrays"""
    fin = open(fname, "r")
    h = np.array(fin.readline().rstrip(",\n").split(","), dtype=float)  # header line
    gamma = np.deg2rad(np.array(fin.readline().rstrip(",\n").split(","), dtype=float))  # azimuth angle [deg]
    alpha = np.deg2rad(np.array(fin.readline().rstrip(",\n").split(","), dtype=float))  # altitude angle [deg]
    pname = re.sub("\..+", "", fname)
    if loca:
        place = th.location(loca)
    elif len(h) > 3:  # for android .csv files.
        place = s.location("default", h[0], -h[1], h[2])
        # gamma = gamma - pi
    else:
        place = th.location("default")
    fin.close()
    return horizon(gamma, alpha, place)  # place, hor
Beispiel #5
0
def load_horizon(fname, loca):
    '''Open SolarShading app's csv output, and returns horizon data arrays'''
    fin = open(fname, 'r')
    h = np.array(fin.readline().rstrip(',\n').split(','),
                 dtype=float)  # header line
    gamma = np.deg2rad(
        np.array(fin.readline().rstrip(',\n').split(','),
                 dtype=float))  # azimuth angle [deg]
    alpha = np.deg2rad(
        np.array(fin.readline().rstrip(',\n').split(','),
                 dtype=float))  # altitude angle [deg]
    pname = re.sub('\..+', '', fname)
    if loca: place = th.location(loca)
    elif len(h) > 3:  # for android .csv files.
        place = s.location('default', h[0], -h[1], h[2])
        #gamma = gamma - pi
    else:
        place = th.location('default')
    fin.close()
    return horizon(gamma, alpha, place)  #place, hor
Beispiel #6
0
    C = th.collectorArray(th.chuanghui_H50(), 1, slope=20, azimuth=0, DFR=True, rho_g=0.2)  # Change
    C.beta = 0  # Calculations for horizontal radiation

    gamma = gamma - pi  # S = 0 deg for solar calculations & plotting
    r = 90 - np.rad2deg(alpha)  # r in degrees
    fig = plt.figure(1)
    ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
    plot_sunpath(ax, L, C)
    plot_horizon(ax, gamma, r)
    fig.savefig("test.png")
    return fig


if __name__ == "__main__":
    args = get_args()
    L = th.location()  # Default location for starters
    C = th.collectorArray(th.chuanghui_H50(), 1, slope=20, azimuth=0, DFR=True, rho_g=0.2)  # Change
    # C     = s.collector('akb1')             # Collector object from solarfun.py
    C.beta = 0  # Calculations for horizontal radiation
    plt.ion()

    fig = plt.figure(1)
    if args.image:
        axi = fig.add_axes([0.1, 0.1, 0.8, 0.8], frame_on=False)
        axi = make_invisible(axi)
        pic = plt.imread(args.image)
        axi.imshow(pic)
    ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
    ax.patch.set_alpha(0)
    if args.horizon:
        H = load_horizon(args.horizon, args.location)  # Horizon data object from .csv file
Beispiel #7
0
                          rho_g=0.2)  # Change
    C.beta = 0  # Calculations for horizontal radiation

    gamma = gamma - pi  # S = 0 deg for solar calculations & plotting
    r = 90 - np.rad2deg(alpha)  # r in degrees
    fig = plt.figure(1)
    ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
    plot_sunpath(ax, L, C)
    plot_horizon(ax, gamma, r)
    fig.savefig('test.png')
    return fig


if __name__ == "__main__":
    args = get_args()
    L = th.location()  # Default location for starters
    C = th.collectorArray(th.chuanghui_H50(),
                          1,
                          slope=20,
                          azimuth=0,
                          DFR=True,
                          rho_g=0.2)  # Change
    #C     = s.collector('akb1')             # Collector object from solarfun.py
    C.beta = 0  # Calculations for horizontal radiation
    plt.ion()

    fig = plt.figure(1)
    if args.image:
        axi = fig.add_axes([0.1, 0.1, 0.8, 0.8], frame_on=False)
        axi = make_invisible(axi)
        pic = plt.imread(args.image)