Arro3 Core
Arro3-core provides the Pythonic foundation for managing, processing, and generating geospatial data with a focus on ease of use and interoperability. It defines a standardized schema for geospatial datasets and provides utilities for reading and writing them. The current version is 0.8.0, and being a pre-1.0 library, its API is subject to change.
Warnings
- breaking Arro3-core is currently in its 0.x.x release series, meaning the API is not yet stable. Breaking changes to classes, methods, and schema definitions can occur between minor versions (e.g., 0.8.0 to 0.9.0).
- gotcha The `Arro` schema relies on Pydantic v2. Using `arro3-core` with Pydantic v1 will lead to import errors or unexpected behavior due to API differences.
- gotcha The internal file format (e.g., for `.json` or `.json.gz` files written by `ArroFile`) might evolve. Files written with an older version of `arro3-core` might not be readable by newer versions, or vice-versa, especially during the 0.x.x development phase.
Install
-
pip install arro3-core
Imports
- Arro
from arro3.schema.core import Arro
- ArroFile
from arro3.core import ArroFile
Quickstart
import os
from arro3.core import ArroFile
from arro3.schema.core import Arro
# Define a simple Arro object structure
data = {
"id": "my-dataset-id",
"name": "My Test Dataset",
"description": "A minimal example Arro dataset.",
"bbox": [0.0, 0.0, 1.0, 1.0], # minx, miny, maxx, maxy
"spatial_ref_sys": {"epsg": 4326}, # Example SRS
"assets": {} # Assets dict required, can be empty
}
try:
# 1. Create an Arro object from a dictionary
my_arro = Arro(**data)
print(f"Created Arro object with ID: {my_arro.id}")
# 2. Define a temporary file path for demonstration
temp_file_path = "temp_arro_dataset.json"
# 3. Save the Arro object to a file
ArroFile.write(my_arro, temp_file_path)
print(f"Arro object saved to {temp_file_path}")
# 4. Load the Arro object from the file
loaded_arro = ArroFile.read(temp_file_path)
print(f"Loaded Arro object with ID: {loaded_arro.id}")
assert my_arro.id == loaded_arro.id
print("Verification successful: Loaded ID matches original ID.")
except Exception as e:
print(f"An error occurred: {e}")
finally:
# Clean up the temporary file
if os.path.exists(temp_file_path):
os.remove(temp_file_path)
print(f"Cleaned up temporary file: {temp_file_path}")