pytroll/pyspectral

Do not cut NIR reflectance with a single threshold

pnuu opened this issue · 0 comments

pnuu commented

Code Sample, a minimal, complete, and verifiable piece of code

import glob
from satpy import Scene

fnames = glob.glob("/path/to/msg/data/H*__")
glbl = glbl.load(["day_microphysics"])
lcl = glbl.resample("euro4")
lcl.show("day_microphysics")

Problem description

The above code using Satpy uses Pyspectral to determine the NIR reflectance and uses it as one channel in the RGB. Current version of Pyspectral masks the data with a single strict limit of Sun zenith angle (85.0 degrees by default). The same limit is used to limit the range of SZA correction. These two should be separated. When this composite is used together with a night-side composite, there's a big gap between the composites.

Expected Output

Adjustable limit for masking invalid data by SZA.

Actual Result, Traceback if applicable

day_microphysical_20161128_110000

Proposed solution

Separate the SZA limit (sunz_threshold kwarg) and the masking limit of invalid data. So I would add another keyword argument to pyspectral.near_infrared_reflectance.Calculator.__init__. Maybe masking_limit. By default these both can have the same limit (TERMINATOR_LIMIT), but for Day/Night composites the masking limit should be adaptable.

Versions of Python, package at hand and relevant dependencies

Current master branch of Pyspectral.