smif.convert.area module¶
Handles conversion between the sets of regions used in the SosModel
Summary¶
Classes:
NamedShape |
|
RegionRegister |
Holds the sets of regions used by the SectorModels and provides conversion between data values relating to compatible sets of regions. |
RegionSet |
Hold a set of regions, spatially indexed for ease of lookup when constructing conversion matrices. |
Functions:
get_register |
Return single copy of RegionRegister |
proportion_of_a_intersecting_b |
Calculate the proportion of shape a that intersects with shape b |
Reference¶
-
smif.convert.area.
proportion_of_a_intersecting_b
(shape_a, shape_b)[source]¶ Calculate the proportion of shape a that intersects with shape b
-
class
smif.convert.area.
NamedShape
(name, shape)¶ Bases:
tuple
-
name
¶ Alias for field number 0
-
shape
¶ Alias for field number 1
-
-
class
smif.convert.area.
RegionSet
(set_name, fiona_shape_iter)[source]¶ Bases:
smif.convert.register.ResolutionSet
Hold a set of regions, spatially indexed for ease of lookup when constructing conversion matrices.
Parameters: - set_name (str) – Name to use as identifier for this set of regions
- fiona_shape_iter (iterable) – Iterable (probably a list or a reader handle) of fiona feature records e.g. the ‘features’ entry of a GeoJSON collection
-
data
¶
-
as_features
()[source]¶ Get the regions as a list of feature dictionaries
Returns: A list of GeoJSON-style dicts Return type: list
-
class
smif.convert.area.
RegionRegister
[source]¶ Bases:
smif.convert.register.Register
Holds the sets of regions used by the SectorModels and provides conversion between data values relating to compatible sets of regions.
-
names
¶ Names of registered region sets
Returns: sets Return type: list of str
-
get_entry
(name)[source]¶ Returns the ResolutionSet of name
Parameters: name (str) – The unique identifier of a ResolutionSet in the register Returns: Return type: smif.convert.area.RegionSet
-