ReFRACtor
solar_model.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  doppler = param.Iterable(rf.SolarDopplerShift)
11  absorption = param.Iterable(rf.SolarAbsorptionSpectrum)
12  continuum = param.Iterable(rf.SolarContinuumSpectrum)
13 
14  def create(self, **kwargs):
15 
16  solar = []
17  for doppler, absorption, continuum in zip(self.doppler(), self.absorption(), self.continuum()):
18  solar.append( rf.SolarAbsorptionAndContinuum(doppler, absorption, continuum) )
19  return solar
20 
22 
23  time = param.Iterable(rf.Time)
24  latitude = param.ArrayWithUnit(dims=1)
25  solar_zenith = param.ArrayWithUnit(dims=1)
26  solar_azimuth = param.ArrayWithUnit(dims=1)
27  surface_height = param.ArrayWithUnit(dims=1)
28  constants = param.InstanceOf(rf.Constant)
29  num_channels = param.Scalar(int)
30 
31  def create(self, **kwargs):
32 
33  do_doppler_shift = True
34 
35  doppler_shift = []
36  for chan_index in range(self.num_channels()):
37  doppler_shift.append( rf.SolarDopplerShiftPolynomial(self.time()[chan_index],
38  self.latitude()[chan_index],
39  self.solar_zenith()[chan_index],
40  self.solar_azimuth()[chan_index],
41  self.surface_height()[chan_index],
42  self.constants(),
43  do_doppler_shift) )
44  return doppler_shift
45 
47 
48  solar_data_file = param.Scalar(str)
49  num_channels = param.Scalar(int)
50 
51  def create(self, **kwargs):
52  solar_file = rf.HdfFile(self.solar_data_file())
53 
54  absorption = []
55  for chan_index in range(self.num_channels()):
56  absorption.append( rf.SolarAbsorptionTable(solar_file, "/Solar/Absorption/Absorption_%d" % (chan_index + 1)) )
57  return absorption
58 
60 
61  solar_data_file = param.Scalar(str)
62  convert_from_photon = param.Scalar(bool, default=False)
63  num_channels = param.Scalar(int)
64 
65  def create(self, **kwargs):
66  solar_file = rf.HdfFile(self.solar_data_file())
67 
68  continuum = []
69  for chan_index in range(self.num_channels()):
70  continuum.append( rf.SolarContinuumTable(solar_file, "/Solar/Continuum/Continuum_%d" % (chan_index + 1),
71  self.convert_from_photon()) )
72  return continuum

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