Prepatcher
PrePatcher
dataclass
A class for preprocessing and saving patches from NetCDF files.
Attributes:
Name | Type | Description |
---|---|---|
read_path |
str
|
The path to the directory containing the NetCDF files. |
save_path |
str
|
The path to save the patches. |
patch_size |
int
|
The size of each patch. |
stride_size |
int
|
The stride size for generating patches. |
nan_cutoff |
float
|
The cutoff value for allowed NaN count in a patch. |
save_filetype |
str
|
The file type to save patches as. Options are [nc, np]. |
Methods:
Name | Description |
---|---|
nc_files |
Returns a list of all NetCDF filenames in the read_path directory. |
save_patches |
Preprocesses and saves patches from the NetCDF files. |
Source code in rs_tools/_src/preprocessing/prepatcher.py
nc_files: List[str]
property
Returns a list of all NetCDF filenames in the read_path directory.
Returns:
Type | Description |
---|---|
List[str]
|
List[str]: A list of NetCDF filenames. |
save_patches()
Preprocesses and saves patches from the NetCDF files.
Source code in rs_tools/_src/preprocessing/prepatcher.py
prepatch(read_path='./', save_path='./', patch_size=256, stride_size=256, nan_cutoff=0.5, save_filetype='nc')
Patches satellite data into smaller patches for training. Args: read_path (str, optional): The path to read the input files from. Defaults to "./". save_path (str, optional): The path to save the extracted patches. Defaults to "./". patch_size (int, optional): The size of each patch. Defaults to 256. stride_size (int, optional): The stride size for patch extraction. Defaults to 256. nan_cutoff (float): The cutoff value for allowed NaN count in a patch. Defaults to 0.1. save_filetype (str, optional): The file type to save patches as. Options are [nc, np]
Returns:
Type | Description |
---|---|
None |