Ejemplo n.º 1
0
def main():
     # default time is now:
    mspice = MarsSpicer()

    # set up location
    mspice.set_spoint_by(lat=85, lon = 0)

    # set up starting time of analysis, l_s = 0
    mspice.utc = '2011-09-13T14:24:33.733548'

    # mspice.time += dt.timedelta(30)
    # ls1 = mspice.l_s
    # utc1 = mspice.utc
    # mspice.time += dt.timedelta(1)
    # ls2 = mspice.l_s
    # mspice.utc = utc1
    
    # stopping l_s value
    end_ls = 360

    # l_s resolution
    # ls_res = 0.02
    ls_res = 5.0

    # time resolution
    time_res = 3600
    
    # save this time for multiple runs for resetting mspice each time
    start_time = mspice.time

    # container for all energy arrays
    energies = []

    # labels for the plotting
    labels = []

    # tilt the surface normal by 30 degree to the north (north = default)
    # this creates an instance variable called 'tnormal'
    mspice.tilt = 30

    # first time, save the bigtimes array
    bigtimes, energies_t30 = outer_loop(mspice, end_ls, ls_res, 'tilted_normal',time_res=time_res)
    energies.append(energies_t30)
    labels.append('t30')

    # rotate the tilted vector around the local surface normal to create an aspect 
    # angle
    # this creates an instance variable called 'trnormal'
    mspice.aspect = 90

    mspice.time = start_time
    energies.append(outer_loop(mspice, end_ls, ls_res, 'tilted_rotated_normal',time_res=time_res)[1])
    labels.append('t30_a90')

    mspice.time = start_time
    energies.append(outer_loop(mspice, end_ls, ls_res, 'snormal',time_res=time_res)[1])
    labels.append('flat')


    mspice.aspect = 180
    mspice.time = start_time
    energies.append(outer_loop(mspice, end_ls, ls_res, 'tilted_rotated_normal',time_res=time_res)[1])
    labels.append('t30,a180')

    fig = figure()
    ax = fig.add_subplot(111)
    grid()
    for energy,label in zip(energies,labels):
        ax.plot(bigtimes,energy, '-*', label=label)
    ax.set_xlabel('L_s [deg]')
    ax.set_ylabel('Insolation per 10 L_s [MJ]')
    ax.set_title('Insolation of t_ilted and a_spected (rotated) surfaces at 85 N')
    ax.legend(loc='best')
    show()
    return (energies, labels)
Ejemplo n.º 2
0
emissions = []
incidences = []
rev_srfvec = spice.vminus(mspice.srfvec)
for sample in xrange(phase.shape[0]):
    if sample % 10 == 0:
        print('Sample {0}'.format(sample))
    for line in xrange(phase.shape[1]):
        slope = float(slopes.data[sample, line])
        aspect = float(aspects.data[sample, line])
        # newPoint = Point(sample, line)
        # newPoint.pixel_to_lonlat(dem.geotransform, dem.projection)
        # mspice.set_spoint_by(lat = newPoint.lat, lon = newPoint.lon)

        mspice.tilt = slope
        mspice.aspect = aspect
        trnormal = mspice.tilted_rotated_normal
        incidence = spice.vsep(trnormal, mspice.sun_direction)
        emission = spice.vsep(trnormal, rev_srfvec)
        emissions.append(emission)
        incidences.append(incidence)
        
        # print("Inc: %f" % incidence)
        # print("Emis: %f" % emission)
        
        # phase[sample,line] = 

emissions = np.degrees(np.array(emissions))
incidences = np.degrees(np.array(incidences))

plt.hist(emissions, 90, label = 'emissions')