Source code for libpyhat.derived.crism.crism_algs

import numpy as np

from libpyhat.derived.crism.crism_funcs import (
    bd_func1,
    bd_func2,
    sh_func,
    rpeak1_func,
    min_2_bands,
    crism_sumutil_bdicont,
)
from libpyhat.derived.utils import reflectance, continuum_reflectance, compute_slope


# REFLECTANCE PARAMETERS


[docs] def r440(data, kernel=5): """ Name: R440 Parameter: 0.44 micron reflectance FORMULATION (with kernels): R440 Rationale: Clouds/Hazes Parameters ---------- data : PyHAT SpectralData object kernel: Window in # of spectral channels around the specified central wvl Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "R440")] = reflectance(data, 440, kernel=kernel) return data
[docs] def r530(data, kernel=5): """ Name: R530 Parameter: 0.53 micron reflectance FORMULATION (with kernels): R530 Rationale: TRU browse product component Parameters ---------- data : PyHAT SpectralData object kernel: Window in # of spectral channels around the specified central wvl Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "R530")] = reflectance(data, 530, kernel=kernel) return data
[docs] def r600(data, kernel=5): """ Name: R600 Parameter: 0.60 micron reflectance FORMULATION (with kernels): R600 Rationale: TRU browse product component Parameters ---------- data : PyHAT SpectralData object kernel: Window in # of spectral channels around the specified central wvl Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "R600")] = reflectance(data, 600, kernel=kernel) return data
[docs] def r770(data, kernel=5): """ Name: R770 Parameter: 0.77micron reflectance Formulation: R770 Rationale: Higher value more dusty or icy Caveats: Sensitive to slope effects, clouds Parameters ---------- data : PyHAT SpectralData object kernel: Window in # of spectral channels around the specified central wvl Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "R770")] = reflectance(data, 770, kernel=kernel) return data
[docs] def r1080(data, kernel=5): """ Name: R1080 Parameter: 1.08 micron reflectance FORMULATION (with kernels): R1080 Rationale: FAL browse product component Parameters ---------- data : PyHAT SpectralData object kernel: Window in # of spectral channels around the specified central wvl Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "R1080")] = reflectance(data, 1080, kernel=kernel) return data
[docs] def r1300(data, kernel=5): """ Name: R1300 Parameter: 1.30 micron reflectance FORMULATION (with kernels): R1300 Rationale: IRA browse product component Parameters ---------- data : PyHAT SpectralData object kernel: Window in # of spectral channels around the specified central wvl Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "R1300")] = reflectance(data, 1300, kernel=kernel) return data
[docs] def r1330(data, kernel=5): """ NAME: R1330 PARAMETER: IR albedo FORMULATION: R1330 RATIONALE: IR albedo (ices > dust > unaltered mafics) Parameters ---------- data : PyHAT SpectralData object kernel: Window in # of spectral channels around the specified central wvl Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "R1330")] = reflectance(data, 1330, kernel=kernel) return data
[docs] def r1506(data, kernel=5): """ Name: R1506 Parameter: 1.51 micron reflectance FORMULATION (with kernels): R1506 Rationale: TRU browse product component Parameters ---------- data : PyHAT SpectralData object kernel: Window in # of spectral channels around the specified central wvl Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "R1506")] = reflectance(data, 1506, kernel=kernel) return data
[docs] def r2529(data, kernel=5): """ Name: R2529 Parameter: 2.53 micron reflectance Formulation: R2529 Rationale: TRU browse product component Parameters ---------- data : PyHAT SpectralData object kernel: Window in # of spectral channels around the specified central wvl Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "R2529")] = reflectance(data, 2529, kernel=kernel) return data
[docs] def r3920(data, kernel=5): """ Name: R3920 Parameter: 3.92 micron reflectance Formulation: R3920 Rationale: IC2 browse product component Parameters ---------- data : PyHAT SpectralData object kernel: Window in # of spectral channels around the specified central wvl Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "R3920")] = reflectance(data, 3920, kernel=kernel) return data
# RATIO PARAMETERS
[docs] def rbr(data, kernel=5): """ Name: RBR Parameter: Red/Blue Ratio Formulation: R770 / R440 Rationale: Higher value indicates more npFeOx Caveats: Sensitive to dust in atmosphere Parameters ---------- data : PyHAT SpectralData object kernel: Window in # of spectral channels around the specified central wvl Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data = r770(data, kernel=kernel) r770_result = data.df[("parameter", "R770")] data = r440(data, kernel=kernel) r440_result = data.df[("parameter", "R440")] rbr_result = r770_result / r440_result data.df["parameter", "RBR"] = rbr_result return data
# BAND DEPTH PARAMETERS
[docs] def bd530_2(data, kernel=(5, 5, 5)): """ NAME: BD530_2 PARAMETER: 0.53 micron band depth FORMULATION: 1 - (R530/(a*R614+b*R440)) RATIONALE: Crystalline ferric minerals Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([440, 530, 614]) data.df[("parameter", "bd530_2")] = bd_func1(data, band_wvls, kernel) return data
[docs] def bd640_2(data, kernel=(5, 5, 5)): """ NAME: BD640 PARAMETER: 0.64 micron band depth FORMULATION (with kernels): 1 - (R624 / (a * R600 + b * R760)) RATIONALE: select ferric minerals, especially maghemite Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([600, 624, 760]) data.df[("parameter", "bd640_2")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd860_2(data, kernel=(5, 5, 5)): """ NAME: BD860 PARAMETER: 0.86 micron band depth FORMULATION (with kernels): 1 - (R860 / (a * R755 + b * R977)) RATIONALE: select ferric minerals ('hematite band') Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([755, 860, 977]) data.df[("parameter", "bd860_2")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd920_2(data, kernel=(5, 5, 5)): """ NAME: BD920 PARAMETER: 0.92 micron band depth FORMULATION (with kernels): 1 - ( R920 / (a * R807 + b * R984) ) RATIONALE: select ferric minerals ('Pseudo BDI1000 VIS') Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([807, 920, 984]) data.df[("parameter", "bd920_2")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd1300(data, kernel=(5, 15, 5)): """" NAME: BD1300 PARAMETER: 1.3 μm absorption associated with Fe2+ substitution in\ plagioclase FORMULATION (with kernels): 1 - ( R1320 / (a * R1080 + b * R1750) ) NOTE: Viviano-Beck et al (2014) list different wavelengths for the kernel widths (1370, 1432, 1470) than for the formulation for this parameter. We use the wavelengths listed in the formulation, as these match more closely with the wavelength in the parameter name. RATIONALE: Plagioclase with Fe2+ substitution Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1080, 1320, 1750]) data.df[("parameter", "bd1300")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd1400(data, kernel=(5, 3, 5)): """ NAME: BD1400 PARAMETER: 1.4 micron H2O and OH band depth FORMULATION: 1 - ( R1395 / (a * R1330 + b * R1467) ) NOTE: Viviano-Beck et al (2014) list different wavelengths for the kernel widths (1370, 1432, 1470) than for the formulation for this parameter. We use the wavelengths listed in the formulation, as these match more closely with the wavelength in the parameter name. RATIONALE: Hydrated or hydroxylated minerals Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1330, 1395, 1467]) data.df[("parameter", "bd1400")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd1435(data, kernel=(3, 1, 3)): """ NAME: BD1435 PARAMETER: 1.435 micron band depth FORMULATION: 1 - ( R1435 / (a * R1370 + b * R1470) ) NOTE: Viviano-Beck et al (2014) list a different wavelength for one of the kernel widths (1432) than for the formulation for this parameter. We use the wavelengths listed in the formulation. RATIONALE: CO2 ice, some hydrated minerals Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1370, 1435, 1470]) data.df[("parameter", "bd1435")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd1500_2(data, kernel=(5, 11, 5)): """ NAME: BD1500 PARAMETER: 1.5 micron H2O ice band depth FORMULATION (with kernels): 1.0 - (R1525 / (b * R1808 + a * R1367)) RATIONALE: H2O surface ice Algorithm differs from published - coded as per CAT (reduced instrument noise) Parameters ---------- data : PyHAT SpectralData object Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1367, 1525, 1808]) data.df[("parameter", "bd1500_2")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd1750_2(data, kernel=(5, 3, 5)): """ NAME: BD1750 PARAMETER: 1.7 micron band depth FORMULATION (with kernels): 1 - ( R1750 / (a * R1690 + b * R1815) ) RATIONALE: gypsum Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1690, 1750, 1815]) data.df[("parameter", "bd1750_2")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd1900_2(data, kernel=(5, 5, 5)): """ NAME: BD1900_2 PARAMETER: 1.9 micron band depth FORMULATION (with kernels):\ .5 * (1 - (R1930 / (a * R1850 + b * R2067))) +\ .5 * (1 - (R1985 / (a * R1850 + b * R2067))) RATIONALE: H2O, chemically bound or adsorbed Algorithm differs from published - coded as per CAT (reduced instrument noise) Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls1 = data.closest_wvl([1850, 1930, 2067]) band_wvls2 = data.closest_wvl([1850, 1985, 2067]) bd1 = bd_func2(data, band_wvls1, kernel) bd2 = bd_func2(data, band_wvls2, kernel) bd1900_2_result = 0.5 * bd1 + 0.5 * bd2 data.df[("parameter", "bd1900_2")] = bd1900_2_result return data
[docs] def bd1900r2(data): """ NAME: BD1900r2 PARAMETER: 1.9 micron band depth FORMULATION:\ 1 - ((R1908 / RC1908 + R1914 / RC1914 + R1921 / RC1921 + R1928 / RC1928 + R1934 / RC1934 + R1941 / RC1941) /\ (R1862 / RC1862 + R1869 / RC1869 + R1875 / RC1875 + R2112 / RC2112 + R2120 / RC2120 + R2126 / RC2126)) RATIONALE: H2O, chemically bound or adsorbed Algorithm differs from published - coded as per CAT (reduced instrument noise) Parameters ---------- data : PyHAT SpectralData object Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls_num = data.closest_wvl([1908, 1914, 1921, 1928, 1934, 1941]) r_values_num = np.array([reflectance(data, i, kernel=0) for i in band_wvls_num]) cr_values_num = np.array( [continuum_reflectance(data, i, 1850, 2060) for i in band_wvls_num] ) numerator = np.sum(r_values_num / cr_values_num) band_wvls_den = data.closest_wvl([1862, 1869, 1875, 2112, 2120, 2126]) r_values_den = np.array([reflectance(data, i, kernel=0) for i in band_wvls_den]) cr_values_den = np.array( [continuum_reflectance(data, i, 1850, 2060) for i in band_wvls_den] ) denominator = np.sum(r_values_den / cr_values_den) bd1900r2_val = 1 - (numerator / denominator) data.df[("parameter", "bd1900r2")] = bd1900r2_val return data
[docs] def bd2190(data, kernel=(5, 3, 3)): """ NAME: BD2190 PARAMETER: 2.190 micron Al-OH band depth FORMULATION (with kernels): 1 - ( R2185 / (a * R2120 + b * R2250) ) RATIONALE: Beidellite Allophane Imogolite Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2120, 2185, 2250]) data.df[("parameter", "bd2190")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd2100_2(data, kernel=(3, 5, 3)): """ NAME: BD2100 PARAMETER: 2.1 micron band depth FORMULATION (with kernels): 1 - ( R2132 / (a * R1930 + b * R2250) ) RATIONALE: monohydrated minerals Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1930, 2132, 2250]) data.df[("parameter", "bd2100_2")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd2165(data, kernel=(5, 3, 3)): """ NAME: BD2165 PARAMETER: 2.165 micron Al-OH band depth FORMULATION (with kernels): 1 - ( R2165 / (a * R2120 + b * R2230) ) RATIONALE: Pyrophyllite Kaolinite group Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2120, 2165, 2230]) data.df[("parameter", "bd2165")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd2210_2(data, kernel=5): """ NAME: BD2210 PARAMETER: 2.21 micron band depth FORMULATION: 1 - ( R2210 / (a*R2165+b*R2250) ) RATIONALE: Al-OH minerals: monohydrated minerals Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2165, 2210, 2250]) data.df[("parameter", "bd2210_2")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd2230(data, kernel=(3, 3, 3)): """ NAME: BD2230 PARAMETER: 2.23 μm band depth FORMULATION (with kernels): 1 - (R2235 / (a * R2210 + b * R2252)) RATIONALE: Hydroxylated ferric sulfates Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2210, 2235, 2252]) data.df[("parameter", "bd2230")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd2250(data, kernel=(5, 7, 3)): """ NAME: BD2250 PARAMETER: 2.25 μm band depth FORMULATION (with kernels): 1 - (R2245 / (a * R2120 + b * R2340)) RATIONALE: 2.25 μm broad Al-OH and Si-OH band depth Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2120, 2245, 2340]) data.df[("parameter", "bd2250")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd2265(data, kernel=(5, 3, 5)): """ NAME: BD2265 PARAMETER: 2.265 micron band depth FORMULATION: 1 - ( R2265 / (a*R2210+b*R2340) ) RATIONALE: Jarosite Gibbsite Acid-leached nontronite Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2210, 2265, 2340]) data.df[("parameter", "bd2265")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd2290(data, kernel=(5, 5, 5)): """ NAME: BD2290 PARAMETER: 2.29 micron band depth FORMULATION: 1 - ( R2290 / (a*R2250+b*R2350) ) RATIONALE: Mg,Fe-OH minerals (at 2.3); also CO2 ice Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2250, 2290, 2350]) data.df[("parameter", "bd2290")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd2355(data, kernel=(5, 5, 5)): """ NAME: BD2355 PARAMETER: 2.35 micron band depth FORMULATION: 1 - ( R2355 / (a * R2300+b * R2450) ) RATIONALE: Chlorite Prehnite Pumpellyite Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2300, 2355, 2450]) data.df[("parameter", "bd2355")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd2500h_2(data, kernel=(5, 5, 5)): """ NAME: BD2500h PARAMETER: Mg Carbonate overtone band depth FORMULATION (with kernels): 1 - (R2480 / ((a * R2364) + (b * R2570))) RATIONALE: Mg carbonates Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2364, 2480, 2570]) data.df[("parameter", "bd2500h_2")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd2600(data, kernel=(5, 5, 5)): """ NAME: BD2600 PARAMETER: 2.6 μm H 2 O band depth FORMULATION: 1 - (R2600 / (a * R2530 + b * R2630)) RATIONALE: H 2 O vapor (accounts for spectral slope) Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2530, 2600, 2630]) data.df[("parameter", "BD2600")] = bd_func2(data, band_wvls, kernel) return data
[docs] def crism_bd3000(data, kernel=(5, 5, 5)): """ NAME: BD3000 PARAMETER: 3 micron band depth FORMULATION: 1 - ( R3000 / (R2530*(R2530/R2210)) ) RATIONALE: H2O, chemically bound or adsorbed Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2210, 2530, 3000]) r2210 = reflectance(data, band_wvls[0], kernel=kernel[0]) r2530 = reflectance(data, band_wvls[1], kernel=kernel[1]) r3000 = reflectance(data, band_wvls[2], kernel=kernel[2]) bd3000_result = 1 - (r3000 / (r2530 * (r2530 / r2210))) data.df[("parameter", "bd3000")] = bd3000_result return data
[docs] def bd3100(data, kernel=(5, 5, 5)): """ NAME: BD3100 PARAMETER: 3.1 micron band depth FORMULATION: 1 - ( R3120 / (a*R3000+b*R3250) ) RATIONALE: H2O ice Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([3000, 3120, 3250]) data.df[("parameter", "bd3100")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd3200(data, kernel=(5, 5, 5)): """ NAME: BD3200 PARAMETER: 3.2 micron band depth FORMULATION: 1 - ( R3320 / (a*R3250+b*R3390) ) RATIONALE: CO2 ice Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([3250, 3320, 3390]) data.df[("parameter", "bd3200")] = bd_func2(data, band_wvls, kernel) return data
[docs] def bd3400_2(data, kernel=(10, 15, 10)): """ NAME: BD3400 PARAMETER: 3.4 micron band depth FORMULATION: 1 - ( R3420 / (a*R3250+b*R3630) ) RATIONALE: carbonates; organics Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([3250, 3420, 3630]) data.df[("parameter", "bd3400_2")] = bd_func2(data, band_wvls, kernel) return data
# INTEGRATE BAND DEPTH PARAMETERS
[docs] def bdi1000VIS(data): """ NAME: BDI1000VIS PARAMETER: 1 micron integrated band depth; VIS wavelengths FORMULATION: Divide reflectances from R833 to R1023 by the modeled reflectance at RPEAK1, then integrate over (1 - normalized radiances) to get integrated band depth RATIONALE: crystalline Fe+2 or Fe+3 minerals """ if ("parameter", "RPEAK1") not in data.df.columns: print("RPEAK1 must be calculated before bdi1000VIS") data = rpeak1(data) mask = (data.wvls > 833) * (data.wvls < 1023) bdi_wvls = data.wvls[mask] subset = data.df[data.spect_label][bdi_wvls] normalized = subset.div( data.df[("parameter", "RPEAK1")], axis="index" ) # normalize by rpeak1 bdi1000vis_val = np.trapz(1 - normalized, bdi_wvls / 1000.0, axis=1) data.df[("parameter", "BDI1000VIS")] = bdi1000vis_val return data
[docs] def bdi1000IR(data): """ NAME: BDI1000IR PARAMETER: 1 micron integrated band depth; IR wavelengths FORMULATION: divide reflectances between 1020 and 1255 by linear fit from the 75th percentile R in 1330-1870 range to the median R in the range 2430-2600. Then integrate over (1 - normalized values) Note: We follow the implementation in the CAT IDL code, which differs slightly from that described in Viviano-Beck et al, 2014 RATIONALE: crystalline Fe+2 minerals; corrected for overlying\ aerosol induced slope """ cont_slope, median_2p4, median_2p4_wvl, pcnt75, pcnt75_wvls = crism_sumutil_bdicont( data, 1330, 1870, 2430, 2600 ) wvls1 = data.wvls[(data.wvls > 1020) * (data.wvls < 1255)] bdi1000ir_val = [] for i in range(len(cont_slope)): continuum = [] for w in wvls1: continuum.append(cont_slope[i] * (w - median_2p4_wvl) + median_2p4[i]) continuum = np.array(continuum) spect = data.df[data.spect_label][wvls1].iloc[i, :] spect_normalized = spect / continuum bdi1000ir_val.append(np.trapz(1 - spect_normalized, wvls1 / 1000.0)) data.df[("parameter", "BDI1000IR")] = np.array(bdi1000ir_val) return data
[docs] def crism_bdi2000(data): """ NAME: BDI2000 PARAMETER: 2 micron integrated band depth FORMULATION: divide reflectances between 1660 and 2390 by linear fit from the 75th percentile R in 1330-1870 range to the median R in the range 2430-2600. Then integrate over (1 - normalized values) Note: We follow the implementation in the CAT IDL code, which differs slightly from that described in Viviano-Beck et al, 2014 RATIONALE: pyroxene abundance and particle size """ cont_slope, median_2p4, median_2p4_wvl, pcnt75, pcnt75_wvls = crism_sumutil_bdicont( data, 1330, 1870, 2430, 2600 ) wvls1 = data.wvls[(data.wvls > 1660) * (data.wvls < 2390)] bdi2000_val = [] for i in range(len(cont_slope)): continuum = [] for w in wvls1: continuum.append(cont_slope[i] * (w - median_2p4_wvl) + median_2p4[i]) continuum = np.array(continuum) spect = data.df[data.spect_label][wvls1].iloc[i, :] spect_normalized = spect / continuum bdi2000_val.append(np.trapz(1 - spect_normalized, wvls1 / 1000.0)) data.df[("parameter", "BDI2000")] = np.array(bdi2000_val) return data
# SHOULDER PARAMETERS
[docs] def sh600_2(data, kernel=(5, 5, 3)): """ NAME: SH600 PARAMETER: 0.60 micron shoulder height FORMULATION (with kernels): 1 - (a * R533 + b * R716) / R600 RATIONALE: select ferric minerals Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([533, 600, 716]) data.df[("parameter", "sh600_2")] = sh_func(data, band_wvls, kernel) return data
[docs] def sh770(data, kernel=(3, 5, 5)): """ NAME: SH770 PARAMETER: 0.77 micron shoulder height FORMULATION (with kernels): 1 - (a * R716 + b * R860) / R775 RATIONALE: select ferric minerals Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([716, 775, 860]) data.df[("parameter", "sh770")] = sh_func(data, band_wvls, kernel) return data
[docs] def sindex2(data, kernel=(5, 7, 3)): """ NAME: SINDEX2 PARAMETER: Inverse lever rule to detect convexity at 2.29 μm due to 2.1 μm\ and 2.4 μm absorptions FORMULATION (with kernels): 1 - (a * R2120 + b * R2400) / R2290 RATIONALE: Hydrated sulfates (mono and polyhydrated sulfates) will be\ strongly > 0 Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2120, 2290, 2400]) data.df[("parameter", "SINDEX2")] = sh_func(data, band_wvls, kernel) return data
[docs] def cindex2(data, kernel=(9, 11, 7)): """ NAME: CINDEX PARAMETER: Inverse lever rule to detect convexity at 3.6 μm due to 3.4 μm and 3.9 μm\ absorptions FORMULATION (with kernels): 1 - ((a * R3450 + b * R3875) / 3610) RATIONALE: carbonates Parameters ---------- data : PyHAT SpectralData object kernel: Tuple of windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([3450, 3610, 3875]) data.df[("parameter", "CINDEX2")] = sh_func(data, band_wvls, kernel) return data
###############################################################
[docs] def rpeak1(data): """ NAME: RPEAK1 PARAMETER: Reflectance peak 1 FORMULATION: Wavelength where first derivative = 0 of fifth-order \ polynomial fit to reflectances at all valid VNIR wavelengths RATIONALE: crystalline Fe+2 or Fe+3 minerals Parameters ---------- data : PyHAT SpectralData object Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ vnir_mask = (data.wvls > 400) * (data.wvls < 1000) vnir_wvls = data.wvls[vnir_mask] rpeak1_result = rpeak1_func(data, vnir_wvls) data.df[("parameter", "RPEAK1")] = rpeak1_result return data
[docs] def olivine_index3(data, kernel=7): """ NAME: OLINDEX3 PARAMETER: olivine index with less sensitivity to illumination FORMULATION: RB1210 * 0.1 + RB1250 * 0.1 + RB1263 * 0.2 +\ RB1276 * 0.2 + RB1330 * 0.4 Slope for RC anchored at R1750 and R1862 RB#### = (RC#### - R####)/RC#### RATIONALE: detect broad absorption centered at 1 um Parameters ---------- data : PyHAT SpectralData object kernel: window in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1210, 1250, 1263, 1276, 1330, 1750, 1862]) R1210 = reflectance(data, band_wvls[0], kernel=kernel) R1250 = reflectance(data, band_wvls[1], kernel=kernel) R1263 = reflectance(data, band_wvls[2], kernel=kernel) R1276 = reflectance(data, band_wvls[3], kernel=kernel) R1330 = reflectance(data, band_wvls[4], kernel=kernel) R1750 = reflectance(data, band_wvls[5], kernel=kernel) R1862 = reflectance(data, band_wvls[6], kernel=kernel) slope = compute_slope(band_wvls[5], band_wvls[6], R1750, R1862) intercept = R1862 - slope * band_wvls[6] Rc1210 = slope * band_wvls[0] + intercept Rc1250 = slope * band_wvls[1] + intercept Rc1263 = slope * band_wvls[2] + intercept Rc1276 = slope * band_wvls[3] + intercept Rc1330 = slope * band_wvls[4] + intercept RB1210 = (Rc1210 - R1210) / abs(Rc1210) RB1250 = (Rc1250 - R1250) / abs(Rc1250) RB1263 = (Rc1263 - R1263) / abs(Rc1263) RB1276 = (Rc1276 - R1276) / abs(Rc1276) RB1330 = (Rc1330 - R1330) / abs(Rc1330) olindex3 = RB1210 * 0.1 + RB1250 * 0.1 + RB1263 * 0.2 + RB1276 * 0.2 + RB1330 * 0.4 data.df[("parameter", "OLINDEX3")] = olindex3 return data
[docs] def lcp_index2(data, kernel=7): """ NAME: LCPINDEX2 PARAMETER: Detect broad absorption centered at 1.81 μm FORMULATION (with kernels):\ RB1690 * 0.20 + RB1750 * 0.20 + RB1810 * 0.30 + RB1870 * 0.30\ Anchored at R1560 and R2450 RATIONALE: Pyroxene is strongly +; favors LCP Algorithm differs from published - coded as per CAT <--- What? Parameters ---------- data : PyHAT SpectralData object kernel: window in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1560, 1690, 1750, 1810, 1870, 2450]) R1560 = reflectance(data, band_wvls[0], kernel=kernel) R1690 = reflectance(data, band_wvls[1], kernel=kernel) R1750 = reflectance(data, band_wvls[2], kernel=kernel) R1810 = reflectance(data, band_wvls[3], kernel=kernel) R1870 = reflectance(data, band_wvls[4], kernel=kernel) R2450 = reflectance(data, band_wvls[5], kernel=kernel) slope = compute_slope(band_wvls[0], band_wvls[5], R1560, R2450) intercept = R2450 - slope * band_wvls[5] Rc1690 = slope * band_wvls[1] + intercept Rc1750 = slope * band_wvls[2] + intercept Rc1810 = slope * band_wvls[3] + intercept Rc1870 = slope * band_wvls[4] + intercept RB1690 = (Rc1690 - R1690) / abs(Rc1690) RB1750 = (Rc1750 - R1750) / abs(Rc1750) RB1810 = (Rc1810 - R1810) / abs(Rc1810) RB1870 = (Rc1870 - R1870) / abs(Rc1870) lcpindex2 = RB1690 * 0.2 + RB1750 * 0.2 + RB1810 * 0.3 + RB1870 * 0.3 data.df[("parameter", "LCPINDEX2")] = lcpindex2 return data
[docs] def hcp_index2(data, kernel=(7, 5, 7, 7, 7, 7, 7, 7)): """ NAME: HCPINDEX2 PARAMETER: pyroxene index FORMULATION: RB2120 * 0.10 + RB2140 * 0.10 + RB2230 * 0.15 + RB2250 * 0.30 + RB2430 * 0.20 + RB2460 * 0.15 RB # # # # = (RC # # # #-R # # # #)/RC # # # # Slope for RC#### anchored at R1690 and R2530 RATIONALE: pyroxene is strongly +; favors high-Ca pyroxene Parameters ---------- data : PyHAT SpectralData object kernel: tuple contaning windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1810, 2120, 2140, 2230, 2250, 2430, 2460, 2530]) R1810 = reflectance(data, band_wvls[0], kernel=kernel[0]) R2120 = reflectance(data, band_wvls[1], kernel=kernel[1]) R2140 = reflectance(data, band_wvls[2], kernel=kernel[2]) R2230 = reflectance(data, band_wvls[3], kernel=kernel[3]) R2250 = reflectance(data, band_wvls[4], kernel=kernel[4]) R2430 = reflectance(data, band_wvls[5], kernel=kernel[5]) R2460 = reflectance(data, band_wvls[6], kernel=kernel[6]) R2530 = reflectance(data, band_wvls[7], kernel=kernel[7]) slope = compute_slope(band_wvls[0], band_wvls[7], R1810, R2530) intercept = R2530 - slope * band_wvls[7] Rc2120 = slope * band_wvls[1] + intercept Rc2140 = slope * band_wvls[2] + intercept Rc2230 = slope * band_wvls[3] + intercept Rc2250 = slope * band_wvls[4] + intercept Rc2430 = slope * band_wvls[5] + intercept Rc2460 = slope * band_wvls[6] + intercept RB2120 = (Rc2120 - R2120) / abs(Rc2120) RB2140 = (Rc2140 - R2140) / abs(Rc2140) RB2230 = (Rc2230 - R2230) / abs(Rc2230) RB2250 = (Rc2250 - R2250) / abs(Rc2250) RB2430 = (Rc2430 - R2430) / abs(Rc2430) RB2460 = (Rc2460 - R2460) / abs(Rc2460) hcpindex2 = ( RB2120 * 0.1 + RB2140 * 0.1 + RB2230 * 0.15 + RB2250 * 0.3 + RB2430 * 0.2 + RB2460 * 0.15 ) data.df[("parameter", "HCPINDEX2")] = hcpindex2 return data
'''#@@TODO var def var(data, **kwargs): """ NAME: VAR PARAMETER: spectral variance FORMULATION: find variance from a line fit from 1 - 2.3 micron by summing in quadrature over the intervening wavelengths RATIONALE: Ol & Px will have high values; Type 2 areas will have low values """ raise NotImplementedError'''
[docs] def islope1(data, kernel=5): """ NAME: ISLOPE1 PARAMETER: -1 * spectral slope1 FORMULATION: (R1815-R2530) / (2530-1815) RATIONALE: ferric coating on dark rock Parameters ---------- data : PyHAT SpectralData object kernel: window in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1815, 2530]) r1815 = reflectance(data, band_wvls[0], kernel=kernel) r2530 = reflectance(data, band_wvls[1], kernel=kernel) islope1 = compute_slope(band_wvls[0], band_wvls[1], r2530, r1815) data.df[("parameter", "ISLOPE1")] = islope1 return data
[docs] def icer1_2(data): """ NAME: ICER1_2 PARAMETER: 1.5 micron and 1.43 micron band ratio FORMULATION: 1 - ((1 - bd1435) / (1 - bd1500)) RATIONALE: CO2, H20 ice mixtures Parameters ---------- data : PyHAT SpectralData object Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ bd1435_val = bd1435(data) bd1500_val = bd1500_2(data) icer1_2_val = 1 - ((1 - bd1435_val) / (1 - bd1500_val)) data.df[("parameter", "ICER1_2")] = icer1_2_val return data
[docs] def doub2200h(data, kernel=(5, 3, 3, 5)): """ NAME: DOUB2200H PARAMETER: 2.16 micron Si-OH band depth and 2.21 micron H-bound Si-OH band\ depth (doublet) FORMULATION (with kernels): 1 - ((R2205 + R2258) / (R2172 + R2311)) RATIONALE: Opal and other Al-OH minerals Parameters ---------- data : PyHAT SpectralData object kernel: windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2172, 2205, 2258, 2311]) r2172 = reflectance(data, band_wvls[0], kernel=kernel[0]) r2205 = reflectance(data, band_wvls[1], kernel=kernel[1]) r2258 = reflectance(data, band_wvls[2], kernel=kernel[2]) r2311 = reflectance(data, band_wvls[3], kernel=kernel[3]) doub2200h_val = 1 - ((r2205 + r2258) / (r2172 + r2311)) data.df[("parameter", "DOUB2200H")] = doub2200h_val return data
[docs] def min2200(data, kernel=(5, 3, 5)): """ NAME: MIN2200 PARAMETER: 2.16 μm Si-OH band depth and 2.21 μm H-bound Si-OH band\ depth (doublet) FORMULATION (with kernels): minimum( 1 - (R2165 / (a * R2120 + b * R2350)),\ 1 - (R2210 / (a * R2120 + b * R2350))) RATIONALE: Kaolinite group Parameters ---------- data : PyHAT SpectralData object kernel: windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "MIN2200")] = min_2_bands( data, [2120, 2165, 2350], kernel, [2120, 2210, 2350], kernel ) return data
[docs] def d2200(data, kernel=(7, 5, 7, 7, 7)): """ NAME: D2200 PARAMETER: 2.2 micron dropoff FORMULATION (with kernels): 1 - (((R2210 / RC2210) + (R2230 / RC2230)) / (2 * (R2165 / RC2165)))\ Slope for RC#### anchored at R1815 and R2430. RATIONALE: Al-OH minerals Parameters ---------- data : PyHAT SpectralData object kernel: windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1815, 2165, 2210, 2230, 2430]) r1815 = reflectance(data, band_wvls[0], kernel=kernel[0]) r2165 = reflectance(data, band_wvls[1], kernel=kernel[1]) r2210 = reflectance(data, band_wvls[2], kernel=kernel[2]) r2230 = reflectance(data, band_wvls[3], kernel=kernel[3]) r2430 = reflectance(data, band_wvls[4], kernel=kernel[4]) slope = compute_slope(band_wvls[0], band_wvls[4], r1815, r2430) rc2165 = r1815 + slope * (band_wvls[1] - band_wvls[0]) rc2210 = r1815 + slope * (band_wvls[2] - band_wvls[0]) rc2230 = r1815 + slope * (band_wvls[3] - band_wvls[0]) d2200_val = 1 - ((r2210 / rc2210) + (r2230 / rc2230)) / (2 * (r2165 / rc2165)) data.df[("parameter", "D2200")] = d2200_val return data
[docs] def min2250(data, kernel=(5, 3, 5)): """ NAME: MIN2250 PARAMETER: 2.21 μm Si-OH band depth and 2.26 μm H-bound Si-OH\ band depth FORMULATION (with kernels): minimum( 1 - (R2210 / (a * R2165 + b * R2350)),\ 1 - (R2265 / (a * R2165 + b * R2350))) RATIONALE: Opal Parameters ---------- data : PyHAT SpectralData object kernel: windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "MIN2250")] = min_2_bands( data, [2165, 2210, 2350], kernel, [2165, 2265, 2350], kernel ) return data
[docs] def d2300(data, kernel=(5, 5, 5, 5, 3, 3, 3, 5)): """ NAME: D2300 PARAMETER: 2.3 micron drop FORMULATION: 1 - ( (CR2290+CR2320+CR2330) /\ (CR2140+CR2170+CR2210) ) (CR values are observed R values\ divided by values fit along the slope as determined between 1.8\ and 2.53 microns - essentially continuum corrected)) RATIONALE: hydrated minerals; particularly clays Parameters ---------- data : PyHAT SpectralData object kernel: windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([1815, 2120, 2170, 2210, 2290, 2320, 2330, 2530]) r1815 = reflectance(data, band_wvls[0], kernel=kernel[0]) r2120 = reflectance(data, band_wvls[1], kernel=kernel[1]) r2170 = reflectance(data, band_wvls[2], kernel=kernel[2]) r2210 = reflectance(data, band_wvls[3], kernel=kernel[3]) r2290 = reflectance(data, band_wvls[4], kernel=kernel[4]) r2320 = reflectance(data, band_wvls[5], kernel=kernel[5]) r2330 = reflectance(data, band_wvls[6], kernel=kernel[6]) r2530 = reflectance(data, band_wvls[7], kernel=kernel[7]) slope = compute_slope(band_wvls[0], band_wvls[7], r1815, r2530) rc2120 = r1815 + slope * (band_wvls[1] - band_wvls[0]) rc2170 = r1815 + slope * (band_wvls[2] - band_wvls[0]) rc2210 = r1815 + slope * (band_wvls[3] - band_wvls[0]) rc2290 = r1815 + slope * (band_wvls[4] - band_wvls[0]) rc2320 = r1815 + slope * (band_wvls[5] - band_wvls[0]) rc2330 = r1815 + slope * (band_wvls[6] - band_wvls[0]) d2300_val = 1 - ( ((r2290 / rc2290) + (r2320 / rc2320) + (r2330 / rc2330)) / ((r2120 / rc2120) + (r2170 / rc2170) + (r2210 / rc2210)) ) data.df[("parameter", "D2300")] = d2300_val return data
[docs] def min2295_2480(data, kernel=(5, 5, 5)): """ NAME: MIN2295_2480 PARAMETER: Mg Carbonate overtone band depth and metal-OH band FORMULATION (with kernels): minimum( 1 - (R2295 / (a * R2165 + b * R2364)),\ 1 - (R2480 / (a * R2364 + b * R2570))) RATIONALE: Mg carbonates; both overtones must be present Parameters ---------- data : PyHAT SpectralData object kernel: windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "MIN2295_2480")] = min_2_bands( data, [2165, 2295, 2364], kernel, [2364, 2480, 2570], kernel ) return data
[docs] def min2345_2537(data, kernel=(5, 5, 5)): """ NAME: MIN2345_2537 PARAMETER: Ca/Fe Carbonate overtone band depth and metal-OH band FORMULATION (with kernels): minimum( 1 - (R2345 / (a * R2250 + b * R2430)),\ 1 - (R2537 / (a * R2430 + b * R2602))) RATIONALE: Ca/Fe carbonates; both overtones must be present Parameters ---------- data : PyHAT SpectralData object kernel: windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ data.df[("parameter", "MIN2345_2537")] = min_2_bands( data, [2250, 2345, 2430], kernel, [2430, 2537, 2602], kernel ) return data
[docs] def irr1(data, kernel=(5, 5)): """ Name: IRR1 Parameter: IR ratio 1 FORMULATION (with kernels): R800 / R997 Rationale: Aphelion ice clouds (>1) versus seasonal or Parameters ---------- data : PyHAT SpectralData object kernel: windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([800, 997]) r800 = reflectance(data, band_wvls[0], kernel[0]) r997 = reflectance(data, band_wvls[1], kernel[1]) irr1_val = r800 / r997 data.df[("parameter", "IRR1")] = irr1_val return data
[docs] def irr2(data, kernel=(5, 5)): """ Name: IRR2 Parameter: IR ratio 2 FORMULATION (with kernels): R2530 / R2210 Rationale: Aphelion ice clouds versus seasonal or dust Parameters ---------- data : PyHAT SpectralData object kernel: windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([2210, 2530]) r2210 = reflectance(data, band_wvls[0], kernel[0]) r2530 = reflectance(data, band_wvls[1], kernel[1]) irr2_val = r2530 / r2210 data.df[("parameter", "IRR2")] = irr2_val return data
[docs] def irr3(data, kernel=(7, 7)): """ Name: IRR3 Parameter: IR ratio 3 FORMULATION (with kernels): R3500 / R3390 Rationale: Aphelion ice clouds (higher values) versus seasonal or dust Parameters ---------- data : PyHAT SpectralData object kernel: windows in # of spectral channels around the specified wvls Returns ------- data: PyHAT SpectralData object with a new column added for the derived parameter """ band_wvls = data.closest_wvl([3390, 3500]) r3390 = reflectance(data, band_wvls[0], kernel[0]) r3500 = reflectance(data, band_wvls[1], kernel[1]) irr3_val = r3500 / r3390 data.df[("parameter", "IRR3")] = irr3_val return data