Exemple #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)
    with open(fname,'w') as f:
        f.write('# Start: {1}, dt: {0} s, Intensities in J/(dt*m**2)\n'.format(dt.seconds,start.isoformat()))
        np.savetxt(f, data.T)
        
# location setup
mspicer = MarsSpicer()
mspicer.set_spoint_by(lat=85,lon=0)

# timing setup
mspicer.goto_ls_0()
mspicer.time -= dt.timedelta(days=10,hours=12)

# dt, the time step
my_dt = dt.timedelta(hours=1)

# saving for restart later
start_time = mspicer.time
    
out_flat = create_arrays(mspicer, 50, my_dt)
save_data_to_file(out_flat[1], 'insolation_flat.txt', start_time, my_dt)

mspicer.get_tilted_normal(30)
mspicer.rotate_tnormal(180)

mspicer.time = start_time
out_ta = create_trnormal_arrays(mspicer, 50, my_dt)
save_data_to_file(out_ta[1], 'insolation_t30_a180.txt', start_time, my_dt)

# print(np.divide(out_ta[1],out_flat[1]))
# semilogy(np.divide(out_ta[1],out_flat[1]),'-*')
# show()
Exemple #3
0
start_time = mspice.time

# container for all energy arrays
energies = []

# labels for the plotting
labels = []

aspects = np.arange(0,180,5)
tilts = [5,30]
img = np.zeros((len(aspects), 36, 2))

for i,tilt in enumerate(tilts):
    mspice.get_tilted_normal(tilt)
    for j,aspect in enumerate(aspects):
        mspice.time = start_time
        print('aspect = {0}'.format(aspect))
        mspice.rotate_tnormal(aspect+15) # go to middle of aspect block
        bigtimes, energy = outer_loop(mspice, end_ls, ls_res, 'trnormal')
        energies.append(energy)
        labels.append('t'+str(tilt)+'_a'+str(aspect))
        img[j,:,i] = energy


img[ img < 1 ] = np.nan
img5 = img[:,:,0]
img30 = img[:,:,1]
images = [img5,img30]
palette = cm.jet
palette.set_bad('gray')
fig, axes = subplots(2,1,sharex=True, sharey=True)