surveyweathertool.src.weather.create_visuals

Module Contents

Functions

show_images_on_dashboard(st, logos_path)

Read logos and put it in the dashboard

get_center(df)

Calculates the geographical center of a GeoDataFrame based on the bounding coordinates.

generate_choropleth(combined_df, admin, column, ...[, ...])

Generates a Folium map with a choropleth layer.

generate_bivariate_map(combined_df_1, combined_df_2, ...)

Generates a Folium map with a choropleth layer.

generate_interactive_time_series(df, weather_data_name)

plot_poverty_index(map_nigeria, wave_panel_df, column)

Plot the poverty index for households on a Nigeria map.

surveyweathertool.src.weather.create_visuals.show_images_on_dashboard(st, logos_path)

Read logos and put it in the dashboard

surveyweathertool.src.weather.create_visuals.get_center(df)

Calculates the geographical center of a GeoDataFrame based on the bounding coordinates.

Parameters:

dfgeopandas.GeoDataFrame

A GeoDataFrame containing a ‘geometry’ column with geographical shapes.

Returns:

list

A list with two elements, the longitude and latitude of the geographical center.

surveyweathertool.src.weather.create_visuals.generate_choropleth(combined_df: geopandas.GeoDataFrame, admin: str, column: str, legend_name: str, fill_color: str = 'YlOrRd', zoom_start: int = 5, **kwargs)

Generates a Folium map with a choropleth layer.

Parameters:

combined_dfgpd.GeoDataFrame

The data to use for the map. It should include a ‘geometry’ column and p.

adminstr

The name of the column in combined_df to use for the choropleth. This column should contain unique identifiers for the regions in the map.

column: str

The name of the column in combined_df to use for the choropleth.

legend_name: str

The legend title of the map.

zoom_start: int, optional

zoom level of the map

fill_colorstr, optional

Color palette for the choropleth. Default is “YlOrRd”. Please change this if you want to plot for something not related to temperature. For precipitation it might be good to have green or blue like figure.

Returns:

folium.Map

A Folium Map object that can be displayed.

surveyweathertool.src.weather.create_visuals.generate_bivariate_map(combined_df_1: geopandas.GeoDataFrame, combined_df_2: geopandas.GeoDataFrame, admin: str, column_1: str, column_2: str, legend_1: str, legend_2: str, zoom_start: int = 5, **kwargs)

Generates a Folium map with a choropleth layer.

Parameters:

combined_df_1gpd.GeoDataFrame

The data to use for the map. It should include a ‘geometry’ column and p. Also should include column 1.

combined_df_2gpd.GeoDataFrame

The data to use for the map. It should include a ‘geometry’ column and p. Also should include column 2.

adminstr

The name of the column in combined_df to use for the choropleth. This column should contain unique identifiers for the regions in the map.

column_1: str

Column 1 (or variable 1) from combined_df_1 to consider for the bivariate map

column_2: str

Column 2 (or variable 2) from combined_df_2 to consider for the bivariate map

legend_1: str

The legend title for combined_df_1 to consider for the bivariate map

legend_2: str

The legend title for combined_df_2 to consider for the bivariate map

zoom_start: int, optional

zoom level of the map

Returns:

folium.Map

A Folium Map object that can be displayed.

surveyweathertool.src.weather.create_visuals.generate_interactive_time_series(df, weather_data_name)
surveyweathertool.src.weather.create_visuals.plot_poverty_index(map_nigeria: geopandas.GeoDataFrame, wave_panel_df: geopandas.GeoDataFrame, column: str)

Plot the poverty index for households on a Nigeria map.

Parameters: - map_nigeria: GeoDataFrame

A GeoDataFrame representing the map of Nigeria.

  • wave_panel_df: GeoDataFrame

    A GeoDataFrame containing the household points, which has a column that denotes the poverty indicator of each household.

column:

Poverty indicator column to visualize

Returns: None. This function will plot the map.