Config loader
Configuration and command-line argument handling for MAY.
build_filters(config)
Build the geographical filter from config.
A run either loads all units or filters to one level's codes, both declared
under geography: in the config. Levels are referenced by their config label
(no hardcoded SGU/MGU/LGU), so any level naming works.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Configuration dictionary |
required |
Returns:
| Type | Description |
|---|---|
|
Filter dictionary with 'level' and 'codes' keys, or None if no filter |
Source code in may/config_loader.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
load_config(config_path='config.yaml')
Load configuration from YAML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
Path to the config file |
'config.yaml'
|
Returns:
| Type | Description |
|---|---|
|
Dictionary with configuration |
Source code in may/config_loader.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
setup_geography(config=None)
Set up geography from config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Configuration dict (if None, loads the default config file) |
None
|
Returns:
| Type | Description |
|---|---|
|
Tuple of (Geography object, filters dict) |
Source code in may/config_loader.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |