Example #1
0
r_max = 10

# refractive index
m = "1.54 0.002"
m = ("1.54 0.000", "1.56 0.01")

nonabs_fraction = 0.5
nonabs_fraction = 0.

shape = "spheroid oblate 1.7"
shape = "spheroid oblate 1.8"

num_theta = 2

results = mopsmap_python_interface.call_mopsmap(wvl, size_equ, n, r_mod, sigma,
                                                r_min, r_max, m,
                                                nonabs_fraction, shape,
                                                num_theta)

print '*** wavelength-independent parameters ***'
print '  effective radius:         %8.4f µm' % (np.mean(results['r_eff']))
print '  number concentration:       %8.4e m^-3' % (np.mean(results['n']))
print '  cross section density:      %8.4e m^-1' % (np.mean(results['a']))
print '  volume density:             %8.4e ' % (np.mean(results['v']))
print '  mass concentration:         %8.4e g m^-3' % (np.mean(results['m']))

for i_wvl in range(len(results['wvl'])):
    if i_wvl > 0:
        print
        print '*** wavelength range from %8.4f µm to %8.4f µm ***' % (
            results['wvl'][i_wvl - 1], results['wvl'][i_wvl])
        print '  extinction angstrom:      %8.4f' % results['ext_angstrom'][
Example #2
0
r_min=0.001
r_max=5.0

m='file refr_mineral'
nonabs_fraction=0.5

num_theta=1801

# do the mopsmap calculations
results_sphere=np.zeros((len(wvl),len(r_mod),num_theta))
results_spheroid=np.zeros((len(wvl),len(r_mod),num_theta))

for i_rmod in range(len(r_mod)):
    
  shape='sphere'
  output = mopsmap_python_interface.call_mopsmap(wvl,size_equ,n,r_mod[i_rmod],sigma,r_min,r_max,m,nonabs_fraction,shape,num_theta)
  results_sphere[:,i_rmod,:]=output['a1'][:,:]

  shape='spheroid distr_file ar_kandler'
  output = mopsmap_python_interface.call_mopsmap(wvl,size_equ,n,r_mod[i_rmod],sigma,r_min,r_max,m,nonabs_fraction,shape,num_theta)
  results_spheroid[:,i_rmod,:]=output['a1'][:,:]

# do the angular integration
angle_degr=output['angle']
angle_rad=angle_degr*np.pi/180.0

weight_ts_ideal=np.zeros(angle_rad.shape[0])
weight_ts_para=np.zeros(angle_rad.shape[0])
weight_bs_ideal=np.zeros(angle_rad.shape[0])
weight_bs_para=np.zeros(angle_rad.shape[0])
Example #3
0
n = 1

input_ref = {}
input_ref['r_mod'] = 0.1
input_ref['sigma'] = 2.6
input_ref['r_min'] = 0.001
input_ref['r_max'] = 20
input_ref['mr'] = 1.53
input_ref['mi'] = 0.0063
input_ref['nonabs_fraction'] = 0
input_ref['ar'] = 2.0

# do reference calculation
input = input_ref.copy()
results_ref = mopsmap_python_interface.call_mopsmap(
    wvl, size_equ, n, input['r_mod'], input['sigma'], input['r_min'],
    input['r_max'], '%f %f' % (input['mr'], input['mi']),
    input['nonabs_fraction'], 'spheroid prolate %f' % input['ar'], num_theta)

print '   d ext    |   d SSA    |   d g      | d back_coef|   d S      |  d delta_l |   d n      |    d a     |   d v      |   value     | lower value| upper_value|  parameter'
print '%12.5e %12.5e %12.5e %12.5e %12.5e %12.5e %12.5e %12.5e %12.5e|     ---          ---          ---     | ref_value ' % (
    results_ref['ext_coeff'][0], results_ref['ssa'][0], results_ref['g'][0],
    results_ref['back_coeff'][0], results_ref['S'][0],
    results_ref['delta_l'][0], results_ref['n'][0], results_ref['a'][0],
    results_ref['v'][0])

# perturb each parameter and calculate Jacobians
for key in sorted(input_ref):

    # but do not consider parameter which were set to zero
    if input[key] > 0:
shape_tmp.append(shape[0])

for i_d in range(len(d_bins)):
    for i_mi in range(len(mi_dist[i_d])):
        for i_mode in range(1, len(n)):
            n_tmp.append(n[i_mode] * mi_dist[i_d][i_mi])
            r_mod_tmp.append(r_mod[i_mode])
            sigma_tmp.append(sigma[i_mode])
            r_min_tmp.append(d_bins[i_d][0] * 0.5)
            r_max_tmp.append(d_bins[i_d][1] * 0.5)
            m_tmp.append('1.53 %f' % (0.5 *
                                      (mi_bins[i_mi][0] + mi_bins[i_mi][1])))
            shape_tmp.append(shape[1])

result_accurate = mopsmap_python_interface.call_mopsmap(
    wvl, size_equ, n_tmp, r_mod_tmp, sigma_tmp, r_min_tmp, r_max_tmp, m_tmp,
    nonabs_fraction, shape_tmp, num_theta)

# do calculation with average mi
nonabs_fraction = 0
m_tmp = []
m_tmp.append('1.53 0.005')
for i in range(3):
    m_tmp.append('1.53 %f' % mi_avg)
r_min = d_bins[0][0] * 0.5
r_max = d_bins[-1][1] * 0.5
result_average = mopsmap_python_interface.call_mopsmap(wvl, size_equ, n, r_mod,
                                                       sigma, r_min, r_max,
                                                       m_tmp, nonabs_fraction,
                                                       shape, num_theta)