Mapping
Overview Structs
GEMS.AgeMapGEMS.AttackRateMapGEMS.CaseFatalityMapGEMS.GeolocatedGEMS.HouseholdSizeMapGEMS.InfectionMapGEMS.KidsMapGEMS.MapPlotGEMS.MultiGenHouseholdMapGEMS.PopDensityMapGEMS.R0MapGEMS.SinglesMapGEMS.WeeklyIncidenceMap
Overview Functions
GEMS.agsmapGEMS.county_dataGEMS.gemsmapGEMS.generate_mapGEMS.germanshapesGEMS.municipality_dataGEMS.state_data
Structs
GEMS.AgeMap — Type
AgeMap <: MapPlotA map that shows the average age per region.
GEMS.AttackRateMap — Type
AttackRateMap <: MapPlotA map that shows the fraction of individuals that got infected at least one time per region. The region code (AGS) is taken from the individuals' household location, not the location of infection.
GEMS.CaseFatalityMap — Type
CaseFatailityMap <: MapPlotA map that shows the fraction of infections that led to death time per region.
GEMS.Geolocated — Type
Supertype for all simulation settings which directly contain individuals and are geolocated.
GEMS.HouseholdSizeMap — Type
HouseholdSizeMap <: MapPlotA map that shows the average household size per region.
GEMS.InfectionMap — Type
InfectionMap <: SimulationPlotA simulation plot type for generating an infection map.
GEMS.KidsMap — Type
KidsMap <: MapPlotA map that shows the the basic reproduction number per county.
GEMS.MapPlot — Type
Supertype for all maps that go into single-run simulation reports
GEMS.MultiGenHouseholdMap — Type
MultiGenHouseholdMap <: MapPlotA map that shows the the basic reproduction number per county.
GEMS.PopDensityMap — Type
PopDensityMap <: MapPlotA map that shows the population density per region.
GEMS.R0Map — Type
R0Map <: MapPlotA map that shows the the basic reproduction number per county.
GEMS.SinglesMap — Type
SinglesMap <: MapPlotA map that shows the fraction of single-person households per region.
GEMS.WeeklyIncidenceMap — Type
WeeklyIncidenceMap <: MapPlotA map that shows the incidence per week.
Functions
GEMS.gemsmap — Function
gemsmap(data; type = :nothing, level = 3, plotargs...)Generates a geographical map of a desired type. Just pass the name of the map-type as a Symbol (must be exactly the same as the respective SimulationPlot-struct). The data argument mus be either a Simulation object (used to map model-related features such as average household sizes per region) or a ResultData object (used to map simulation-result-related features such as the attack rate per region). Most of the maps that can be generated also take the level argument that converts the AGSs to the desired geographical resolution: states (level = 1), counties (level = 2) or municipalities (level = 3).
Parameters
data:SimulationorResultDataobject.type = :nothing(optional): Map type (instantiates a map with the exact same struct name).level = 3(optional): Desired geographical resolution: states (level = 1), counties (level = 2) or municipalities (level = 3)plotargs...(optional): Any argument that theplot()function of thePlots.jlpackage can take.
Returns
Plots.Plot: Map using thePlots.jlpackage's struct.
Examples
Given that you have a simulation with geolocalized settings (available in the predefined models accessible via the German state codes. e.g., "SH" for the northern-most state of "Schleswig-Holstein"), you can plot the average age per region on a map like this:
sim = Simulation(population = "SH")
gemsplot(sim, type = :AgeMap)If you want to change the resolution to counties, try:
sim = Simulation(population = "SH")
gemsplot(sim, type = :AgeMap, level = 2)All gemsmaps can be nested and combined with any plot of the Plots.jl package or gemsplots:
using Plots
plot(
gemsmap(sim, type = :AgeMap),
gemsplot(rd, type = :TickCases)
)Map Types
| Type | Input Object | Description | Plot-Specific Parameters |
|---|---|---|---|
:AgeMap | Simulation | Average age per region. | fit_lims = false: If true, the color limits of the plot will be set to the minimum and maximum age. |
:AttackRate | ResultData | Fraction of people who got infected per region. | fit_lims = false: If true, the color limits of the plot will be set to the minimum and maximum fraction. |
:CaseFatalityMap | ResultData | Fraction of infections that led to death per region. | |
:ElderlyMap | Simulation | Fraction of elderly people (65+) per region. | fit_lims = false: If true, the color limits of the plot will be set to the minimum and maximum fraction. |
:HouseholdSizeMap | Simulation | Average household size per region. | max_size = 10: Maximum size of households (default = 10) considered for this graph (to exclude large outliers), fit_lims = false: If true, the color limits of the plot will be set to the minimum and maximum household size values. |
:KidsMap | Simulation | Fraction of kids (0-14) per region. | fit_lims = false: If true, the color limits of the plot will be set to the minimum and maximum fraction. |
:MultiGenHouseholdMap | Simulation | Fraction of multi-generational households (50+ age difference) per region. | fit_lims = false: If true, the color limits of the plot will be set to the minimum and maximum fraction. |
:PopDensityMap | Simulation | Population density per region. | |
:R0Map | ResultData | Initial reproduction number (R0) per region. | |
:SinglesMap | Simulation | Fraction of single-person households per region. | fit_lims = false: If true, the color limits of the plot will be set to the minimum and maximum age. |
:WeeklyIncidenceMap | ResultData | 7-Day incidence per 100,000 per county. | week = 0: Specify which week you would like to see. |
Note: Maps that use infection data (e.g., the AttackRate) use the individuals' household location to map the data, not the loction of infection.
Some Useful Keyword Arguments
Here are some examples of the Plots.jl package's keyword arguments that you can also pass to the gemsmap() function and might find helpful:
clims = (0, 1): Setting the color bar range between 0 and 1colorbar = false: Disabling the colorbarsize = (300, 400): Resizing the map plottitle = "My Subtitle": Adding a subtitleplot_title = "My New Title": Changing the map titlefillcolor = :blues: Changing color schemelinecolor = nothing: Removing the outline of the map shapes
Please consult the Plots.jl package documentation for a comprehensive list
GEMS.agsmap — Function
agsmap(df::DataFrame, level::Int64; plotargs...)Returns a Plot.js plot with shapes of German states, counties, or municipalities. The input dataframe df requires two columns. The first column needs to be named ags and has to be a vector of AGS structs (Amtlicher Gemeindeschlüssel). The second column needs to be a vector of numerical values which are used to color-code the map. The function will look for shapefiles on the highest community level first (i.e. states). If no AGS matches, counties and municipalities will be evaluated next.
Parameters
df::DataFrame: DataFrame withags-named column that containsAGSstructs and a second column with numerical values.plotargs...(optional): Any argument that theplot()function of thePlots.jlpackage can take.
Returns
Plots.Plot: Plot using thePlots.jlpackage's struct.
GEMS.county_data — Function
county_data()Returns a dataframe with AGS and string-names of German counties.
GEMS.generate_map — Function
generate_map(coords::DataFrame, dest::AbstractString; region = [], plotempty::Bool = false)Generates a GMT map and stores it into the folder specified in dest. The coords DataFrame must provide at least a lat- and a lon-column specifying latitude and longitude data pairs. The region parameter expects an array of four integer values providing the outer bounds of the map according to [min_lon, max_lon, min_lat, max_lat]. If no region parameter is passed, the bounds are taken from the lan/lon range provided in the coords data with a %-padding according to MAP_PADDING defined in constants.jl . With the plotempty flag you can force to plot a map without any data points.
Parameters
coords::DataFrame: Dataframe withlatandloncolumndest::AbstractString: Storage location for the generated mapregion = [](optional): four-item region vector defining the map limits in lat/lon min/max pairs (look upGMT.jlpackage to learn about regions)plotempty::Bool = false(optional): Allows to plot an empty map if no data points are given
Returns
GMTWrapper: Custom struct containing the storage location of the generated map
GEMS.germanshapes — Method
germanshapes(level::Int64)Returns the Shapefile.Table object read from the respective shapefile. Downloads the file if it is not already locally available. Lookup constants.jl to find remote location of the shapefile. The level argument defines wether the state- (level = 1), county- (level = 2) or municipality- (level = 3) shapes are returned.
Returns
Shapefile.Table{Union{Missing, Shapefile.Polygon}}: Shapefile data. Lookup Shapefile.jl package for documentation.
GEMS.municipality_data — Function
municipality_data()Returns a dataframe with AGS and string-names of German municipalities.
Missing docstring for region_range(::DataFrame). Check Documenter's build log for details.
GEMS.state_data — Function
state_data()Returns a dataframe with AGS and string-names of German states.