EnSpec / hytools

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

Bringing glint module into Hytools #6

Closed evan-greenbrg closed 3 years ago

evan-greenbrg commented 3 years ago

Hey. I closed and reopened the pull request. I slightly changed how I was doing to water masks. Now it follows the same logic as the ancillary files and passes water mask files explicitly within the config.

Let me know if you have any thoughts or questions.

adamchlus commented 3 years ago

Hey Evan,

I will review the new PR, but here were my comments from the previous PR, ignore any that no longer apply:

There are a just of few changes I’d recommend to the ‘image_config_generate.py’:

  1. Add ‘calc_mask’, without one ‘image_correct.py’ crashes. config_dict["glint"]["calc_mask"] = [ ["water", {'band_1': 560,'band_2': 860, 'threshold': -0.05}]]
  2. Remove the conditional statements, instead place the glint config examples and options in a comment block, see the topographic example here for a reference. Include examples of all the necessary settings for each correction type, for example config_dict['glint']['bounds'] for the sky_glint correction.
  3. Update the names of the glint correct types to reflect the current names.

Also in my tests I was able to successfully run gao, hochberg and hedley with no issues. Skyglint seems to take a long time, how long does it typically take to run?

-Adam

evan-greenbrg commented 3 years ago

Thanks for the comments Adam.

For 1. I was testing the index-based water-masks for the glint correction and found that it benefited from being a little more generalized. This was the main change between this PR and the last. The current config for the glint correction includes explicit paths to water mask files in the same way that you point the BRDF to ancillary files of solar zenith, etc. As a result, the glint config doesn't need to generate any masks within the HyTools algorithm. How do you feel about this change? Given the change, the logic at line 133 within image_correct.py might have to be altered because you aren't calculating a mask for the glint step, it is given explicitly.

The actual code changes for this are within each individual glint module where the water masks are loaded with the get_anc() function and then in the edited image_correct_json_generate.json on line 57.

I think I covered 3. in this PR, but will correct for 2.

The sky_glint algorithm takes a while. The bottleneck is the fact that you have to optimize for an effective wind speed at every pixel within the image individually. There was no clear vectorized solution that I found.

-Evan

evan-greenbrg commented 3 years ago

All references to the sky glint module should be removed. I opened a new branch that still has the sky glint module on my fork.

adamchlus commented 3 years ago

Thanks for all your work on this, everything looks good!