Misc

Overview Structs

Overview Functions

AGS

Constructors

GEMS.AGSType
AGS

Struct to represent Germany's Community Identification Number (Amtlicher Gemeindeschlüssel).

Taken from Wikipedia (https://en.wikipedia.org/wiki/Community_Identification_Number):

The municipality key consists of eight digits, which are generated as follows: The first two digits designate the individual German state. The third digit designates the government district (in areas without government districts a zero is used instead). The fourth and fifth digits designate the number of the urban area (in a district-free city) or the district (in a city with districts). In GEMS they are called 'counties'. The sixth, seventh, and eighth digits indicate the municipality or the number of the unincorporated area.

Example

münster = AGS("05515000")

The above code generates the community identification number for the city of Münster.

  • The first two digits identify the state of North Rhine-Westphalia (05)
  • The third digit identifies the government district Münster (5)
  • The fourth and fifth digit identify the district-free city of Münster (15)

Being a district-free city, Münster does not have a municipality code. Examples for municipalities are: Emsdetten (05566008), Warendorf (05570052), or Steinfurt (05566084).

There are multiple helper functions to navigate through the hierarchical AGS structure such as: state, district, county, or municiaplity which each return the AGS of the respective geographic level. The is_state, is_district, and is_county return true, if the provided AGS is on the respective geographic level. Moreover, in_state, in_district, and in_county verify whether a provided AGS is contained in a parent region.

AGS are directly comparable (==) and broadcastable (.==).

Note:

There is no is_municiaplity function as this could be confused as a check wether the AGS is on the lowest geographic level. However, as there are district-free cities which are technically municipalities but without the last three digits given, this check could only be done with context information on the actual region. Based purely on the number, we do not know which county has contains municipalites and which conty is a district-free city.

Functions

GEMS.countyMethod
county(ags::AGS)

Returns the parent county's Community Identification Number (AGS) of the provided AGS.

GEMS.districtMethod
district(ags::AGS)

Returns the parent district's Community Identification Number (AGS) of the provided AGS.

GEMS.idMethod
id(ags::AGS)

Retuns the AGSs internal number (int).

GEMS.in_countyMethod
in_county(ags::AGS, parent::AGS)

Returns true if the county-section of both Community Identification Numbers (AGS) match. Both AGSs are in the same county.

GEMS.in_districtMethod
in_district(ags::AGS, parent::AGS)

Returns true if the district-section of both Community Identification Numbers (AGS) match. Both AGSs are in the same district.

GEMS.in_stateMethod
in_state(ags::AGS, parent::AGS)

Returns true if the state-section of both Community Identification Numbers (AGS) match. Both AGSs are in the same state.

GEMS.is_countyMethod
is_district(ags::AGS)

Returns true if the Community Identification Number (AGS) belongs to a conty. First five digits given, last three being 0s.

GEMS.is_districtMethod
is_district(ags::AGS)

Returns true if the Community Identification Number (AGS) belongs to a governmental district. First three digits given, everything else being 0s.

GEMS.is_stateMethod
is_state(ags::AGS)

Returns true if the Community Identification Number (AGS) belongs to a state. First two digits given, everything else being 0s.

GEMS.isunsetMethod
isunset(ags::AGS)

Returns true if the AGS is the "empty" default and does not actually belongs to a any geographic region.

GEMS.municipalityMethod
municipality(ags::AGS)

Returns the Community Identification Number (AGS) regardless of its geographic level.

GEMS.stateMethod
state(ags::AGS)

Returns the parent state's Community Identification Number (AGS) of the provided AGS.

Utils

GEMS._intFunction
_int(f::Function)

Wrapper to enforce Integer returns of anonymous functions.

GEMS.aggregate_dfFunction
aggregate_df(df::DataFrame, key::Symbol)

Groups dataframes (with numerical values) on the provided key column and applies the aggregate_values function to each of them. The resulting dataframe has all initial columns supplemented with the suffixes min, max, mean, lower_95, upper_95, and std

GEMS.aggregate_dfsFunction
aggregate_dfs(dfs::Vector{DataFrame}, key::Symbol)

Joins the input vector of dataframes on the key and aggregates the residual data. Requires all dataframes to provide the exact same columns and column names.

GEMS.aggregate_dfs_multcolFunction
aggregate_dfs_multcol(dfs::Vector{DataFrame}, key::Symbol)

Aggregates data on the columns of the dataframes contained in the provided vector for each value in the key column. All dataframes must have identical columnnames. Returns a dictionary with the columnnames as keys and a dataframe as the value.

GEMS.foldercountMethod
foldercount(directory)

Returns the number of subfolders in a directory.

GEMS.group_by_ageMethod
group_by_age(df::DataFrame)

Groups a dataframe by its "age" column. The column "sum" contains the sum of each individual in this age. This also adds rows for each age from 0 till the maximum age in the "age" column.

Returns

  • returns a DataFrame with an additional column "sum". This column contains the count of the age in the DataFrame.
GEMS.print_aggregatesFunction
print_aggregates(agg; unit, multiplier, digits)

Pretty-prints the outcomes of an aggregate_values() function call.

GEMS.printinfoMethod
printinfo(str::String)

Prints an @info-Text with the provided string and a HH:MM:SS timestamp.

GEMS.remove_kwFunction
remove_kw(to_remove::Symbol, kwrds)

Removes a particular keyword from a Named Tuple keyword ist. This is mainly used to exclude certain keywords in plots when passing plotargs... to subplots.

Example

function my_function(;args...)
    new_kwrds = remove_kw(:a, args)
    my_other_function(new_kwrds...)
end

If you call the above function with my_function(a = 2, b = 3), it will call the inner function with my_other_function(b = 3).

GEMS.subinfoMethod
subinfo(str::String)

Returns a string with a "sub-line-hook" indicating subtasks of an @info task (as generated by printinfo())