OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
MDN.benchmarks.utils Namespace Reference

Classes

class  GlobalRandomManager
 
class  Optimizer
 

Functions

def loadtxt (filename, delimiter=',')
 
def find_wavelength (k, waves, validate=True, tol=5, squeeze=False)
 
def closest_wavelength (k, waves, validate=True, tol=5, squeeze=False)
 
def has_band (w, waves, tol=5)
 
def to_rrs (Rrs)
 
def to_Rrs (rrs)
 
def get_required (Rrs, waves, required=[], tol=5, squeeze=False)
 
def get_benchmark_models (products, allow_opt=False, debug=False, method=None)
 
def optimize (opt_vars, has_default=True)
 
def set_outputs (output_keys)
 

Function Documentation

◆ closest_wavelength()

def MDN.benchmarks.utils.closest_wavelength (   k,
  waves,
  validate = True,
  tol = 5,
  squeeze = False 
)
Value of closest wavelength 

Definition at line 24 of file utils.py.

◆ find_wavelength()

def MDN.benchmarks.utils.find_wavelength (   k,
  waves,
  validate = True,
  tol = 5,
  squeeze = False 
)
Index of closest wavelength 

Definition at line 15 of file utils.py.

◆ get_benchmark_models()

def MDN.benchmarks.utils.get_benchmark_models (   products,
  allow_opt = False,
  debug = False,
  method = None 
)
Return all benchmark models within the product directory, as well as those
within the 'multiple' directory. Note that this means some models returned 
will not be applicable to the given product(s), and will need to be filtered.
If allow_opt=True, models requiring optimization will also be returned.


Definition at line 63 of file utils.py.

◆ get_required()

def MDN.benchmarks.utils.get_required (   Rrs,
  waves,
  required = [],
  tol = 5,
  squeeze = False 
)
Checks that all required wavelengths are available in the given data. 
Returns an object which acts as a functional interface into the Rrs data,
allowing a wavelength or set of wavelengths to be returned:
    Rrs = get_required(Rrs, ...)
    Rrs(443)        # Returns a matrix containing the band data closest to 443nm (shape [N, 1])
    Rrs([440, 740]) # Returns a matrix containing the band data closest to 440nm, and to 740nm (shape [N, 2])


Definition at line 45 of file utils.py.

◆ has_band()

def MDN.benchmarks.utils.has_band (   w,
  waves,
  tol = 5 
)
Ensure band exists within <tol> nm 

Definition at line 30 of file utils.py.

◆ loadtxt()

def MDN.benchmarks.utils.loadtxt (   filename,
  delimiter = ',' 
)

Definition at line 9 of file utils.py.

◆ optimize()

def MDN.benchmarks.utils.optimize (   opt_vars,
  has_default = True 
)
Can automatically optimize a function 
    with a given set of variables, using the
    first set of data given. Then, return the 
    optimized function as partially defined, using
    the optimal parameters

Definition at line 151 of file utils.py.

◆ set_outputs()

def MDN.benchmarks.utils.set_outputs (   output_keys)
All models within the 'multiple' folder should be decorated with this, 
    as the model output should be a dictionary. This decorator takes as input
    a list of products (the keys within the output dict) and makes them 
    available to check, without needing to run the model beforehand. As well,
    models can take 'product' as a keyword argument, and will then return only
    that product. 

Definition at line 164 of file utils.py.

◆ to_rrs()

def MDN.benchmarks.utils.to_rrs (   Rrs)
Conversion to subsurface reflectance (Lee et al. 2002) 

Definition at line 35 of file utils.py.

◆ to_Rrs()

def MDN.benchmarks.utils.to_Rrs (   rrs)
Inverse of to_rrs - conversion from subsurface to remote sensing reflectance 

Definition at line 40 of file utils.py.