:py:mod:`statgis.gee.landsat_functions` ======================================= .. py:module:: statgis.gee.landsat_functions .. autoapi-nested-parse:: Function to process Landsat SR Images. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: statgis.gee.landsat_functions.scaler statgis.gee.landsat_functions.cloud_mask statgis.gee.landsat_functions.rename_bands .. py:function:: scaler(image: ee.Image) -> ee.Image Scale optical bands to surface reflectance values and thermal bands to Kelvin. :param image: Landsat SR image. :type image: ee.Image :returns: **image** -- Image with bands scaled. :rtype: ee.Image .. rubric:: Example Scale an image: >>> import ee >>> from statgis.gee import landsat_functions >>> ee.Initialize() >>> poi = ee.Geometry.Point(-74.8180175, 10.9838119) >>> image = ( ... ee.ImageCollection("LANDSAT/LC09/C02/T1_L2") ... .filterBounds(poi) ... .first() ... ) >>> image = landsat_functions.scaler(image) Or scaler all image in a collection: >>> import ee >>> from statgis.gee import landsat_functions >>> ee.Initialize() >>> poi = ee.Geometry.Point(-74.8180175, 10.9838119) >>> image_collection = ( ... ee.ImageCollection("LANDSAT/LC09/C02/T1_L2") ... .filterBounds(poi) ... .map(landsat_functions.scaler) ... ) .. py:function:: cloud_mask(image: ee.Image, mask_snow: bool = False) -> ee.Image Mask pixels classified as clouds from QA_PIXEL band. :param image: Image to mask. :type image: ee.Image :param mask_snow: If `True` mask pixels classified as snow. If `False` mask only pixels classified as cloud. :type mask_snow: bool (optional) :returns: **image** -- Masked image. :rtype: ee.Image .. rubric:: Example >>> import ee >>> from statgis.gee import landsat_functions >>> ee.Initialize() >>> poi = ee.Geometry.Point(-74.8180175, 10.9838119) >>> image = ( ... ee.ImageCollection("LANDSAT/LC09/C02/T1_L2") ... .filterBounds(poi) ... .first() ... ) >>> image = landsat_functions.cloud_mask(image) On an image collection: >>> import ee >>> from statgis.gee import landsat_functions >>> ee.Initialize() >>> poi = ee.Geometry.Point(-74.8180175, 10.9838119) >>> image_collection = ( ... ee.ImageCollection("LANDSAT/LC09/C02/T1_L2") ... .filterBounds(poi) ... .map(landsat_functions.cloud_mask) ... ) .. py:function:: rename_bands(image: ee.Image) -> ee.Image Rename the bands from a Landsat Image. :param image: Image of interest. :type image: ee.Image :returns: **image** -- Image with bands renamed :rtype: ee.Image .. rubric:: Example Rename the bands in an image: >>> import ee >>> from statgis.gee import landsat_functions >>> ee.Initialize() >>> poi = ee.Geometry.Point(-74.8180175, 10.9838119) >>> image = ( ... ee.ImageCollection("LANDSAT/LC09/C02/T1_L2") ... .filterBounds(poi) ... .first() ... ) >>> image = landsat_functions.rename_bands(image) Also we can map the function to an image collection: >>> import ee >>> from statgis.gee import landsat_functions >>> ee.Initialize() >>> poi = ee.Geometry.Point(-74.8180175, 10.9838119) >>> image_collection = ( ... ee.ImageCollection("LANDSAT/LC09/C02/T1_L2") ... .filterBounds(poi) ... .map(landsat_functions.rename_bands) ... )