1.5.1.1.4.1.4. polar2grid.filters.day_night module

Filter classes for making decisions based on day or night percentages.

class polar2grid.filters.day_night.DayCoverageFilter(product_filter_criteria: Optional[dict] = None, sza_threshold: float = 100.0, day_fraction: float = 0.1)[source]

Bases: SunlightCoverageFilter

Remove certain products when there is not enough day data.

FILTER_MSG = "Unloading '{}' because there is not enough day data."
_should_be_filtered(sunlight_coverage)[source]
class polar2grid.filters.day_night.NightCoverageFilter(product_filter_criteria: Optional[dict] = None, sza_threshold: float = 100.0, night_fraction: float = 0.1)[source]

Bases: SunlightCoverageFilter

Remove certain products when there is not enough night data.

FILTER_MSG = "Unloading '{}' because there is not enough night data."
_should_be_filtered(sunlight_coverage)[source]
class polar2grid.filters.day_night.SunlightCoverageFilter(product_filter_criteria: Optional[dict] = None, sza_threshold: float = 100.0, fraction: float = 0.1)[source]

Bases: BaseFilter

Base class for filtering based on day/night coverage.

FILTER_MSG = "Unloading '{}' because there is not enough day/night coverage."
_filter_data_array(data_arr: DataArray, _cache: dict)[source]

Check if this DataArray should be removed.

Returns:

True if it meets the condition and does not have enough day data and should therefore be removed. False otherwise meaning it should be kept.

_should_be_filtered(sunlight_coverage)[source]
polar2grid.filters.day_night._get_sunlight_coverage(area_def, start_time, sza_threshold=90.0, overpass=None)[source]

Get the sunlight coverage of area_def at start_time as a value between 0 and 1.

polar2grid.filters.day_night.get_twilight_poly(utctime)[source]

Return a polygon enclosing the sunlit part of the globe at utctime.

polar2grid.filters.day_night.modpi(val, mod=3.141592653589793)[source]

Put val between -mod and mod.