ReFRACtor
aerosol.py
Go to the documentation of this file.
1 
2 import os
3 
4 import numpy as np
5 
6 from .base import Creator, ParamPassThru
7 from .value import CreatorFlaggedValue
8 from .. import param
9 
10 from refractor import framework as rf
11 
13  "Defines the interface expected for aerosol config defnition blocks, values are pass through as a dictionary"
14 
15  extinction = param.InstanceOf(rf.AerosolExtinction)
16  properties = param.InstanceOf(rf.AerosolProperty)
17 
19  "Creates an AbsorberAbsco object that statisfies the AtmosphereCreato;rs absorber value"
20 
21  aerosols = param.Iterable()
22  pressure = param.InstanceOf(rf.Pressure)
23  relative_humidity = param.InstanceOf(rf.RelativeHumidity)
24  reference_wn = param.Scalar(int, default=1e4/0.755)
25 
26  def create(self, **kwargs):
27 
28  vec_extinction = rf.vector_aerosol_extinction()
29  vec_properties = rf.vector_aerosol_property()
30 
31  for aerosol_name in self.aerosols():
32  self.register_parameter(aerosol_name, param.Dict())
33  aerosol_def = self.param(aerosol_name, aerosol_name=aerosol_name)
34 
35  if not "extinction" in aerosol_def:
36  raise param.ParamError("exitinction value not in aerosol definition for aerosol: %s" % aerosol_name)
37 
38  if not "properties" in aerosol_def:
39  raise param.ParamError("peroperties value not in aerosol definition for aerosol: %s" % aerosol_name)
40 
41  vec_extinction.push_back(aerosol_def['extinction'])
42  vec_properties.push_back(aerosol_def['properties'])
43 
44  return rf.AerosolOptical(vec_extinction, vec_properties, self.pressure(), self.relative_humidity(), self.reference_wn())
45 
46 
48 
49  pressure = param.InstanceOf(rf.Pressure)
50  log_space = param.Scalar(bool, default=True)
51 
52  def create(self, aerosol_name=None, **kwargs):
53 
54  if aerosol_name is None:
55  raise param.ParamError("aerosol_name not supplied to creator")
56 
57  return rf.AerosolShapeGaussian(self.pressure(), self.retrieval_flag(), self.value(), aerosol_name, not self.log_space())
58 
60 
61  pressure = param.InstanceOf(rf.Pressure)
62  filename = param.Scalar(str)
63  prop_name = param.Scalar(str, required=False)
64 
65  def create(self, aerosol_name=None, **kwargs):
66 
67  aerosol_file = rf.HdfFile(self.filename())
68 
69  if self.prop_name() is None:
70  prop_name = aerosol_name
71  else:
72  prop_name = self.prop_name()
73 
74  return rf.AerosolPropertyHdf(aerosol_file, prop_name + "/Properties", self.pressure())
def register_parameter(self, param_name, param_def)
Definition: base.py:95
def create(self, aerosol_name=None, kwargs)
Definition: aerosol.py:65
def param(self, param_name, kwargs)
Definition: base.py:111
def create(self, aerosol_name=None, kwargs)
Definition: aerosol.py:52

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