# LandsatToolkit
**LandsatToolkit** is a versatile Python library designed to simplify the processing and analysis of satellite imagery from **Landsat 7, 8, and 9**. With an intuitive interface and robust functionality, it enables users to efficiently handle metadata, process imagery, and execute advanced scene operations. Whether you’re working on Earth observation, environmental monitoring, or geospatial analysis, LandsatToolkit provides the tools you need to unlock insights from satellite data with ease.
---
## Features
- **Metadata Management**:
- Extract metadata from Landsat imagery files.
- Parse and manipulate metadata for easy integration into workflows.
- **Satellite Data Processing**:
- Preprocess Landsat data, including calibration and rescaling.
- Support for band extraction and composition.
- **Scene Operations**:
- Perform calculations such as NDVI (Normalized Difference Vegetation Index).
- Create band combinations for visualizations (e.g., True Color, False Color).
- Apply scene-based adjustments like cloud masking.
- **Utility Functions**:
- General-purpose helper functions to simplify file management, data formatting, and other repetitive tasks.
- **Compatibility**:
- Works seamlessly with data from Landsat 7, 8, and 9.
---
## Requirements
Make sure the following libraries are installed in your Python environment:
- numpy
- shutil
- rasterio
---
## Installation
To install **LandsatToolkit**, follow these steps:
1. **Clone the Repository**:
Begin by cloning the repository from GitHub to your local machine.
```bash
git clone https://github.com/AmirDonyadide/LandsatToolkit.git
```
2. **Activate the Appropriate Python Environment**:
Open your terminal and activate the Python environment where you want to install the library.
```bash
conda activate your_environment_name
```
3. **Navigate to the Repository Folder**:
Change the directory to the folder where the repository is located.
```bash
cd LandsatToolkit
```
4. **Install the Library**:
Use pip to install the library in editable mode.
```bash
pip install -e .
```
After installation, you can import and use **LandsatToolkit** in your Python projects.
---
## Getting Started
### Importing the Library
Start by importing the required modules from the library:
```python
from LandsatToolkit.data_processor import SatelliteDataProcessor
```
### Example Usage
#### Initialize the processor
```python
data_folder = SatelliteDataProcessor(input_folder="path/to/Landsat/files")
```
#### Explanation:
- `input_folder` *(str)*: The path to the folder containing raw Landsat data files.
- The `SatelliteDataProcessor` instance is now ready to process raw data, extract metadata, and perform other operations on the provided data.
#### Extract Metadata
You can extract metadata from Landsat scenes using the `extract_metadata` method. The method allows flexibility with parameters like `output_folder` and `scene_id`.
```python
# Extract metadata for all scenes (output folder will be created automatically)
data_folder.extract_metadata()
# Extract metadata for a specific scene ID (output folder will be created automatically)
data_folder.extract_metadata(scene_id="LC08_L1TP_034032_20230712_20230723_02_T1")
# Extract metadata for multiple scene IDs with a custom output folder
scene_ids = ["LC08_L1TP_034032_20230712_20230723_02_T1", "LC08_L1TP_034033_20230712_20230723_02_T1"]
data_folder.extract_metadata(output_folder="custom_folder", scene_id=scene_ids)
```
##### Parameters:
- `output_folder` *(optional, str)*:
- Specifies the folder where extracted metadata will be saved.
- If not provided, a folder named `output_metadata_<timestamp>` will be created automatically in the current directory.
- `scene_id` *(optional, str or list of str)*:
- A single scene ID or a list of scene IDs to extract metadata for.
- If not provided, metadata for all scenes in the `data_folder` will be extracted.
#### Calculate Indices
You can calculate indices from Landsat scenes using the `indice_calculator` method. The method allows flexibility with parameters like `output_folder` , `indices` and `scene_id`.
```python
# Extract indices for all scenes and all indices (output folder will be created automatically)
data_folder.indice_calculator()
# Extract indices for a specific scene ID and all indices (output folder will be created automatically)
data_folder.indice_calculator(scene_id="LC08_L1TP_034032_20230712_20230723_02_T1")
# Extract indice for multiple scene IDs with a custom output folder
scene_ids = ["LC08_L1TP_034032_20230712_20230723_02_T1", "LC08_L1TP_034033_20230712_20230723_02_T1"]
data_folder.extract_metadata(output_folder="custom_folder", indices="NDVI" ,scene_id=scene_ids)
```
##### Parameters:
- `output_folder` *(optional, str)*:
- Specifies the folder where extracted indices will be saved.
- If not provided, a folder named `output_indices_<timestamp>` will be created automatically in the current directory.
- `indices` *(optional, str or list of str)*:
- A single indice or a list of indices to extract indice for.
- If not provided, indices for all scenes in the `data_folder` will be extracted.
- `scene_id` *(optional, str or list of str)*:
- A single scene ID or a list of scene IDs to extract metadata for.
- If not provided, indices for all scenes in the `data_folder` will be extracted.
#### Organize Data
You can organize data from Landsat scenes using the `organize_data` method. The method allows flexibility with parameter like `output_folder` .
```python
# Organize files for all scenes (output folder will be created automatically)
data_folder.organize_data()
# Extract indices for a specific scene ID and all indices (output folder will be created automatically)
data_folder.organize_data(output_folder="custom_folder")
```
##### Parameters:
- `output_folder` *(optional, str)*:
- Specifies the folder where extracted indices will be saved.
- If not provided, a folder named `output_organized_<timestamp>` will be created automatically in the current directory.
#### Reproject Bands
You can reproject bands from Landsat scenes using the `reproject` method. The method allows flexibility with parameters like `output_folder` , `scene_id` and `target_crs`.
```python
# Reproject bands for all scenes (output folder will be created automatically)
data_folder.reproject(target_crs="EPSG:32633")
# Reproject bands for a specific scene ID (output folder will be created automatically)
data_folder.reproject(scene_id="LC08_L1TP_034032_20230712_20230723_02_T1",target_crs="EPSG:32633")
# Reproject bands for multiple scene IDs with a custom output folder
scene_ids = ["LC08_L1TP_034032_20230712_20230723_02_T1", "LC08_L1TP_034033_20230712_20230723_02_T1"]
data_folder.reproject(scene_id="LC08_L1TP_034032_20230712_20230723_02_T1", scene_id=scene_id, target_crs="EPSG:32633")
```
##### Parameters:
- `output_folder` *(optional, str)*:
- Specifies the folder where extracted indices will be saved.
- If not provided, a folder named `output_indices_<timestamp>` will be created automatically in the current directory.
- `scene_id` *(optional, str or list of str)*:
- A single scene ID or a list of scene IDs to extract metadata for.
- If not provided, indices for all scenes in the `data_folder` will be extracted.
- `target_crs` *(str)*:
- If not provided, appropriate error will be shown.
#### Merge Bands
You can merge bands from Landsat scenes using the `merge_bands` method. The method allows flexibility with parameters like `output_folder` , `scene_id` and `bands`.
```python
# Merge bands for all scenes and all bands (output folder will be created automatically)
data_folder.merge_bands()
# Merge bands for a specific scene ID and all bands (output folder will be created automatically)
data_folder.merge_bands(scene_id="LC08_L1TP_034032_20230712_20230723_02_T1")
# Merge specific bands for all scenes(output folder will be created automatically)
data_folder.merge_bands(bands=["B1", "B2", "B3"])
# Merge bands for multiple scene IDs with a custom output folder and specific bands
scene_ids = ["LC08_L1TP_034032_20230712_20230723_02_T1", "LC08_L1TP_034033_20230712_20230723_02_T1"]
data_folder.merge_bands(scene_id="LC08_L1TP_034032_20230712_20230723_02_T1", scene_id=scene_id, bands=["B1", "B2", "B3"])
```
##### Parameters:
- `output_folder` *(optional, str)*:
- Specifies the folder where extracted indices will be saved.
- If not provided, a folder named `output_indices_<timestamp>` will be created automatically in the current directory.
- `scene_id` *(optional, str or list of str)*:
- A single scene ID or a list of scene IDs to extract metadata for.
- If not provided, indices for all scenes in the `data_folder` will be extracted.
- `bands` *(optional, str or list of str)*:
- If not provided, all bands will be considered.
---
## Project Structure
Here’s an overview of the directory structure:
```
LandsatToolkit/
├── LandsatToolkit/
│ ├── __init__.py
│ ├── data_processor.py # Modules for Landsat image preprocessing
│ ├── metadata_tools.py # Functions for metadata extraction
│ ├── scene_tools.py # Scene-based operations like NDVI calculation
│ ├── utils.py # General utility functions
├── tests/
│ ├── __init__.py
│ ├── test_data_processor.py
│ ├── test_metadata_tools.py
│ ├── test_scene_tools.py
│ ├── test_utils.py
├── LICENSE # MIT License details
├── README.md # Project documentation
├── VERSION # Current version of the library
├── setup.py # Installation script
```
---
## Versioning
Current version: **1.1.1**
---
## Roadmap
Planned features and updates include:
- Adding support for Sentinel 2 , Landsat 5 and earlier datasets.
- Developing an interactive visualization module for Landsat data.
---
## Contributing
Contributions are welcome! If you have suggestions for improvements or additional features, feel free to open an issue or submit a pull request.
1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Submit a pull request detailing your changes.
---
## License
This project is licensed under the **MIT License**. See the `LICENSE` file for more details.
---
## Contact
If you have any questions or need support, feel free to reach out:
- **GitHub Issues**: Open an issue in the repository.
- **Email**: [amirhossein.donyadidegan@mail.polimi.it]
---
Raw data
{
"_id": null,
"home_page": "https://github.com/AmirDonyadide/LandsatToolkit",
"name": "LandsatToolkit",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "satellite processing, remote sensing, GIS, raster data, satellite imagery, Landsat, LandsatToolkit",
"author": "Amirhossein Donyadidegan, Mohammad Kord Gholiabadi",
"author_email": "amirhossein.donyadidegan@mail.polimi.it, mohammad.kordgholiabad@mail.polimi.it",
"download_url": "https://files.pythonhosted.org/packages/52/8e/776d359a8deab3ac6a863d855df95bdb252e3927966a0728c12dac7bdcbb/landsattoolkit-1.0.0.tar.gz",
"platform": null,
"description": "# LandsatToolkit\n\n**LandsatToolkit** is a versatile Python library designed to simplify the processing and analysis of satellite imagery from **Landsat 7, 8, and 9**. With an intuitive interface and robust functionality, it enables users to efficiently handle metadata, process imagery, and execute advanced scene operations. Whether you\u2019re working on Earth observation, environmental monitoring, or geospatial analysis, LandsatToolkit provides the tools you need to unlock insights from satellite data with ease.\n\n---\n\n## Features\n\n- **Metadata Management**:\n - Extract metadata from Landsat imagery files.\n - Parse and manipulate metadata for easy integration into workflows.\n- **Satellite Data Processing**:\n - Preprocess Landsat data, including calibration and rescaling.\n - Support for band extraction and composition.\n- **Scene Operations**:\n - Perform calculations such as NDVI (Normalized Difference Vegetation Index).\n - Create band combinations for visualizations (e.g., True Color, False Color).\n - Apply scene-based adjustments like cloud masking.\n- **Utility Functions**:\n - General-purpose helper functions to simplify file management, data formatting, and other repetitive tasks.\n- **Compatibility**:\n - Works seamlessly with data from Landsat 7, 8, and 9.\n\n---\n\n## Requirements\n\nMake sure the following libraries are installed in your Python environment:\n- numpy\n-\tshutil\n- rasterio\n\n---\n\n## Installation\n\nTo install **LandsatToolkit**, follow these steps:\n\n1. **Clone the Repository**: \n Begin by cloning the repository from GitHub to your local machine.\n ```bash\n git clone https://github.com/AmirDonyadide/LandsatToolkit.git\n ```\n\n2. **Activate the Appropriate Python Environment**: \n Open your terminal and activate the Python environment where you want to install the library.\n ```bash\n conda activate your_environment_name\n ```\n\n3. **Navigate to the Repository Folder**: \n Change the directory to the folder where the repository is located.\n ```bash\n cd LandsatToolkit\n ```\n\n4. **Install the Library**: \n Use pip to install the library in editable mode.\n ```bash\n pip install -e .\n ```\n\nAfter installation, you can import and use **LandsatToolkit** in your Python projects.\n\n---\n\n## Getting Started\n\n### Importing the Library\n\nStart by importing the required modules from the library:\n\n```python\nfrom LandsatToolkit.data_processor import SatelliteDataProcessor\n```\n\n### Example Usage\n\n#### Initialize the processor\n```python\ndata_folder = SatelliteDataProcessor(input_folder=\"path/to/Landsat/files\")\n```\n #### Explanation:\n- `input_folder` *(str)*: The path to the folder containing raw Landsat data files. \n- The `SatelliteDataProcessor` instance is now ready to process raw data, extract metadata, and perform other operations on the provided data.\n\n\n#### Extract Metadata\n\nYou can extract metadata from Landsat scenes using the `extract_metadata` method. The method allows flexibility with parameters like `output_folder` and `scene_id`.\n\n```python\n# Extract metadata for all scenes (output folder will be created automatically)\ndata_folder.extract_metadata()\n\n# Extract metadata for a specific scene ID (output folder will be created automatically)\ndata_folder.extract_metadata(scene_id=\"LC08_L1TP_034032_20230712_20230723_02_T1\")\n\n# Extract metadata for multiple scene IDs with a custom output folder\nscene_ids = [\"LC08_L1TP_034032_20230712_20230723_02_T1\", \"LC08_L1TP_034033_20230712_20230723_02_T1\"]\ndata_folder.extract_metadata(output_folder=\"custom_folder\", scene_id=scene_ids)\n```\n\n##### Parameters:\n- `output_folder` *(optional, str)*: \n - Specifies the folder where extracted metadata will be saved. \n - If not provided, a folder named `output_metadata_<timestamp>` will be created automatically in the current directory.\n \n- `scene_id` *(optional, str or list of str)*: \n - A single scene ID or a list of scene IDs to extract metadata for. \n - If not provided, metadata for all scenes in the `data_folder` will be extracted.\n\n\n#### Calculate Indices\n\nYou can calculate indices from Landsat scenes using the `indice_calculator` method. The method allows flexibility with parameters like `output_folder` , `indices` and `scene_id`.\n\n```python\n# Extract indices for all scenes and all indices (output folder will be created automatically)\ndata_folder.indice_calculator()\n\n# Extract indices for a specific scene ID and all indices (output folder will be created automatically)\ndata_folder.indice_calculator(scene_id=\"LC08_L1TP_034032_20230712_20230723_02_T1\")\n\n# Extract indice for multiple scene IDs with a custom output folder\nscene_ids = [\"LC08_L1TP_034032_20230712_20230723_02_T1\", \"LC08_L1TP_034033_20230712_20230723_02_T1\"]\ndata_folder.extract_metadata(output_folder=\"custom_folder\", indices=\"NDVI\" ,scene_id=scene_ids)\n```\n\n##### Parameters:\n- `output_folder` *(optional, str)*: \n - Specifies the folder where extracted indices will be saved. \n - If not provided, a folder named `output_indices_<timestamp>` will be created automatically in the current directory.\n\n- `indices` *(optional, str or list of str)*: \n - A single indice or a list of indices to extract indice for. \n - If not provided, indices for all scenes in the `data_folder` will be extracted.\n \n- `scene_id` *(optional, str or list of str)*: \n - A single scene ID or a list of scene IDs to extract metadata for. \n - If not provided, indices for all scenes in the `data_folder` will be extracted.\n\n\n#### Organize Data\n\nYou can organize data from Landsat scenes using the `organize_data` method. The method allows flexibility with parameter like `output_folder` .\n\n```python\n# Organize files for all scenes (output folder will be created automatically)\ndata_folder.organize_data()\n\n# Extract indices for a specific scene ID and all indices (output folder will be created automatically)\ndata_folder.organize_data(output_folder=\"custom_folder\")\n```\n\n##### Parameters:\n- `output_folder` *(optional, str)*: \n - Specifies the folder where extracted indices will be saved. \n - If not provided, a folder named `output_organized_<timestamp>` will be created automatically in the current directory.\n\n\n#### Reproject Bands\n\nYou can reproject bands from Landsat scenes using the `reproject` method. The method allows flexibility with parameters like `output_folder` , `scene_id` and `target_crs`.\n\n```python\n# Reproject bands for all scenes (output folder will be created automatically)\ndata_folder.reproject(target_crs=\"EPSG:32633\")\n\n# Reproject bands for a specific scene ID (output folder will be created automatically)\ndata_folder.reproject(scene_id=\"LC08_L1TP_034032_20230712_20230723_02_T1\",target_crs=\"EPSG:32633\")\n\n# Reproject bands for multiple scene IDs with a custom output folder\nscene_ids = [\"LC08_L1TP_034032_20230712_20230723_02_T1\", \"LC08_L1TP_034033_20230712_20230723_02_T1\"]\ndata_folder.reproject(scene_id=\"LC08_L1TP_034032_20230712_20230723_02_T1\", scene_id=scene_id, target_crs=\"EPSG:32633\")\n```\n\n##### Parameters:\n- `output_folder` *(optional, str)*: \n - Specifies the folder where extracted indices will be saved. \n - If not provided, a folder named `output_indices_<timestamp>` will be created automatically in the current directory.\n \n- `scene_id` *(optional, str or list of str)*: \n - A single scene ID or a list of scene IDs to extract metadata for. \n - If not provided, indices for all scenes in the `data_folder` will be extracted.\n\n- `target_crs` *(str)*: \n - If not provided, appropriate error will be shown.\n\n\n#### Merge Bands\n\nYou can merge bands from Landsat scenes using the `merge_bands` method. The method allows flexibility with parameters like `output_folder` , `scene_id` and `bands`.\n\n```python\n# Merge bands for all scenes and all bands (output folder will be created automatically)\ndata_folder.merge_bands()\n\n# Merge bands for a specific scene ID and all bands (output folder will be created automatically)\ndata_folder.merge_bands(scene_id=\"LC08_L1TP_034032_20230712_20230723_02_T1\")\n\n# Merge specific bands for all scenes(output folder will be created automatically)\ndata_folder.merge_bands(bands=[\"B1\", \"B2\", \"B3\"])\n\n# Merge bands for multiple scene IDs with a custom output folder and specific bands\nscene_ids = [\"LC08_L1TP_034032_20230712_20230723_02_T1\", \"LC08_L1TP_034033_20230712_20230723_02_T1\"]\ndata_folder.merge_bands(scene_id=\"LC08_L1TP_034032_20230712_20230723_02_T1\", scene_id=scene_id, bands=[\"B1\", \"B2\", \"B3\"])\n```\n\n##### Parameters:\n- `output_folder` *(optional, str)*: \n - Specifies the folder where extracted indices will be saved. \n - If not provided, a folder named `output_indices_<timestamp>` will be created automatically in the current directory.\n \n- `scene_id` *(optional, str or list of str)*: \n - A single scene ID or a list of scene IDs to extract metadata for. \n - If not provided, indices for all scenes in the `data_folder` will be extracted.\n\n- `bands` *(optional, str or list of str)*: \n - If not provided, all bands will be considered.\n\n---\n\n## Project Structure\n\nHere\u2019s an overview of the directory structure:\n\n```\nLandsatToolkit/\n\u251c\u2500\u2500 LandsatToolkit/\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 data_processor.py # Modules for Landsat image preprocessing\n\u2502 \u251c\u2500\u2500 metadata_tools.py # Functions for metadata extraction\n\u2502 \u251c\u2500\u2500 scene_tools.py # Scene-based operations like NDVI calculation\n\u2502 \u251c\u2500\u2500 utils.py # General utility functions\n\u251c\u2500\u2500 tests/\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 test_data_processor.py\n\u2502 \u251c\u2500\u2500 test_metadata_tools.py\n\u2502 \u251c\u2500\u2500 test_scene_tools.py\n\u2502 \u251c\u2500\u2500 test_utils.py\n\u251c\u2500\u2500 LICENSE # MIT License details\n\u251c\u2500\u2500 README.md # Project documentation\n\u251c\u2500\u2500 VERSION # Current version of the library\n\u251c\u2500\u2500 setup.py # Installation script\n```\n\n---\n\n## Versioning\n\nCurrent version: **1.1.1**\n\n---\n\n## Roadmap\n\nPlanned features and updates include:\n\n- Adding support for Sentinel 2 , Landsat 5 and earlier datasets.\n- Developing an interactive visualization module for Landsat data.\n\n---\n\n## Contributing\n\nContributions are welcome! If you have suggestions for improvements or additional features, feel free to open an issue or submit a pull request.\n\n1. Fork the repository.\n2. Create a new branch for your feature or bug fix.\n3. Submit a pull request detailing your changes.\n\n---\n\n## License\n\nThis project is licensed under the **MIT License**. See the `LICENSE` file for more details.\n\n---\n\n## Contact\n\nIf you have any questions or need support, feel free to reach out:\n\n- **GitHub Issues**: Open an issue in the repository.\n- **Email**: [amirhossein.donyadidegan@mail.polimi.it]\n\n---\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python library for processing and analyzing satellite data.",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/AmirDonyadide/LandsatToolkit"
},
"split_keywords": [
"satellite processing",
" remote sensing",
" gis",
" raster data",
" satellite imagery",
" landsat",
" landsattoolkit"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6b94e8540ebba9074bd2b190b1934e06b77c1ba0a16e33d1fbb14a102d01760e",
"md5": "adc8958d44855cd007ddfd8b3bd7ee82",
"sha256": "13723a7b9755de9807c14b0e9139db7ad379a074e66f808ce8fa99add55fc8a9"
},
"downloads": -1,
"filename": "LandsatToolkit-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "adc8958d44855cd007ddfd8b3bd7ee82",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 20695,
"upload_time": "2025-01-05T18:47:37",
"upload_time_iso_8601": "2025-01-05T18:47:37.500297Z",
"url": "https://files.pythonhosted.org/packages/6b/94/e8540ebba9074bd2b190b1934e06b77c1ba0a16e33d1fbb14a102d01760e/LandsatToolkit-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "528e776d359a8deab3ac6a863d855df95bdb252e3927966a0728c12dac7bdcbb",
"md5": "3b35a0fad83e4f4bebcedaff0d4720fa",
"sha256": "25bde5ecc273b9aa62237e118ac85020987b0eba67d3dc44e367b9f8a6571f8e"
},
"downloads": -1,
"filename": "landsattoolkit-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "3b35a0fad83e4f4bebcedaff0d4720fa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 49368,
"upload_time": "2025-01-05T18:47:39",
"upload_time_iso_8601": "2025-01-05T18:47:39.224082Z",
"url": "https://files.pythonhosted.org/packages/52/8e/776d359a8deab3ac6a863d855df95bdb252e3927966a0728c12dac7bdcbb/landsattoolkit-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-05 18:47:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AmirDonyadide",
"github_project": "LandsatToolkit",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "landsattoolkit"
}