class EnhancedThematicMapperConfig(object): bands = OrderedDict([('1', Band('Blue', 1, [450, 520])), ('2', Band('Green', 2, [520, 600])), ('3', Band('Red', 3, [630, 690])), ('4', Band('NIR', 4, [760, 900])), ('5', Band('SWIR - 1', 5, [1550, 1750])), ('6_VCID_1', Band('Thermal', 6, [10400, 12500])), ('6_VCID_2', Band('Thermal', 7, [10400, 12500])), ('7', Band('SWIR - 2', 8, [2080, 2350])), ('8', Band('Panchromatic', 9, [520, 900]))])
def create_geotiff_bands(tif_path): """Reads the bands available in a 4-band (rgb + nir) GeoTIFF Args: tif_path (str): Path to local GeoTIFF file Returns: List[Band] list of the bands in the GeoTIFF """ bands = [] with rasterio.open(tif_path) as src: for band in src.indexes: colorinterp = src.colorinterp[band - 1] if colorinterp == ColorInterp.undefined: band_data = band_data_lookup["nir"] elif colorinterp.name in band_data_lookup: band_data = band_data_lookup[colorinterp.name] else: # If we get a name for a layer that we can't map to anything, log # and ignore it. logger.warning("Could not map layer with name %s", colorinterp.name) continue bands.append(Band(band_data[0], band, band_data[1])) return bands
def create_bands(resolution): """Create bands based on dict representation of bands in settings Args: resolution (str) resolution to create bands for (e.g. '15m') Returns: List[Band] """ try: band_dicts = band_lookup[resolution] except KeyError: raise KeyError('No resolutions could be found for resolution %s', resolution) return [Band(**band) for band in band_dicts]
def create_geotiff_bands(tif_path): """Reads the bands available in a 4-band (rgb + nir) GeoTIFF Args: tif_path (str): Path to local GeoTIFF file Returns: List[Band] list of the bands in the GeoTIFF """ bands = [] with rasterio.open(tif_path) as src: for band in src.indexes: colorinterp = src.colorinterp(band) if colorinterp == ColorInterp.undefined: band_data = band_data_lookup['nir'] else: band_data = band_data_lookup[colorinterp.name] bands.append(Band(band_data[0], band, band_data[1])) return bands
from rf.models import Band from rf.models import Scene from rf.uploads.geotiff import create_geotiff_image from rf.uploads.landsat8.io import get_tempdir from rf.uploads.modis.create_geotiff import create_geotiffs from rf.uploads.modis.download_modis import download_hdf from rf.utils.io import (IngestStatus, JobStatus, Visibility) logger = logging.getLogger(__name__) modis_configs = { 'a11b768b-d869-476e-a1ed-0ac3205ed761': { 'thumbnail_bands': [1, 4, 3], 'bands': { 'B01.tif': Band('Red', 0, [620, 670]), 'B02.tif': Band('NIR', 0, [841, 876]), 'B03.tif': Band('Blue', 0, [459, 479]), 'B04.tif': Band('Green', 0, [545, 565]), 'B05.tif': Band('SWIR - 1', 0, [1230, 1250]), 'B06.tif': Band('SWIR - 2', 0, [1628, 1652]), 'B07.tif': Band('SWIR - 3', 0, [2105, 2155]), 'B08.tif': Band('Reflectance Band Quality', 0, [0, 0]), 'B09.tif': Band('Solar Zenith Angle', 0, [0, 0]), 'B10.tif': Band('View Zenith Angle', 0, [0, 0]), 'B11.tif': Band('Relative Azimuth Angle', 0, [0, 0]), 'B12.tif': Band('State Flags', 0, [0, 0]), 'B13.tif': Band('Day of Year', 0, [0, 0]) } }, '55735945-9da5-47c3-8ae4-572b5e11205b': {
class MultiSpectralScannerConfig(object): bands = OrderedDict([('1', Band('Green', 1, [500, 600])), ('2', Band('Red', 2, [600, 700])), ('3', Band('NIR - 1', 3, [700, 800])), ('4', Band('NIR - 2', 4, [800, 1100]))])