pyrosm.recipes.validate

Contents

pyrosm.recipes.validate#

pyrosm.recipes.validate(recipe, base_dir=None)#

Check a recipe without running it and return it resolved.

Every section is checked eagerly: the keys, the area, the input files (they must exist; a PBF must start with an OSM header), every keyword against the function it is passed to, and the output paths, which must be relative, portable and named once. Raises ValueError naming the key that is wrong, or ImportError when PyYAML is missing for a recipe file.

Parameters:
  • recipe (str | pathlib.Path | Mapping) – The recipe file (YAML or JSON), or the recipe as a mapping in the same format, such as json.loads(text); a mapping needs outputs.provenance. A string is always a file name.

  • base_dir (str | pathlib.Path, optional) – The folder that the recipe’s relative paths (the area file, must_cover, extract.directory, pbf) resolve against, and the default output folder. Default: the recipe file’s folder, or the current folder for a mapping.

Returns:

The resolved recipe: recipe_path (None for a mapping), recipe_dir (the folder relative paths resolved against), version, extract, pbf, reader, layers, graph and outputs.

Return type:

dict