physrisk.hazard_models

Submodules

physrisk.hazard_models.core_hazards

class physrisk.hazard_models.core_hazards.ResourceSubset(resources: Iterable[HazardResource])

Bases: object

any()
first()
match(hint: HazardDataHint)
prefer_group_id(group_id: str)
with_group_id(group_id: str)
with_model_gcm(gcm: str)
with_model_id(model_id: str)
with_display_name(display_name: str)
last()
class physrisk.hazard_models.core_hazards.ResourceSelector(*args, **kwargs)

Bases: Protocol

For a particular hazard type and indicator_id (specifying the type of indicator), defines the rule for selecting a resource from all matches.

class physrisk.hazard_models.core_hazards.ResourceSelectorKey(hazard_type, indicator_id)

Bases: NamedTuple

hazard_type: type

Alias for field number 0

indicator_id: str

Alias for field number 1

class physrisk.hazard_models.core_hazards.InventorySourcePaths(inventory: Inventory)

Bases: SourcePaths

Class used to generate SourcePaths by selecting the appropriate HazardResource from the Inventory of HazardResources.

add_selector(hazard_type: type, indicator_id: str, selector: ResourceSelector)
all_hazards()
hazard_types()

Lists the available hazard types.

Returns:

Available hazard types.

Return type:

List[Type[Hazard]]

resource_paths(hazard_type: Type[Hazard], indicator_id: str, scenarios: Sequence[str], hint: HazardDataHint | None = None) List[ResourcePaths]

Provides a list of ResourcePaths. Each item in the list provides the paths for a different HazardResource. The ResourcePaths will be tried in order. If a latitude/longitude is out of bounds of one HazardResource

Parameters:
  • hazard_type (Type[Hazard]) – Hazard type.

  • indicator_id (str) – Hazard indicator identifier.

  • scenarios (Sequence[str]) – Scenario identifiers.

  • hint (Optional[HazardDataHint], optional) – Hint to be applied to select path. Generally only

  • None. (makes sense if there is just a single scenario. Defaults to)

Returns:

List of ResourcePaths to be tried in order.

Return type:

List[ResourcePaths]

scenario_paths_for_id(resource_id: str, scenarios: Sequence[str], map: bool = False, map_zoom: int | None = None)

Returns the ScenarioPaths when a unique ID is specified.

static scenario_paths_for_resource(resource: HazardResource, scenario_id: str, map: bool = False, map_zoom: int | None = None)
get_resources(hazard_type: Type[Hazard], indicator_id: str, hint: HazardDataHint | None = None) List[HazardResource]
property all_selected_resources_by_type_id: dict[tuple[str, str], list[HazardResource]]
class physrisk.hazard_models.core_hazards.CoreFloodModels(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

WRI = 1
TUDelft = 2
class physrisk.hazard_models.core_hazards.CoreInventorySourcePaths(inventory: Inventory, flood_model: CoreFloodModels = CoreFloodModels.WRI)

Bases: InventorySourcePaths

resources_with(*, hazard_type: type, indicator_id: str)
physrisk.hazard_models.core_hazards.cmip6_scenario_to_rcp(scenario: str)

Convention is that CMIP6 scenarios are expressed by identifiers: SSP1-2.6: ‘ssp126’ SSP2-4.5: ‘ssp245’ SSP5-8.5: ‘ssp585’ etc. Here we translate to form RCP-4.5: ‘rcp4p5’ RCP-8.5: ‘rcp8p5’ etc.

physrisk.hazard_models.core_hazards.get_default_source_paths(inventory: ~physrisk.data.inventory.Inventory = <physrisk.data.inventory.EmbeddedInventory object>)

Module contents