Py6S
Py6S copied to clipboard
Adding features to re-use MIE subroutine calculations
Hi, this pull request adds two features to Py6S:
(1) The ability to save a text file with the .mie
extension containing the results of the MIE.f
subroutine (applies only for aerosol profile options 8, 9, 10, and 11).
To use this, we simply set a new attribute to the SixsS object called mie
(which by default is set to None
). By setting it to a string value other than None, then the inputs file will have 1 results saved in X.mie
(where X is the value set to the mie
attribute) instead of 0 no results saved
, and the following line will have the name of the file (e.g. X). Its value is ignored if the aerosol profile is user-defined (iaer=4) or a predefined type.
(2) A new classmethod for the AeroProfile
called FromMieFile
which will set iaer
to 12 followed by the name of the text file (provided by the parameter mie_file
).
Caveat:
Using a pre-computed MIE file compared to using the options used to create the MIE file will result in some small differences in the output. This is expected because the AEROSO.f
subroutine writes the text file with a fixed set of precision.
Thanks, this looks great. I've only had a quick look so far, but I'll aim to review it properly as soon as I get chance.
In the meantime, if you have any time to implement a couple of simple tests for the new functionality then that'd be great.
Ok, I will work on implementing the new tests when I get a chance, which will likely require comparing some generated .mie
text files. I also just pushed a new commit that fixes the failed test when using an integer s.aero_profile
(e.g. from a predefined type). I also now ran python -m unittest
locally.. last time I only tested the examples manually.
Sorry for the massive delay in dealing with this, and thanks for adding the tests.
I've merged now, and I'll aim to get a new release out shortly.