XarraySourceConfig#
Note
All Configs are derived from rastervision.pipeline.config.Config
, which itself is a pydantic Model.
- pydantic model XarraySourceConfig[source]#
Configure an
XarraySource
.Show JSON schema
{ "title": "XarraySourceConfig", "description": "Configure an :class:`.XarraySource`.", "type": "object", "properties": { "channel_order": { "title": "Channel Order", "description": "The sequence of channel indices to use when reading imagery.", "type": "array", "items": { "type": "integer" } }, "transformers": { "title": "Transformers", "default": [], "type": "array", "items": { "$ref": "#/definitions/RasterTransformerConfig" } }, "bbox": { "title": "Bbox", "description": "User-specified bbox in pixel coords in the form (ymin, xmin, ymax, xmax). Useful for cropping the raster source so that only part of the raster is read from.", "type": "array", "minItems": 4, "maxItems": 4, "items": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ] }, "type_hint": { "title": "Type Hint", "default": "xarray_source", "enum": [ "xarray_source" ], "type": "string" }, "stac": { "title": "Stac", "description": "STAC Item or ItemCollection to build the DataArray from.", "anyOf": [ { "$ref": "#/definitions/STACItemConfig" }, { "$ref": "#/definitions/STACItemCollectionConfig" } ] }, "allow_streaming": { "title": "Allow Streaming", "description": "If False, load the entire DataArray into memory. Defaults to True.", "default": true, "type": "boolean" }, "bbox_map_coords": { "title": "Bbox Map Coords", "description": "Optional user-specified bbox in EPSG:4326 coords of the form (ymin, xmin, ymax, xmax). Useful for cropping the raster source so that only part of the raster is read from. This is ignored if bbox is also specified. Defaults to None.", "type": "array", "minItems": 4, "maxItems": 4, "items": [ { "type": "number" }, { "type": "number" }, { "type": "number" }, { "type": "number" } ] }, "temporal": { "title": "Temporal", "description": "Whether the data is a time-series.", "default": false, "type": "boolean" }, "stackstac_args": { "title": "Stackstac Args", "description": "Optional arguments to pass to stackstac.stack().", "default": {}, "type": "object" } }, "required": [ "stac" ], "additionalProperties": false, "definitions": { "RasterTransformerConfig": { "title": "RasterTransformerConfig", "description": "Configure a :class:`.RasterTransformer`.", "type": "object", "properties": { "type_hint": { "title": "Type Hint", "default": "raster_transformer", "enum": [ "raster_transformer" ], "type": "string" } }, "additionalProperties": false }, "STACItemConfig": { "title": "STACItemConfig", "description": "Specify a raster via a STAC Item.", "type": "object", "properties": { "uri": { "title": "Uri", "description": "URI to a JSON-serialized STAC Item.", "type": "string" }, "assets": { "title": "Assets", "description": "Subset of assets to use. This should be a list of asset keys", "type": "array", "items": { "type": "string" } }, "type_hint": { "title": "Type Hint", "default": "stac_item", "enum": [ "stac_item" ], "type": "string" } }, "required": [ "uri" ], "additionalProperties": false }, "STACItemCollectionConfig": { "title": "STACItemCollectionConfig", "description": "Specify a raster via a STAC ItemCollection.", "type": "object", "properties": { "uri": { "title": "Uri", "description": "URI to a JSON-serialized STAC ItemCollection.", "type": "string" }, "assets": { "title": "Assets", "description": "Subset of assets to use. This should be a list of asset keys", "type": "array", "items": { "type": "string" } }, "type_hint": { "title": "Type Hint", "default": "stac_item_collection", "enum": [ "stac_item_collection" ], "type": "string" } }, "required": [ "uri" ], "additionalProperties": false } } }
- Config
extra: str = forbid
validate_assignment: bool = True
- Fields
- field allow_streaming: bool = True#
If False, load the entire DataArray into memory. Defaults to True.
- field bbox: Optional[Tuple[int, int, int, int]] = None#
User-specified bbox in pixel coords in the form (ymin, xmin, ymax, xmax). Useful for cropping the raster source so that only part of the raster is read from.
- field bbox_map_coords: Optional[Tuple[float, float, float, float]] = None#
Optional user-specified bbox in EPSG:4326 coords of the form (ymin, xmin, ymax, xmax). Useful for cropping the raster source so that only part of the raster is read from. This is ignored if bbox is also specified. Defaults to None.
- field channel_order: Optional[List[int]] = None#
The sequence of channel indices to use when reading imagery.
- field stac: Union[STACItemConfig, STACItemCollectionConfig] [Required]#
STAC Item or ItemCollection to build the DataArray from.
- field transformers: List[RasterTransformerConfig] = []#
- build(tmp_dir: Optional[str] = None, use_transformers: bool = True) XarraySource [source]#
Build an instance of the corresponding type of object using this config.
For example, BackendConfig will build a Backend object. The arguments to this method will vary depending on the type of Config.
- Parameters
- Return type
- recursive_validate_config()#
Recursively validate hierarchies of Configs.
This uses reflection to call validate_config on a hierarchy of Configs using a depth-first pre-order traversal.
- revalidate()#
Re-validate an instantiated Config.
Runs all Pydantic validators plus self.validate_config().
Adapted from: https://github.com/samuelcolvin/pydantic/issues/1864#issuecomment-679044432
- update(pipeline: Optional[RVPipelineConfig] = None, scene: Optional[SceneConfig] = None) None #
Update any fields before validation.
Subclasses should override this to provide complex default behavior, for example, setting default values as a function of the values of other fields. The arguments to this method will vary depending on the type of Config.
- Parameters
pipeline (Optional[RVPipelineConfig]) –
scene (Optional[SceneConfig]) –
- Return type
None
- validate_config()#
Validate fields that should be checked after update is called.
This is to complement the builtin validation that Pydantic performs at the time of object construction.