salvus.project.project
The SalvusProject class.
Classes
Project
Projectclass Project(builtins.object):
def __init__(
self,
path: Union[str, pathlib.Path],
verbosity: int = 1,
apply_migrations: types = None,
): ...Root Salvus project class.
Parameters
pathUnion[str, pathlib.Path] — Folder to load the project from.verbosityint — Verbosity of the project init.apply_migrationstypes — When upgrading Salvus from one version to a later one, the underlying file structure of SalvusProject might change. This requires a migration from the old to the new structure. If set to True, automatically apply necessary migrations, if False, raise if migrations are needed. If None, ask the user with an interactive prompt.
Methods
from_domain()
from_domain()def from_domain(
path: Union[str, pathlib.Path],
domain: salvus.project.domain.Domain,
load_if_exists: bool = False,
verbosity: int = 1,
) -> Project: ...Create a new project from a domain object.
Parameters
pathUnion[str, pathlib.Path] — Path at which to initialize the project.domainsalvus.project.domain.Domain — Domain to use.load_if_existsbool — If a project with a matching domain has already been created and is stored inpath, then load and return the project on disk rather than creating a new one.verbosityint — Verbosity of the project init.
Returns Project
from_geojson()
from_geojson()def from_geojson(
path: Union[str, pathlib.Path],
radius_in_meter: float,
geojson: Union[pathlib.Path, Dict],
verbosity: int = 1,
) -> Project: ...Create a new project from a GeoJSON document.
Parameters
pathUnion[str, pathlib.Path] — Path at which to initialize the project.radius_in_meterfloat — Planet radius.geojsonUnion[pathlib.Path, Dict] — Filename or dictionary containing the geojson data.verbosityint — Verbosity of the project init.
Returns Project
from_volume_model()
from_volume_model()def from_volume_model(
path: Union[str, pathlib.Path],
volume_model: salvus.project.configuration.model.volume._VolumeBase,
load_if_exists: bool = False,
verbosity: int = 1,
) -> Project: ...Create a new domain from the extents of a volumetric model.
Parameters
pathUnion[str, pathlib.Path] — model filename.volume_modelsalvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.load_if_existsbool — If a project with a matching domain has already been created and is stored inpath, then load and return the project on disk rather than creating a new one.verbosityint — Verbosity of the project init.
Returns Project — A new domain object with the proper extents.
add_to_project()
add_to_project()def add_to_project(self, other: Any, overwrite: bool = False) -> None: ...Add something to the project.
It will automatically dispatch to the correct subroutine depending on what it is given.
Parameters
otherAny — Thing to add.overwritebool — Potentially overwrite an existing thing in project if it already exists.
Returns None