History of colombia_urban_mobility
The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.
[entries] Add the date when each entry was added, and remove icon_hash beff7c9
The dates are those of the commits that first added the entries' files (2020-08-11 for the entries of the initial commit); renamed entries keep the date of their first name. Changed: none
diff --git a/entries/colombia_urban_mobility/__init__.py b/entries/colombia_urban_mobility/__init__.py
index 2523850..e1e30d2 100644
--- a/entries/colombia_urban_mobility/__init__.py
+++ b/entries/colombia_urban_mobility/__init__.py
@@ -38,7 +38,7 @@ tags = ['Transportation', 'Travel', 'Multigraph', 'Weighted', 'Timestamps', 'Met
url = 'https://doi.org/10.5061/dryad.hj1t4'
citation = [('L. Lotero, R. G. Hurtado, L. M. Floría, J. Gómez-Gardeñes, "Rich do not rise early: spatio-temporal patterns in the mobility networks of different socio-economic classes." Royal Society Open Science 3(10), 150654 (2016)', 'https://doi.org/10.1098/rsos.150654'),
('L. Lotero, R. G. Hurtado, L. M. Floría, J. Gómez-Gardeñes, "Data from: Rich do not rise early: spatio-temporal patterns in the mobility networks of different socio-economic classes." Dryad, dataset (2016)', 'https://doi.org/10.5061/dryad.hj1t4')]
-icon_hash = '5b4f7611dfd5c2fc3b0716bf'
+date_added = '2026-10-25'
upstream_license = ('Creative Commons CC0 1.0 Universal', 'https://creativecommons.org/publicdomain/zero/1.0/')
# Zip file of the dataset version (the individual file downloads require an
# access token)
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) bc3dbbd
The lists of properties at the end of the descriptions marked edge properties with "Edge" but left node properties unmarked, or grouped them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property was often unclear. Every item now starts with (Node), (Edge) or (Graph), followed by the property names, a colon and the explanation, one item per property or group of properties; qualifications (kinds of nodes, networks) follow the names in parentheses. Properties that were only named got a short explanation, and a few items that named the wrong kind of property were corrected.
diff --git a/entries/colombia_urban_mobility/__init__.py b/entries/colombia_urban_mobility/__init__.py
index 7bbe0ef..2523850 100644
--- a/entries/colombia_urban_mobility/__init__.py
+++ b/entries/colombia_urban_mobility/__init__.py
@@ -28,9 +28,12 @@ description = """Networks of trips between the transportation zones of two Colom
The networks have the following properties:
-- Nodes: `zone`, the identifier of the zone (from 1 to 413 or 57).
-- Edges: `stratum`, the socio-economic stratum ("estrato") of the household of the traveler, from 1 (lowest income) to 6 (highest income); in Colombia, households are officially classified into these strata according to the characteristics of their housing, to set the rates of public utilities; `departure` and `arrival`, the departure and arrival times of the trip, in decimal hours; `mid_time`, the mean of the departure and arrival times; `weight`, the expansion factor of the trip, i.e. the number of trips in the population that it represents, which depends on the zone and stratum.
-- `medellin` edges: `purpose`, the purpose of the trip (1: work, 2: study, 3: shopping, 4: health, 5: recreation, 6: return home, 7: others)."""
+- (Node) `zone`: the identifier of the zone (from 1 to 413 or 57).
+- (Edge) `stratum`: the socio-economic stratum ("estrato") of the household of the traveler, from 1 (lowest income) to 6 (highest income); in Colombia, households are officially classified into these strata according to the characteristics of their housing, to set the rates of public utilities.
+- (Edge) `departure` and `arrival`: the departure and arrival times of the trip, in decimal hours.
+- (Edge) `mid_time`: the mean of the departure and arrival times.
+- (Edge) `weight`: the expansion factor of the trip, i.e. the number of trips in the population that it represents, which depends on the zone and stratum.
+- (Edge) `purpose` (`medellin`): the purpose of the trip (1: work, 2: study, 3: shopping, 4: health, 5: recreation, 6: return home, 7: others)."""
tags = ['Transportation', 'Travel', 'Multigraph', 'Weighted', 'Timestamps', 'Metadata']
url = 'https://doi.org/10.5061/dryad.hj1t4'
citation = [('L. Lotero, R. G. Hurtado, L. M. Floría, J. Gómez-Gardeñes, "Rich do not rise early: spatio-temporal patterns in the mobility networks of different socio-economic classes." Royal Society Open Science 3(10), 150654 (2016)', 'https://doi.org/10.1098/rsos.150654'),
[entries] Remove unneeded code from the entries 2c69f19
Unneeded "global files" statements, unused imports and variables, f-strings without placeholders, duplicate keys in foodweb_little_rock (keeping the order and the values used), and the second definition of get_lines() in twitter_higgs. Nothing changes in the networks or descriptions. Changed: none
diff --git a/entries/colombia_urban_mobility/__init__.py b/entries/colombia_urban_mobility/__init__.py
index b8a8a87..7bbe0ef 100644
--- a/entries/colombia_urban_mobility/__init__.py
+++ b/entries/colombia_urban_mobility/__init__.py
@@ -51,7 +51,6 @@ def fetch_upstream(force=False):
@coerce_props()
@annotate()
def parse(alts=None):
- global files
name = __name__.split(".")[-1]
for fnames, alt, N in files:
if alts is not None and alt not in alts:
[entries] New entry: colombia_urban_mobility bcd3950
diff --git a/entries/colombia_urban_mobility/__init__.py b/entries/colombia_urban_mobility/__init__.py
new file mode 100644
index 0000000..b8a8a87
--- /dev/null
+++ b/entries/colombia_urban_mobility/__init__.py
@@ -0,0 +1,80 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020-2026 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+from .. import *
+from openpyxl import load_workbook
+
+title = "Urban trips in Medellín and Manizales, Colombia (2005)"
+description = """Networks of trips between the transportation zones of two Colombian cities, from household origin-destination surveys (ODS), as distributed by Lotero et al. In these surveys, each member (older than 5 years) of the sampled households reported the trips performed on the working day before the interview (Medellín), or the trips usually made on working days (Manizales), including their origin and destination zones, departure and arrival times and, in Medellín, the trip purpose. The surveys were carried out by the Universidad Nacional de Colombia for the Área Metropolitana del Valle de Aburrá (Medellín, 2005-2006, 413 zones, 56,513 people interviewed) and the Alcaldía de Manizales (2005, 57 zones, 4,089 people interviewed). Each node is a zone, and each directed edge is a trip from its origin to its destination zone (trips within a zone are self-loops), so that the networks are multigraphs. The trips are annotated with the socio-economic stratum of the household of the traveler, which allows the network to be split into six layers, as analyzed in the paper.
+
+- `medellin`: trips in the metropolitan area of Medellín (Valle de Aburrá).
+- `manizales`: trips in the municipality of Manizales.
+
+The networks have the following properties:
+
+- Nodes: `zone`, the identifier of the zone (from 1 to 413 or 57).
+- Edges: `stratum`, the socio-economic stratum ("estrato") of the household of the traveler, from 1 (lowest income) to 6 (highest income); in Colombia, households are officially classified into these strata according to the characteristics of their housing, to set the rates of public utilities; `departure` and `arrival`, the departure and arrival times of the trip, in decimal hours; `mid_time`, the mean of the departure and arrival times; `weight`, the expansion factor of the trip, i.e. the number of trips in the population that it represents, which depends on the zone and stratum.
+- `medellin` edges: `purpose`, the purpose of the trip (1: work, 2: study, 3: shopping, 4: health, 5: recreation, 6: return home, 7: others)."""
+tags = ['Transportation', 'Travel', 'Multigraph', 'Weighted', 'Timestamps', 'Metadata']
+url = 'https://doi.org/10.5061/dryad.hj1t4'
+citation = [('L. Lotero, R. G. Hurtado, L. M. Floría, J. Gómez-Gardeñes, "Rich do not rise early: spatio-temporal patterns in the mobility networks of different socio-economic classes." Royal Society Open Science 3(10), 150654 (2016)', 'https://doi.org/10.1098/rsos.150654'),
+ ('L. Lotero, R. G. Hurtado, L. M. Floría, J. Gómez-Gardeñes, "Data from: Rich do not rise early: spatio-temporal patterns in the mobility networks of different socio-economic classes." Dryad, dataset (2016)', 'https://doi.org/10.5061/dryad.hj1t4')]
+icon_hash = '5b4f7611dfd5c2fc3b0716bf'
+upstream_license = ('Creative Commons CC0 1.0 Universal', 'https://creativecommons.org/publicdomain/zero/1.0/')
+# Zip file of the dataset version (the individual file downloads require an
+# access token)
+upstream_prefix = 'https://datadryad.org/api/v2/versions/20910'
+files = [('download:zip:OD_DB_Med2005.xlsx', 'medellin', 413),
+ ('download:zip:OD_DB_Man2005.xlsx', 'manizales', 57)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ global files
+ name = __name__.split(".")[-1]
+ for fnames, alt, N in files:
+ if alts is not None and alt not in alts:
+ continue
+ with open_upstream_file(name, fnames, "rb", seekable=True) as f:
+ wb = load_workbook(f, read_only=True)
+ rows = list(wb.active.iter_rows(values_only=True))
+ # Columns: ORIG, DEST, EST, HSAL, HLLEG, [MOT,] HMV, FEV
+ hdr = rows[0]
+ cols = {c: i for i, c in enumerate(hdr)}
+ A = numpy.array(rows[1:], dtype="float")
+ g = Graph(directed=True)
+ g.add_vertex(N)
+ g.vp.zone = g.new_vp("int", vals=numpy.arange(1, N + 1))
+ eprops = [("stratum", "int", "EST"), ("departure", "double", "HSAL"),
+ ("arrival", "double", "HLLEG"), ("mid_time", "double", "HMV"),
+ ("weight", "double", "FEV")]
+ if "MOT" in cols:
+ eprops.append(("purpose", "int", "MOT"))
+ for pname, ptype, col in eprops:
+ g.ep[pname] = g.new_ep(ptype)
+ g.add_edge_list(numpy.column_stack([A[:, cols["ORIG"]] - 1,
+ A[:, cols["DEST"]] - 1] +
+ [A[:, cols[col]] for _, _, col in eprops]),
+ eprops=[g.ep[pname] for pname, _, _ in eprops])
+ yield alt, g