satpy.composites.viirs module
Composite classes for the VIIRS instrument.
- class satpy.composites.viirs.AdaptiveDNB(*args, **kwargs)[source]
Bases:
HistogramDNB
Adaptive histogram equalized DNB composite.
The logic for this code was taken from Polar2Grid and was originally developed by Eva Schiffer (SSEC).
This composite separates the DNB data in to 3 main regions: Day, Night, and Mixed. Each region is equalized separately to bring out the most information from the region due to the high dynamic range of the DNB data. Optionally, the mixed region can be separated in to multiple smaller regions by using the mixed_degree_step keyword.
Initialize the compositor with values from the user or from the configuration file.
Adaptive histogram equalization and regular histogram equalization can be configured independently for each region: day, night, or mixed. A region can be set to use adaptive equalization “always”, or “never”, or only when there are multiple regions in a single scene “multiple” via the adaptive_X keyword arguments (see below).
- Parameters:
adaptive_day – one of (“always”, “multiple”, “never”) meaning when adaptive equalization is used.
adaptive_mixed – one of (“always”, “multiple”, “never”) meaning when adaptive equalization is used.
adaptive_night – one of (“always”, “multiple”, “never”) meaning when adaptive equalization is used.
- class satpy.composites.viirs.ERFDNB(*args, **kwargs)[source]
Bases:
CompositeBase
Equalized DNB composite using the error function (erf).
The logic for this code was taken from Polar2Grid and was originally developed by Curtis Seaman and Steve Miller. The original code was written in IDL and is included as comments in the code below.
Initialize ERFDNB specific keyword arguments.
- class satpy.composites.viirs.HistogramDNB(*args, **kwargs)[source]
Bases:
CompositeBase
Histogram equalized DNB composite.
The logic for this code was taken from Polar2Grid and was originally developed by Eva Schiffer (SSEC).
This composite separates the DNB data in to 3 main regions: Day, Night, and Mixed. Each region is equalized separately to bring out the most information from the region due to the high dynamic range of the DNB data. Optionally, the mixed region can be separated in to multiple smaller regions by using the mixed_degree_step keyword.
Initialize the compositor with values from the user or from the configuration file.
- Parameters:
high_angle_cutoff – solar zenith angle threshold in degrees, values above this are considered “night”
low_angle_cutoff – solar zenith angle threshold in degrees, values below this are considered “day”
mixed_degree_step – Step interval to separate “mixed” region in to multiple parts by default does whole mixed region
- class satpy.composites.viirs.NCCZinke(name, prerequisites=None, optional_prerequisites=None, **kwargs)[source]
Bases:
CompositeBase
Equalized DNB composite using the Zinke algorithm [1].
References
Initialise the compositor.
- class satpy.composites.viirs.SnowAge(name, common_channel_mask=True, **kwargs)[source]
Bases:
GenericCompositor
Create RGB snow product.
Product is based on method presented at the second CSPP/IMAPP users’ meeting at Eumetsat in Darmstadt on 14-16 April 2015
Bernard Bellec snow Look-Up Tables V 1.0 (c) Meteo-France These Look-up Tables allow you to create the RGB snow product for SUOMI-NPP VIIRS Imager according to the algorithm presented at the second CSPP/IMAPP users’ meeting at Eumetsat in Darmstadt on 14-16 April 2015 The algorithm and the product are described in this presentation : http://www.ssec.wisc.edu/meetings/cspp/2015/Agenda%20PDF/Wednesday/Roquet_snow_product_cspp2015.pdf as well as in the paper http://dx.doi.org/10.1016/j.rse.2017.04.028 For further information you may contact Bernard Bellec at Bernard.Bellec@meteo.fr or Pascale Roquet at Pascale.Roquet@meteo.fr
Collect custom configuration values.
- Parameters:
common_channel_mask (bool) – If True, mask all the channels with a mask that combines all the invalid areas of the given data.
- satpy.composites.viirs._calculate_weights(tile_size)[source]
Calculate a weight array for bilinear interpolation of histogram tiles.
The weight array will be used to quickly bilinearly-interpolate the histogram equalizations tile size should be the width and height of a tile in pixels.
- Returns: 4D weight array where the first 2 dimensions correspond to the
grid of where the tiles are relative to the tile being interpolated.
- satpy.composites.viirs._check_moon_phase(moon_datasets: list[xarray.core.dataarray.DataArray], start_time: datetime) float [source]
Check if we have Moon phase as an input dataset and, if not, calculate it.
- satpy.composites.viirs._compute_tile_dist_and_bin_info(data: ndarray, valid_data_mask: ndarray, std_mult_cutoff: float, do_log_scale: bool, log_offset: float, clip_limit: float, slope_limit: float, number_of_bins: int, row_tiles: int, col_tiles: int, tile_size: int)[source]
- satpy.composites.viirs._get_cumul_bin_info_for_tile(num_row_tile, weight_row, num_col_tile, weight_col, all_cumulative_dist_functions, all_bin_information)[source]
- satpy.composites.viirs._histogram_equalization_helper(valid_data, number_of_bins, clip_limit=None, slope_limit=None)[source]
Calculate the simplest possible histogram equalization, using only valid data.
- Returns:
cumulative distribution function and bin information
- satpy.composites.viirs._histogram_equalize_one_tile(data, valid_data_mask, std_mult_cutoff, do_log_scale, log_offset, clip_limit, slope_limit, number_of_bins, num_row_tile, num_col_tile, tile_size)[source]
- satpy.composites.viirs._interpolate_local_equalized_tiles(data, out, mask_to_equalize, valid_data_mask, do_log_scale, log_offset, tile_weights, all_bin_information, all_cumulative_dist_functions, row_idx, col_idx, tile_size)[source]
- satpy.composites.viirs._linear_normalization_from_0to1(data, mask, theoretical_max, theoretical_min=0, message='normalizing equalized data to fit in 0 to 1 range')[source]
Do a linear normalization so all data is in the 0 to 1 range.
This is a sloppy but fast calculation that relies on parameters giving it the correct theoretical current max and min so it can scale the data accordingly.
- satpy.composites.viirs.histogram_equalization(data, mask_to_equalize, number_of_bins=1000, std_mult_cutoff=4.0, do_zerotoone_normalization=True, out=None)[source]
Perform a histogram equalization on the data.
Data is selected by the mask_to_equalize mask. The data will be separated into number_of_bins levels for equalization and outliers beyond +/- std_mult_cutoff*std will be ignored.
If do_zerotoone_normalization is True the data selected by mask_to_equalize will be returned in the 0 to 1 range. Otherwise the data selected by mask_to_equalize will be returned in the 0 to number_of_bins range.
Note: the data will be changed in place.
- satpy.composites.viirs.local_histogram_equalization(data, mask_to_equalize, valid_data_mask=None, number_of_bins=1000, std_mult_cutoff=3.0, do_zerotoone_normalization=True, local_radius_px: int = 300, clip_limit=60.0, slope_limit=3.0, do_log_scale=True, log_offset=1e-05, out=None)[source]
Equalize the provided data (in the mask_to_equalize) using adaptive histogram equalization.
Tiles of width/height (2 * local_radius_px + 1) will be calculated and results for each pixel will be bilinearly interpolated from the nearest 4 tiles when pixels fall near the edge of the image (there is no adjacent tile) the resultant interpolated sum from the available tiles will be multiplied to account for the weight of any missing tiles:
pixel total interpolated value = pixel available interpolated value / (1 - missing interpolation weight)
If
do_zerotoone_normalization
is True the data will be scaled so that all data in the mask_to_equalize falls between 0 and 1; otherwise the data in mask_to_equalize will all fall between 0 and number_of_bins.Returns: The equalized data
- satpy.composites.viirs.make_day_night_masks(solarZenithAngle, good_mask, highAngleCutoff, lowAngleCutoff, stepsDegrees=None)[source]
Generate masks for day, night, and twilight regions.
Masks are created from the provided solar zenith angle data.
Optionally provide the highAngleCutoff and lowAngleCutoff that define the limits of the terminator region (if no cutoffs are given the DEFAULT_HIGH_ANGLE and DEFAULT_LOW_ANGLE will be used).
Optionally provide the stepsDegrees that define how many degrees each “mixed” mask in the terminator region should be (if no stepsDegrees is given, the whole terminator region will be one mask).