🏛️ Domain Schemas#
While standard Recipes are great for chaining commands, sometimes you need to enforce rigorous geospatial standards across an entire project—like exact arc-second resolutions, cell overlaps, and grid-node vs. pixel-node registration.
Fetchez includes a Schema Engine that can automatically mutate your YAML recipes to enforce these rules, saving you from doing tedious geospatial math.
Using a Schema#
Add a schema argument to the top of your YAML recipe:
project:
name: "My_Strict_Project"
schema: "cudem" # Loads the CUDEM ruleset
region: [-120.0, -119.75, 33.0, 33.25] # Your exact delivery tile
What happens under the hood?
By specifying schema: “cudem”, the engine intercepts your recipe. It automatically calculates that a CUDEM tile requires a 6-cell overlap at 1/9th arc-second resolution. It expands your fetching bounding box, injects the correct EPSG codes into your gridding hooks, and appends a final raster_crop hook to snap the finished DEM back to your requested tile extents.
Extending Schemas (Plugins and Extensions)#
Fetchez is generic. If you are building a custom tool (like a specialized DEM engine), you can register your own schemas in Python. Make a directory called ‘my_project/schemas’ and put all your schema python files within it:
from fetchez.schema import BaseSchema
class WeatherSchema(BaseSchema):
name = "wrf_weather"
@classmethod
def apply(cls, config):
config["region"] = [-180, 180, -90, 90] # Force global fetch
return config
Then register your project with fetchez in your pyproject.toml:
[project.entry-points."fetchez.schemas"]
my_project_schemas = "my_project.schemas"