EnSpec / hytools

Hyperspectral image processing library
GNU General Public License v3.0
56 stars 25 forks source link

BRDF correction in Hytools: BRF or HDRF at Zenith? #11

Open serbinsh opened 2 years ago

serbinsh commented 2 years ago

We were talking today about using Hytools for an experiment for SBG. We are looking to re-run some algorithms using different simulated SBG by view azimuth/zenith directions. However, as we were chatting I realized I wasnt sure what BRDF (BRF) is considered in Hytools - is it hemispherical over all angles (integrated, albedo) or is it the reflectance for each pixel corrected to a Zenith (nadir)? I think that the RL correct does do an integration over all angles but is the output at zenith (or whatever angle you want each pixel corrected too) or assumed to be integrated reflectance (i.e. albedo, BRF)?

Also, is is possible to configure Hytools to accept a user-input view azimuth/zenith as the output directions for the BRDF correction? Perhaps by setting up the json config to overwrite the data dictionary to "force" a different output angle than nadir?

Thanks!

serbinsh commented 2 years ago

Basically we are trying to determine if Hytools provides a correction BRDF kernal that then corrects each pixel to nadir (blue in the figure) or if Hytools outputs hemispherical reflecatance?

brdf-diagram

adamchlus commented 2 years ago

The BRDF correction done by Hytools corrects each pixel to nadir (see here), it should be possible without too much work to allow the user to input custom solar and viewing geometry angles to normalize to. Let me think about the best way to implement it and I'll get back to you on that.

serbinsh commented 2 years ago

Thanks @adamchlus FYI - commented to Ann about using the config file to set the angles. I would totally support that. In fact I made some updates to examples we had to use config files as inputs to setting up the json files and then running the corrections here: https://github.com/TESTgroup-BNL/hytools_helpers/tree/main/modex_examples

I could see adapting this or like I do, setting the angles in the global options config much like this example https://github.com/TESTgroup-BNL/hytools_helpers/blob/main/modex_examples/configs/hytools_run_setup_config.cfg

In there I made some mods so that we could set options there instead of the script, and use the script to generate the dictionary and json config that we use with the corrections script.

Perhaps under a similar [brdf] tag we place the angles? And the default can be zenith but allow for us to set them "on the fly" instead to run over different angles?

Also, this is just a quick and dirty mod to the functions to use the config files and allow passing of the json file for corrections. So not the cleaneast but it works! I also did it this way to be able to submit SLURM jobs like this https://github.com/TESTgroup-BNL/hytools_helpers/blob/main/batch/run_image_correct_batch.sh

it works like: python modex_examples/image_correct.py --config ${1}

and in the code

# get config file from script call
parser = argparse.ArgumentParser()
parser.add_argument('--config', help='path to configuration file to use',
    required=True)
args = parser.parse_args()
print(f'Config file: {args.config}')
config_file_in = args.config
adamchlus commented 2 years ago

Thanks for the examples, I'll work on incorporating the ability to specify custom normalization angles next week when I address the no data value issue #10.