from __future__ import division import numpy as np from matplotlib.pyplot import figure, show, cm, grid, subplots from matplotlib.ticker import MultipleLocator from use_mspicer import outer_loop from kmaspice import MarsSpicer # 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' # stopping l_s value end_ls = 360 # l_s resolution ls_res = 10 # 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 = []
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)
# dline = newPoint.line - dem.center.line # plt.quiver(dem.center.sample,dem.center.line,dsample,dline,angles='xy', scale_units='xy', scale=1) # correct aspects for delta angle # it needs to be added, because aspects go clock-wise aspects.data += delta_angle # bend around data > 360 mask = aspects.data > 360.0 aspects.data[mask] = aspects.data[mask] - 360.0 # # create MarsSpicer object mspice = MarsSpicer() utc1 = '2011-05-24T00:58:08.402' utc2 = '2011-05-31T05:01:50.854' mspice.utc = utc2 mspice.obs = 'MRO' mspice.instrument = 'MRO_HIRISE' mspice.set_spoint_by('sincpt') phase = np.zeros_like(dem.data) 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])