metawards.InputFiles
- class metawards.InputFiles(work: Optional[str] = None, play: Optional[str] = None, identifier: Optional[str] = None, identifier2: Optional[str] = None, weekend: Optional[str] = None, work_size: Optional[str] = None, play_size: Optional[str] = None, position: Optional[str] = None, coordinates: Optional[str] = None, lookup: Optional[str] = None, lookup_columns: Optional[Dict[str, int]] = None, seed: Optional[str] = None, nodes_to_track: Optional[str] = None, uv: Optional[str] = None, is_single: bool = False, wards_data: Optional[str] = None, _filename: Optional[str] = None, _model_name: Optional[str] = None, _model_path: Optional[str] = None, _model_version: Optional[str] = None, _authors: Optional[str] = None, _contacts: Optional[str] = None, _references: Optional[str] = None, _repository: Optional[str] = None, _repository_version: Optional[str] = None, _repository_branch: Optional[str] = None)[source]
This class holds all of the input files that must be loaded from METAWARDSDATA to construct the network of wards and links between them
Load using the InputFiles.load function e.g.
Examples
>>> infiles = InputFiles.load("2011Data") >>> print(infiles) Model 2011Data version March 29 2020 repository: https://github.com/metawards/MetaWardsData repository_branch: main repository_version: 0.2.0 etc.
- __init__(work: Optional[str] = None, play: Optional[str] = None, identifier: Optional[str] = None, identifier2: Optional[str] = None, weekend: Optional[str] = None, work_size: Optional[str] = None, play_size: Optional[str] = None, position: Optional[str] = None, coordinates: Optional[str] = None, lookup: Optional[str] = None, lookup_columns: Optional[Dict[str, int]] = None, seed: Optional[str] = None, nodes_to_track: Optional[str] = None, uv: Optional[str] = None, is_single: bool = False, wards_data: Optional[str] = None, _filename: Optional[str] = None, _model_name: Optional[str] = None, _model_path: Optional[str] = None, _model_version: Optional[str] = None, _authors: Optional[str] = None, _contacts: Optional[str] = None, _references: Optional[str] = None, _repository: Optional[str] = None, _repository_version: Optional[str] = None, _repository_branch: Optional[str] = None) None
Methods
__delattr__
(name, /)Implement delattr(self, name).
__dir__
()Default dir() implementation.
__eq__
(other)Return self==value.
__format__
(format_spec, /)Default object formatter.
__ge__
(value, /)Return self>=value.
__getattribute__
(name, /)Return getattr(self, name).
__gt__
(value, /)Return self>value.
__hash__
()Return hash(self).
__init__
([work, play, identifier, ...])__init_subclass__
This method is called when a class is subclassed.
__le__
(value, /)Return self<=value.
__lt__
(value, /)Return self<value.
__ne__
(value, /)Return self!=value.
__new__
(**kwargs)__reduce__
()Helper for pickle.
__reduce_ex__
(protocol, /)Helper for pickle.
__repr__
()Return repr(self).
__setattr__
(name, value, /)Implement setattr(self, name, value).
__sizeof__
()Size of object in memory, in bytes.
__str__
()Return str(self).
__subclasshook__
Abstract classes can override this to customize issubclass().
_localise
()Localise the filenames in this input files set.
load
([model, repository, folder, ...])Load the parameters associated with the passed model.
Return the name of this model
Return the path to the directory containing this model
Return the version of the data in this model
Attributes
__annotations__
__dataclass_fields__
__dataclass_params__
__dict__
__doc__
__module__
__weakref__
list of weak references to the object (if defined)
_authors
_contacts
_filename
_model_name
_model_path
_model_version
_references
_repository
_repository_branch
_repository_version
Coordinates-system used for the positions.
File from which to read all of the ward names
File from which to read all of the secondary ward IDs, (Communities, Counties, Districts, UA's etc)
is_model_dir
Whether or not this is the special "single" ward model
is_wards_data
File to look up metadata about the wards (e.g.
Which columns in this file have the data
File from which to read the list of nodes to track
File from which to read the play matrix of links
File from which to read the size of the population in the play file
File from which to read the positions (locations) of the wards (the centre of the bounding boxes)
File from which to read the values to seed the wards
UV file
The json file containing the wards data if this is a ward_json
File from which to read the weekend matrix of links
File from which to read the work matrix of links
File from which to read the size of the population in the work file
- __eq__(other)
Return self==value.
- __init__(work: Optional[str] = None, play: Optional[str] = None, identifier: Optional[str] = None, identifier2: Optional[str] = None, weekend: Optional[str] = None, work_size: Optional[str] = None, play_size: Optional[str] = None, position: Optional[str] = None, coordinates: Optional[str] = None, lookup: Optional[str] = None, lookup_columns: Optional[Dict[str, int]] = None, seed: Optional[str] = None, nodes_to_track: Optional[str] = None, uv: Optional[str] = None, is_single: bool = False, wards_data: Optional[str] = None, _filename: Optional[str] = None, _model_name: Optional[str] = None, _model_path: Optional[str] = None, _model_version: Optional[str] = None, _authors: Optional[str] = None, _contacts: Optional[str] = None, _references: Optional[str] = None, _repository: Optional[str] = None, _repository_version: Optional[str] = None, _repository_branch: Optional[str] = None) None
- coordinates: str = None
Coordinates-system used for the positions. Should be ‘x/y’ or ‘lat/long’
- identifier: str = None
File from which to read all of the ward names
- identifier2: str = None
File from which to read all of the secondary ward IDs, (Communities, Counties, Districts, UA’s etc)
- is_single: bool = False
Whether or not this is the special “single” ward model
- static load(model: str = '2011Data', repository: Optional[str] = None, folder: Optional[str] = None, description: str = 'description.json', filename: Optional[str] = None)[source]
Load the parameters associated with the passed model. This will look for the parameters specified in the json file called f”{repository}/{folder}/{model}/{description}”
By default this will load the 2011Data parameters from $HOME/GitHub/model_data/2011Data/description.json
Alternatively you can provide the full path to the description json file usng the ‘filename’ argument. All files within this description will be searched for using the directory that contains that file as a base
- Parameters
model (str) – The name of the model data to load. This is the name that will be searched for in the METAWARDSDATA model_data directory
repository (str) – The location of the cloned METAWARDSDATA repository
folder (str) – The name of the folder within the METAWARDSDATA repository that contains the model data
filename (str) – The name of the file to load the model data from - this directly loads this file without searching through the METAWARDSDATA repository
- Returns
input_files – The constructed and validated set of input files
- Return type
- lookup: str = None
File to look up metadata about the wards (e.g. their names)
- lookup_columns: Dict[str, int] = None
Which columns in this file have the data
- nodes_to_track: str = None
File from which to read the list of nodes to track
- play: str = None
File from which to read the play matrix of links
- play_size: str = None
File from which to read the size of the population in the play file
- position: str = None
File from which to read the positions (locations) of the wards (the centre of the bounding boxes)
- seed: str = None
File from which to read the values to seed the wards
- uv: str = None
UV file
- wards_data: str = None
The json file containing the wards data if this is a ward_json
- weekend: str = None
File from which to read the weekend matrix of links
- work: str = None
File from which to read the work matrix of links
- work_size: str = None
File from which to read the size of the population in the work file