ReFRACtor
rt.py
Go to the documentation of this file.
1 import numpy as np
2 
3 from .base import Creator
4 from .. import param
5 
6 from refractor import framework as rf
7 
9 
10  atmosphere = param.InstanceOf(rf.RtAtmosphere)
11  stokes_coefficient = param.Array(dims=2)
12  solar_zenith = param.ArrayWithUnit(dims=1)
13  observation_zenith = param.ArrayWithUnit(dims=1)
14  observation_azimuth = param.ArrayWithUnit(dims=1)
15 
16  num_streams = param.Scalar(int)
17  num_mom = param.Scalar(int)
18 
19  pure_nadir = param.Scalar(bool, default=False)
20  multiple_scattering_only = param.Scalar(bool, default=False)
21 
22  use_solar_sources = param.Scalar(bool, default=True)
23  use_thermal_emission = param.Scalar(bool, default=False)
24 
25  def create(self, **kwargs):
26  stokes_object = rf.StokesCoefficientConstant(self.stokes_coefficient())
27 
28  return rf.LidortRt(self.atmosphere(), stokes_object,
29  self.solar_zenith().convert("deg").value,
30  self.observation_zenith().convert("deg").value,
31  self.observation_azimuth().convert("deg").value,
32  self.pure_nadir(), self.num_streams(), self.num_mom(), self.multiple_scattering_only(),
34 
36 
37  atmosphere = param.InstanceOf(rf.RtAtmosphere)
38  stokes_coefficient = param.Array(dims=2)
39  solar_zenith = param.ArrayWithUnit(dims=1)
40  observation_zenith = param.ArrayWithUnit(dims=1)
41  observation_azimuth = param.ArrayWithUnit(dims=1)
42 
43  full_quadrature = param.Scalar(bool, default=True)
44 
45  use_solar_sources = param.Scalar(bool, default=True)
46  use_thermal_emission = param.Scalar(bool, default=False)
47 
48  def create(self, **kwargs):
49  stokes_object = rf.StokesCoefficientConstant(self.stokes_coefficient())
50 
51  return rf.TwostreamRt(self.atmosphere(), stokes_object,
52  self.solar_zenith().convert("deg").value,
53  self.observation_zenith().convert("deg").value,
54  self.observation_azimuth().convert("deg").value,
55  self.full_quadrature(),
57 
58 class LsiRt(Creator):
59 
60  atmosphere = param.InstanceOf(rf.RtAtmosphere)
61  stokes_coefficient = param.Array(dims=2)
62  solar_zenith = param.ArrayWithUnit(dims=1)
63  observation_zenith = param.ArrayWithUnit(dims=1)
64  observation_azimuth = param.ArrayWithUnit(dims=1)
65  spec_win = param.InstanceOf(rf.SpectralWindow)
66 
67  lsi_config_file = param.Scalar(str)
68  num_low_streams = param.Scalar(int)
69  num_high_streams = param.Scalar(int)
70 
71  dedicated_twostream = param.Scalar(bool, default=True)
72  pure_nadir = param.Scalar(bool, default=False)
73  full_quadrature = param.Scalar(bool, default=True)
74  use_lrad = param.Scalar(bool, default=True)
75 
76  def create(self, **kwargs):
77  # Just use LIDORT for multiple scattering, when we use LRadRt
78  do_multiple_scattering_only = self.use_lrad()
79 
80  stokes_object = rf.StokesCoefficientConstant(self.stokes_coefficient())
81 
82  # Minimum nmom allowed by LIDORT is 3
83  nmom_low = min(self.num_low_streams() * 2, 3)
84 
85  if(self.num_low_streams() == 1 and self.dedicated_twostream()):
86  rt_low = rf.TwostreamRt(self.atmosphere(), stokes_object,
87  self.solar_zenith().convert("deg").value,
88  self.observation_zenith().convert("deg").value,
89  self.observation_azimuth().convert("deg").value,
90  self.full_quadrature())
91  else:
92  rt_low = rf.LidortRt(self.atmosphere(), stokes_object,
93  self.solar_zenith().convert("deg").value,
94  self.observation_zenith().convert("deg").value,
95  self.observation_azimuth().convert("deg").value,
96  self.pure_nadir(), self.num_low_streams(), nmom_low, do_multiple_scattering_only)
97 
98  lidort_pars = rf.Lidort_Pars.instance()
99  rt_high = rf.LidortRt(self.atmosphere(), stokes_object,
100  self.solar_zenith().convert("deg").value,
101  self.observation_zenith().convert("deg").value,
102  self.observation_azimuth().convert("deg").value,
103  self.pure_nadir(), self.num_high_streams(), lidort_pars.maxmoments_input, do_multiple_scattering_only)
104 
105  spectral_bound = self.spec_win().spectral_bound
106 
107  if self.use_lrad():
108  rt_low = rf.LRadRt(rt_low, spectral_bound,
109  self.solar_zenith().convert("deg").value,
110  self.observation_zenith().convert("deg").value,
111  self.observation_azimuth().convert("deg").value,
112  self.pure_nadir(), True, False)
113 
114  rt_high = rf.LRadRt(rt_high, spectral_bound,
115  self.solar_zenith().convert("deg").value,
116  self.observation_zenith().convert("deg").value,
117  self.observation_azimuth().convert("deg").value,
118  self.pure_nadir(), True, True)
119 
120  rt_high = rf.HresWrapper(rt_high)
121 
122  lsi_config = rf.HdfFile(self.lsi_config_file())
123  return rf.LsiRt(rt_low, rt_high, lsi_config, "LSI")
def create(self, kwargs)
Definition: rt.py:76
def create(self, kwargs)
Definition: rt.py:25
def create(self, kwargs)
Definition: rt.py:48

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:10