earthlib.sensors
Sensor definitions for common earth observing instruments.
Sensor
dataclass
¶
Base class for defining EO sensor specifications.
Source code in earthlib/sensors.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
get_band_descriptions(sensor)
¶
Returns a list band name descriptions by sensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor
|
str
|
the name of the sensor (from earthlib.list_sensors()). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bands |
list[str] | None
|
a list of sensor-specific band descriptions, or None when undescribed. |
Source code in earthlib/sensors.py
1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 | |
get_band_indices(custom_bands, sensor)
¶
Cross-references a list of bands passed as strings to the 0-based integer indices
Indices are returned in the order the bands were requested.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
custom_bands
|
list[str] | str
|
a band name, or a list of band names. |
required |
sensor
|
str
|
a string sensor type for indexing the supported collections. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
indices |
list[int]
|
list of integer band indices. |
Raises:
| Type | Description |
|---|---|
SensorError
|
when the sensor is invalid, has no named bands, or when a requested band is not one of the sensor's bands. |
Example
indices = get_band_indices(["SR_B4", "SR_B3", "SR_B2"], "Landsat8")
Source code in earthlib/sensors.py
1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 | |
get_bands(sensor)
¶
Returns a list of available band names by sensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor
|
str
|
the name of the sensor (from earthlib.list_sensors()). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bands |
list[str] | None
|
a list of sensor-specific band names, or None when unnamed. |
Source code in earthlib/sensors.py
1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 | |
get_collection_name(sensor)
¶
Returns the earth engine collection name for a specific satellite sensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor
|
str
|
the name of the sensor (from earthlib.list_sensors()). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
collection |
str | None
|
the earth engine collection, or None for sensors that have none. |
Source code in earthlib/sensors.py
1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 | |
get_scaler(sensor)
¶
Returns the scaling factor to convert sensor data to percent reflectance (0-1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor
|
str
|
the name of the sensor (from earthlib.list_sensors()). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
scaler |
float
|
the scale factor to multiply. |
Source code in earthlib/sensors.py
1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 | |
get_sensor(sensor)
¶
Get a copy of the sensor instance, indexed by key.
A copy is returned so callers cannot mutate the shared module-level sensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor
|
str
|
the name of the sensor (from earthlib.list_sensors()). |
required |
Returns:
| Type | Description |
|---|---|
Sensor
|
a copy of the sensor definition. |
Raises:
| Type | Description |
|---|---|
SensorError
|
when an invalid sensor name is passed. |
Example
landsat = get_sensor("Landsat8")
Source code in earthlib/sensors.py
1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 | |
list_sensors()
¶
Returns a list of the supported sensor image collections.
Returns:
| Name | Type | Description |
|---|---|---|
sensors |
list
|
a list of supported sensors using the names referenced by this package. |
Source code in earthlib/sensors.py
1721 1722 1723 1724 1725 1726 1727 1728 | |
validate_sensor(sensor)
¶
Verify a string sensor ID is valid, raise an error otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor
|
str
|
the name of the sensor (from earthlib.list_sensors()). |
required |
Raises:
| Type | Description |
|---|---|
SensorError
|
when an invalid sensor name is passed |
Source code in earthlib/sensors.py
1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 | |