This repository contains Python functions to process, normalize, and tile Synthetic Aperture Radar (SAR) datasets. The toolkit provides utilities to create tiles, normalize SAR data, and manage detrending processes, while supporting several SAR dataset formats.
- Dataset Tiling: Generate spatially consistent tiles from SAR datasets with configurable overlap and centering options.
- Detrending: Apply detrending processes based on dataset polarization.
- Multi-Format Support: Handle SAR dataset types such as GRD, RS2, and RCM.
- Point-based Tiling: Generate tiles around specific geographic locations.
- Customizable Variables: Retain only necessary variables in the processed tiles.
- Tile Saving: Save processed tiles in NetCDF format.
Install the grdtiler using pip:
pip install grdtiler
Or clone the repository and install dependencies manually:
git clone https://github.com/jean2262/grdtiler.git
cd grdtiler
To use this toolkit, install the following dependencies:
numpy
xarray
xsar
xsarsea
shapely
tqdm
logging
Install these dependencies using:
pip install numpy xarray xsar xsarsea shapely tqdm
from grdtiler import tiling_prod
dataset, tiles = tiling_prod(
path="/path/to/sar/dataset",
tile_size=17600,
resolution="400m",
detrend=True,
noverlap=32,
centering=False,
save=True,
save_dir="./tiles",
)
from grdtiler import make_detrend
processed_path = make_detrend(
path="/path/to/sar/dataset",
resolution="10m",
save_dir="./processed",
)
from shapely.geometry import Point
from grdtiler import tiling_by_point
posting_locations = [Point(-3.70379, 40.41678), Point(2.35222, 48.85661)]
dataset, point_tiles = tiling_by_point(
path="/path/to/sar/dataset",
posting_loc=posting_locations,
tile_size=1024,
resolution="10m",
detrend=True,
save=True,
save_dir="./point_tiles",
)
Tiles SAR datasets into square tiles.
Parameters:
path
(str): Path to the dataset.tile_size
(int or dict): Size of the tiles in meters.resolution
(str, optional): Resolution of the dataset.save
(bool, optional): Whether to save the tiles.
Returns:
- Processed dataset and tiles.
Applies detrending to SAR datasets.
Parameters:
path
(str): Path to the dataset.resolution
(str): Dataset resolution.save_dir
(str, optional): Directory to save the processed dataset.
Returns:
- Processed dataset.
Generates tiles centered around specified geographic points.
Parameters:
path
(str): Path to the dataset.posting_loc
(list): List ofshapely.geometry.Point
objects.tile_size
(int): Size of tiles in meters.
Returns:
- Processed dataset and point-centered tiles.
This toolkit uses Python's logging module for detailed progress information. To enable logging:
import logging
logging.basicConfig(level=logging.INFO)
Contributions are welcome! Please fork the repository and submit a pull request with your improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE
file for details.