Source code for libpyhat.derived.m3.m3_funcs

import numpy as np

from libpyhat.IO.cube_to_df import df_parameter_to_2d
from libpyhat.derived.utils import reflectance, continuum_reflectance


[docs] def warn_m3(param_name): print( "Parameters involving some of the visible wavelengths ( < 600 nm) " "are not recommended for use. " "Parameters modeled after Clementine data are also not recommended. " "Original parameter estimates" " for OH and H2O should NOT be included." ) print( "This parameter (" + str(param_name) + ") has been disabled. " "If you must use it, " "you will need to edit the " "PyHAT code." ) return
[docs] def warn_m3_noisy(param_name): print("Warning: This parameter (" + str(param_name) + ") may be noisy!") return
[docs] def warn_m3_slow(param_name): print( "Warning: This parameter (" + str(param_name) + ") is not well optimized and may take a long time to " "run!" ) return
# Generic Function for all BDXXX formulas
[docs] def bd_func(data, wvls): r_low = reflectance(data, wvls[0], kernel=1) r_mid = reflectance(data, wvls[1], kernel=1) r_high = reflectance(data, wvls[2], kernel=1) denominator = ((r_high - r_low) / (wvls[2] - wvls[0])) * (wvls[1] - wvls[0]) + r_low return 1 - r_mid / denominator
[docs] def oneum_continuum(data, x): # Gets the 1 um continuum reflectance value (rc) at # a specified wvl (x) rc = continuum_reflectance(data, x, 699, 1579) return rc
[docs] def twoum_continuum(data, x): # Gets the 2 um continuum reflectance value (rc) at # a specified wvl (x) rc = continuum_reflectance(data, x, 1578, 2538) return rc
[docs] def mustard(data): from libpyhat.derived.m3.m3_algs import bdi1000, bdi2000, r2780 """ Name: Visualization from Mustard et al. 2011 Parameter:1.58um reflectance, 1um integrated band depth, 2um integrated band depth Formulation: Red: 1um band depth, Blue: 2um Band Depth, Green: 1.58um reflectance Rationale: Bands: From: JGR Mustard et al. 2011 Why: Visualization of surface compositional units. Parameters ---------- data : PyHAT SpectralData object Returns ------- : ndarray the processed ndarray """ data = bdi1000(data) data = bdi2000(data) data = r2780(data) r = df_parameter_to_2d(data, "BDI1000") g = df_parameter_to_2d(data, "BDI2000") b = df_parameter_to_2d(data, "R2780") out = np.empty((r.shape[0], r.shape[1], 3)) out[:, :, 0] = r out[:, :, 1] = g out[:, :, 2] = b return out