metawards.InputFiles

class metawards.InputFiles(work: str = None, play: str = None, identifier: str = None, identifier2: str = None, weekend: str = None, work_size: str = None, play_size: str = None, position: str = None, coordinates: str = None, lookup: str = None, lookup_columns: Dict[str, int] = None, seed: str = None, nodes_to_track: str = None, uv: str = None, is_single: bool = False, wards_data: str = None, _filename: str = None, _model_name: str = None, _model_path: str = None, _model_version: str = None, _authors: str = None, _contacts: str = None, _references: str = None, _repository: str = None, _repository_version: str = None, _repository_branch: 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: str = None, play: str = None, identifier: str = None, identifier2: str = None, weekend: str = None, work_size: str = None, play_size: str = None, position: str = None, coordinates: str = None, lookup: str = None, lookup_columns: Dict[str, int] = None, seed: str = None, nodes_to_track: str = None, uv: str = None, is_single: bool = False, wards_data: str = None, _filename: str = None, _model_name: str = None, _model_path: str = None, _model_version: str = None, _authors: str = None, _contacts: str = None, _references: str = None, _repository: str = None, _repository_version: str = None, _repository_branch: str = None) → None

Initialize self. See help(type(self)) for accurate signature.

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, …])

Initialize self.

__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)

Create and return a new object.

__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.

model_name()

Return the name of this model

model_path()

Return the path to the directory containing this model

model_version()

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

Coordinates-system used for the positions.

identifier

File from which to read all of the ward names

identifier2

File from which to read all of the secondary ward IDs, (Communities, Counties, Districts, UA’s etc)

is_model_dir

is_single

Whether or not this is the special “single” ward model

is_wards_data

lookup

File to look up metadata about the wards (e.g.

lookup_columns

Which columns in this file have the data

nodes_to_track

File from which to read the list of nodes to track

play

File from which to read the play matrix of links

play_size

File from which to read the size of the population in the play file

position

File from which to read the positions (locations) of the wards (the centre of the bounding boxes)

seed

File from which to read the values to seed the wards

uv

UV file

wards_data

The json file containing the wards data if this is a ward_json

weekend

File from which to read the weekend matrix of links

work

File from which to read the work matrix of links

work_size

File from which to read the size of the population in the work file

__hash__()[source]

Return hash(self).

__repr__()[source]

Return repr(self).

__str__()[source]

Return str(self).

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: str = None, folder: str = None, description: str = 'description.json', filename: 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

InputFiles

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

model_name()[source]

Return the name of this model

model_path()[source]

Return the path to the directory containing this model

model_version()[source]

Return the version of the data in this model

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