Mondaic
This API reference is not for the latest stable Salvus version.

salvus.project.project

The SalvusProject class.

Classes

Project

class Project(builtins.object):
    def __init__(
        self,
        path: Union[str, pathlib.Path],
        verbosity: int = 1,
        apply_migrations: types = None,
    ): ...

Root Salvus project class.

Parameters
  • path Union[str, pathlib.Path] — Folder to load the project from.
  • verbosity int — Verbosity of the project init.
  • apply_migrations types — 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()
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
  • path Union[str, pathlib.Path] — Path at which to initialize the project.
  • domain salvus.project.domain.Domain — Domain to use.
  • load_if_exists bool — If a project with a matching domain has already been created and is stored in path, then load and return the project on disk rather than creating a new one.
  • verbosity int — Verbosity of the project init.
Returns Project
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
  • path Union[str, pathlib.Path] — Path at which to initialize the project.
  • radius_in_meter float — Planet radius.
  • geojson Union[pathlib.Path, Dict] — Filename or dictionary containing the geojson data.
  • verbosity int — Verbosity of the project init.
Returns Project
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
  • path Union[str, pathlib.Path] — model filename.
  • volume_model salvus.project.configuration.model.volume._VolumeBase — The volumetric model from which to create the domain.
  • load_if_exists bool — If a project with a matching domain has already been created and is stored in path, then load and return the project on disk rather than creating a new one.
  • verbosity int — Verbosity of the project init.
Returns Project — A new domain object with the proper extents.
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
  • other Any — Thing to add.
  • overwrite bool — Potentially overwrite an existing thing in project if it already exists.
Returns None