import numpy as np oli = load_OLI() def ylim(axs): axs[0].set_ylim(-120, 120) axs[0].set_yticks([-100, -50, 0, 50, 100]) axs[1].set_ylim(-1.5, 0.4) axs[1].set_yticks([-1, -0.5, 0]) data_files = Path("data").glob("*processed.tab") labels, wavelengths, Eds, Lws, R_rss = zip( *[load_data_file(file) for file in data_files]) def get_differences(band): with warnings.catch_warnings(): warnings.simplefilter("ignore") RrsR = [ band.convolve(wavelengths_data, R_rs) for wavelengths_data, R_rs in zip(wavelengths, R_rss) ] RrsL = [ band.convolve(wavelengths_data, Lw) / band.convolve(wavelengths_data, Ed) for wavelengths_data, Ed, Lw in zip(wavelengths, Eds, Lws) ]
""" Generate boxcar and gaussian spectral response functions """ from sba.bandaveraging import calculate_differences from sba.io import load_data_file from sba.response_curves import load_all_sensors from pathlib import Path sensors = load_all_sensors() data_files = Path("data").glob("*processed.tab") for file in data_files: label, wavelengths_data, Ed, Lw, R_rs = load_data_file(file) for sensor in sensors: reflectance_space = sensor.band_average(wavelengths_data, R_rs) radiance_space = sensor.band_average( wavelengths_data, Lw) / sensor.band_average(wavelengths_data, Ed) difference_absolute, difference_relative = calculate_differences( reflectance_space, radiance_space) sensor.boxplot_absolute(difference_absolute, data_label=label) sensor.boxplot_relative(difference_relative, data_label=label)