write_raster
Convert a numpy array into a raster file by copying metadata from a reference raster. Specify array, reference raster, output path, and optional data type to generate a new raster file efficiently.
Instructions
Write a numpy array to a raster file using metadata from a reference raster.
Args:
array: 2D or 3D list (or numpy array) of raster values.
reference_raster: Path to a raster whose metadata will be copied.
output_path: Path to save the new raster.
dtype: Optional data type (e.g., 'float32', 'uint8').
Returns:
Dictionary with status and message.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
array | Yes | ||
dtype | No | ||
output_path | Yes | ||
reference_raster | Yes |
Input Schema (JSON Schema)
{
"properties": {
"array": {
"items": {},
"title": "Array",
"type": "array"
},
"dtype": {
"default": null,
"title": "Dtype",
"type": "string"
},
"output_path": {
"title": "Output Path",
"type": "string"
},
"reference_raster": {
"title": "Reference Raster",
"type": "string"
}
},
"required": [
"array",
"reference_raster",
"output_path"
],
"title": "write_rasterArguments",
"type": "object"
}