kconnour / pyRT_DISORT

A Python package for helping to compute input arrays to DISORT.
https://kconnour.github.io/pyRT_DISORT/
BSD 3-Clause "New" or "Revised" License
14 stars 5 forks source link

aerosol.ForwardScattering should have a gridded property for asymmetry parameter #6

Closed mjwolff closed 2 years ago

mjwolff commented 2 years ago

since the asymmetry parameter (g) is included in forward scattering properties, it is natural that it is a property something like:

@property
def asymmetry_parameter(self) -> np.ndarray:
    """Get the asymmetry parameter on the new grid.

    """
    return self.__asymmetry_parameter

This would be useful for particle gradients where one was happy with the H-G phase function.

mjwolff commented 2 years ago

In observation.py, there are few definition problems:

1) incidence < 90 (not 180)

Parameters

incidence
    Incidence (solar zenith) angles [degrees]. All values must be between 0
    and **90** (not 180)

this occurs MULTIPLE times in the code comments.

2) this incidence < 90 also occurs in the instance:

"""
def __new__(cls, array: ArrayLike):
    obj = super().__new__(cls, array, 'incidence', 0, **90**_ NOT 180)_
    cls.__warn_if_incidence_angle_is_greater_than_90(obj)
    return obj

3) more importantly, the emission angle is incorrectly constrained to be less than 90 instead of 180:

class _EmissionAngles(_Angles): """Designate that an input array represents emission (emergence) angles.

Parameters
----------
array
    Any array of emission angles. Must be between 0 and **180** (_NOT 90 degrees)_.

4) and this is this the critical bug for making a SkyImage:...should be 0,180

def __new__(cls, array: ArrayLike):
    obj = super().__new__(cls, array, 'emission', 0, **180** _NOT 90_)
    return obj
kconnour commented 2 years ago

I addressed the second comment in the latest commit. Fortunately this issue was as simple as changing the 2 lines you pointed out and then changing the documentation.

I think I should issue a warning if the emission angles are > 90 in pyrt.observation.phase_to_angles() since I imagine that function will only be called from someone using the "orbiter" geometry and in that case the emission angles can't be > 90. Any thoughts?

kconnour commented 2 years ago

Just pushed a commit that adds the asymmetry parameter as an optional input so this change shouldn't break your already working code. Would you guess that anyone making forward scattering properties would always make the extinction and scattering cross sections, as well as g, are there other properties to consider?

Note that the observation module is the only module I'd describe as polished. I'm happy to make changes to these other modules but they will be getting some serious quality of life upgrades as soon as I find the time and energy to work on them (which may be after my degree...)