geographer.converters package¶
Submodules¶
geographer.converters.combine_remove_vector_classes module¶
Combine and/or remove vector feature classes.
Create a new dataset from an existing one by combining and/or removing vector feature classes.
- class geographer.converters.combine_remove_vector_classes.DSConverterCombineRemoveClasses(**data)[source]¶
Bases:
DSCreatorFromSourceClass for combining and/or removing vector feature classes.
For creating a new dataset from an existing one by combining and/or removing vector feature classes.
- Parameters:
source_data_dir (Path)
target_data_dir (Path)
name (str)
classes (list[str | list[str]])
new_class_names (list[str] | None)
class_separator (str)
new_background_class (str | None)
remove_rasters (bool)
label_maker (LabelMaker | None)
extra_data (Any)
- Return type:
None
- field class_separator: str = '+'¶
Separator used when combining class names.
- Validated by:
validate_connectors
- field classes: list[Union[str, list[str]]] [Required]¶
Classes to keep and combine. See docstring.
- Validated by:
validate_connectors
- field label_maker: Optional[LabelMaker] = None¶
Optional LabelMaker. If given, will update labels.
- Validated by:
validate_connectors
- field name: str [Required]¶
Name of dataset creator. Used as part of filename when saving.
- Validated by:
validate_connectors
- field new_background_class: Optional[str] = None¶
Class to be set as new background class
- Validated by:
validate_connectors
- field new_class_names: Optional[list[str]] = None¶
Names of new classes
- Validated by:
validate_connectors
- field remove_rasters: bool = True¶
Whether to remove rasters not containing new classes from disk
- Validated by:
validate_connectors
- field source_data_dir: Path [Required]¶
- Validated by:
validate_connectorsvalidate_source_data_dir
- field target_data_dir: Path [Required]¶
- Validated by:
validate_connectors
- classmethod from_json_file(json_file_path, constructor_symbol_table=None)¶
Load and return saved BaseModel.
- Return type:
Any- Parameters:
json_file_path (Path | str)
constructor_symbol_table (dict[str, Any] | None)
- save()¶
Save to update folder in source_data_dir.
- property source_connector¶
Connector in source_data_dir.
- property target_connector¶
Connector in target_data_dir.
geographer.converters.label_type_soft_to_categorical module¶
Create a dataset with soft-categorical labels.
Create a dataset with soft-categorical labels from a dataset with categorical labels.
- class geographer.converters.label_type_soft_to_categorical.DSConverterSoftCatToCat(**data)[source]¶
Bases:
DSCreatorFromSource,RasterBandsGetterMixInCreate a dataset with soft-categorical labels.
Assumes source dataset has categorical labels.
- Parameters:
source_data_dir (Path)
target_data_dir (Path)
name (str)
label_maker (LabelMaker | None)
extra_data (Any)
- Return type:
None
-
field label_maker:
Optional[LabelMaker] = None¶ Optional LabelMaker. If given, will create labelsin target dataset.
- Validated by:
validate_connectors
- field name: str [Required]¶
Name of dataset creator. Used as part of filename when saving.
- Validated by:
validate_connectors
- field source_data_dir: Path [Required]¶
- Validated by:
validate_connectorsvalidate_source_data_dir
- field target_data_dir: Path [Required]¶
- Validated by:
validate_connectors
- classmethod from_json_file(json_file_path, constructor_symbol_table=None)¶
Load and return saved BaseModel.
- Return type:
Any- Parameters:
json_file_path (Path | str)
constructor_symbol_table (dict[str, Any] | None)
- save()¶
Save to update folder in source_data_dir.
- property source_connector¶
Connector in source_data_dir.
- property target_connector¶
Connector in target_data_dir.
geographer.converters.tif_to_npy module¶
Convert a dataset of GeoTiffs to NPYs.
- class geographer.converters.tif_to_npy.DSConverterGeoTiffToNpy(**data)[source]¶
Bases:
DSCreatorFromSourceWithBands,RasterBandsGetterMixInConvert a dataset of GeoTiffs to NPYs.
- Parameters:
source_data_dir (Path)
target_data_dir (Path)
name (str)
bands (dict[str, list[int] | None] | None)
squeeze_label_channel_dim_if_single_channel (bool)
channels_first_or_last_in_npy (Literal['last', 'first'])
extra_data (Any)
- Return type:
None
- field bands: Optional[dict[str, Optional[list[int]]]] = None¶
keys: raster directory names, values: list of band indices to keep, starting with 1
- Validated by:
validate_connectors
-
field channels_first_or_last_in_npy:
Literal['last','first'] = 'last'¶ Ignoring squeezing: ‘last’ -> (height, width, channels), ‘first’ -> (channels, height, width).
- Validated by:
validate_connectors
- field name: str [Required]¶
Name of dataset creator. Used as part of filename when saving.
- Validated by:
validate_connectors
- field source_data_dir: Path [Required]¶
- Validated by:
validate_connectorsvalidate_source_data_dir
-
field squeeze_label_channel_dim_if_single_channel:
bool= True¶ whether to squeeze the label channel dim/axis if possible
- Validated by:
validate_connectors
- field target_data_dir: Path [Required]¶
- Validated by:
validate_connectors
- classmethod from_json_file(json_file_path, constructor_symbol_table=None)¶
Load and return saved BaseModel.
- Return type:
Any- Parameters:
json_file_path (Path | str)
constructor_symbol_table (dict[str, Any] | None)
- save()¶
Save to update folder in source_data_dir.
- property source_connector¶
Connector in source_data_dir.
- property target_connector¶
Connector in target_data_dir.