top of page

The program has been fully developed for use by novices. It is fully open-access. You can find it at the following address, as well as the dataset.

Protocol to create your own interactive visualization
  1. Download the github folder

  2. Read this readme page

  3. Save your data on csv format (possible to export from MS Excel or Apple Number). Follow the guidelines specified in the Dataset chapter of this readme.

  4. Modify the parameters found in the settings.py folder. Each parameter is explained in the Settings chapter of this readme.

  5. If necessary, install the following programs :

    1. install anaconda

    2. install python3

    3. install the following python libraries : pandas, numpy, folium, scipy, imageio, pillow (NB: on Mac/Unix, this can be done by typing pip install program_name in the Terminal and press the return key. e.g pip install pandas. Alternatively, you can type brew install program_name)

  6. Open the Jupyter notebook using anaconda interface, open DH_map_V4.ipynb and simply run it.

 

Description of the files
DH_map_V4.ipynb

Jupyter notebook containing the main program. This is where you will be able to obtain the different kinds of interactive map. Among them, the consumption of the cities, their production (which can also be displayed by type), the net import-export, the main transport hubs, etc. You will also be able to visualize the transport network. In addition, this is where you will be able to create a mp4 movie representing the flux of goods.

 

settings.py

You will have to modify the global variables in this python file in order to run the program with your own data. See the detailed description of these parameters below.

 

plot_cities.py

This python file contains all the useful functions to plot the interactive maps of cities.

  • plot_cities(df, arg) : Here you will have to input your merged pandas dataframe (see example in the .ipynb file) and simply specify the parameter ('consumption', 'production', 'arriving_flux' or 'departing_flux'.

  • plot_cities_production(df) : This sister function will display the production centers according the the production type (these parameters have to be specified in the settings.py)

  • plot_cities_transiting_flux(df) : This sister function will display the transport hubs.

  • plot_cities_import_export(df) : This sister function will display the net import-export.

 

network.py

This python file will help you to display the network between cities. If the naval mode is enabled (see settings.py), you will be able to choose between 3 options :

  • get_beautiful_base_image_map(df_flux, thin=False) : Just displays the network in gold tone, independently on the fact that the route is naval of terrestrial.

  • get_beautiful_tricolor_base_image_map(df_flux) : In this variant, the land trades routes will be displayed in gold, while naval trade routes will be displayed in blue. Routes which are both land & naval routes will be displayed in green.

  • get_beautiful_base_image_map_by_route_category(df_flux, mode) : Here, you will have to specify whether your want to display 'land' routes or 'naval' routes, in the mode parameter.

 

travels.py

This python file contains the necessary functions to create the simulation. It will thus create an artificial schedule of trains and boats to transport goods from one city to another, taking into account the quantity of goods to be transported over the specified period.

 

framer.py

This file will allow you to create snapshots of the simulation at a given time.

 

movie_maker.py

This file will create snapshots of the simulation for the entire duration specified in settings.py and assemble them into an mp4 video that it will store in the "mp4" repository. Snapshots will be saved in the "png" repository.

 

Settings
Folders

Normally, you wouldn't have to change this, except if you gave different names to your repositories.

 

Parameters
  • _Ntypes_production : The number of different types of goods or of different regions of production.

  • _enable_Naval : You can activate this parameter (True) if your transport routes can be naval, terrestrial or both. If you only want to work with land routes, just set this parameter to False. Note that this will duplicate the previous parameter, as each trade route will be able to convey the different types of goods either on land or on sea/river (or both).

  • _production_colors : The color-code in which you want to display the various production types or production regions (or the different types of goods). Check www.color-hex.com if needed. Note that the color code should be in this format : '#A550FF'. In particular, the # shouldn't be forgotten and the letters should be UPPERCASE.

  • _descr : Textual description of the different types of goods or different regions of production.

  • _ktons_per_unit : Fill this parameter if you have to convert the values from your csv. data to kilotons. If your data are already saved as kilotons, just set this parameter to 1.

  • _ktons_per_train : Please specify the number of kilotons of goods that a train or boat can carry, according to your model.

  • _euclidian_kmph : The velocity as the crow flies of trains/boats in your model.

  • _start_time : Start time and date of your simulation, in the following format : '1881-01-01 00:00:00'

  • _hourly_rate : Smallest time unit of the simulation, in fraction of an hour. For example, enter 4 for a simulation with quarter-hour accuracy and enter 0.5 for a two-hour accuracy.

  • _simulation_duration : Duration of the simulation. Change only the first two digits. For example, leaving the parameter int(365*24*_hourly_rate), the simulation duration will be 365 days (24 hours a day).

  • _time_range : Please consistently adapt this parameter to your previous decisions, if necessary change the starting data and the frequency.

  • _location_map : Coordinates of the center of the map (check www.latlong.net if necessary).

  • _zoom_map : Original zoom or dezoom of the map

You're basically done. Enter your dataset and the programm will do the rest !

 

Dataset

The dataset should be in the very same csv format as our dataset (your can find it on this github, in the /data/ repository. Please keep the same columns and files names, or adapt them in the code. The only names you can change without causing any problems to the program will be the names of the production types columns.

bottom of page