-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Estimate Localized Economic Impacts in Tourism (#18)
* Add visits notebook * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Revert "[pre-commit.ci] auto fixes from pre-commit.com hooks" This reverts commit aa824e3. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
1108d6d
commit fbba2cb
Showing
10 changed files
with
2,114 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Economic Impacts in Tourism | ||
|
||
Understanding where and when population movement occurs can help inform disaster response and public policy, especially during crises. | ||
|
||
(mobility-data)= | ||
|
||
## Data | ||
|
||
The project team acquired longitudinal human mobility data. The mobility data was provided pro-bono by [Veraset](https://veraset.com) through the proposal [Measure Activity Levels on Tourism Sites Affected by the 2023 Red Sea Crisis](https://portal.datapartnership.org/readableproposal/565) via the [Development Data Partnership](https://datapartnership.org). During the project’s execution, [Veraset Movement](https://www.veraset.com/products/movement/)’s global daily data feed was ingested and processed through the [Mobility](https://docs.datapartnership.org/collections/mobility/README.html) pipeline maintained by the [Development Data Partnership](https://datapartnership.org/). For additional information, please refer to the [Mobility Documentation](https://docs.datapartnership.org/collections/mobility/README.html) accessible to all World Bank staff. | ||
|
||
### Data Availability Statement | ||
|
||
Data are available upon request through the [Development Data Partnership](https://datapartnership.org). Licensing and access information for all other datasets are included in the documentation. | ||
|
||
## Methodology | ||
|
||
```{caution} | ||
The following working methodologies are a work in progress and awaiting review. | ||
``` | ||
|
||
- [Estimating Activity Through Point of Interest Visits Using Mobility Data](./visits.ipynb) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from importlib.metadata import version, PackageNotFoundError | ||
|
||
try: | ||
__version__ = version("red-sea-monitoring") | ||
except PackageNotFoundError: | ||
# package is not installed | ||
pass |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,37 @@ | ||
from bokeh.plotting import figure, ColumnDataSource | ||
from bokeh.models import Legend, Span, Label | ||
from bokeh.layouts import column | ||
import datetime | ||
|
||
from bokeh.core.validation import silence | ||
from bokeh.core.validation.warnings import EMPTY_LAYOUT | ||
|
||
from bokeh.layouts import column | ||
from bokeh.models import HoverTool, Label, Legend, Span, Title | ||
from bokeh.plotting import ColumnDataSource, figure | ||
|
||
# Use the silence function to ignore the EMPTY_LAYOUT warning | ||
silence(EMPTY_LAYOUT, True) | ||
|
||
COLORS = [ | ||
"#4E79A7", # Blue | ||
"#F28E2B", # Orange | ||
"#E15759", # Red | ||
"#76B7B2", # Teal | ||
"#59A14F", # Green | ||
"#EDC948", # Yellow | ||
"#B07AA1", # Purple | ||
"#FF9DA7", # Pink | ||
"#9C755F", # Brown | ||
"#BAB0AC", # Gray | ||
"#7C7C7C", # Dark gray | ||
"#6B4C9A", # Violet | ||
"#D55E00", # Orange-red | ||
"#CC61B0", # Magenta | ||
"#0072B2", # Bright blue | ||
"#329262", # Peacock green | ||
"#9E5B5A", # Brick red | ||
"#636363", # Medium gray | ||
"#CD9C00", # Gold | ||
"#5D69B1", # Medium blue | ||
] | ||
|
||
|
||
def get_bar_chart( | ||
dataframe, | ||
|
@@ -244,3 +268,84 @@ def _create_title_figure(text, width, height, font_size, font_style="bold"): | |
title_fig.axis.minor_tick_line_color = None | ||
title_fig.outline_line_color = None | ||
return title_fig | ||
|
||
|
||
def plot_visits(data, title="Points of Interest Visit Trends"): | ||
"""Plot number of visits to OSM points of interest""" | ||
|
||
p = figure( | ||
title=title, | ||
width=750, | ||
height=750, | ||
x_axis_label="Date", | ||
x_axis_type="datetime", | ||
y_axis_label="Count of Devices", | ||
y_axis_type="log", | ||
y_range=(0.75, 5 * 10**3), | ||
tools="pan,reset,save,box_select", | ||
) | ||
p.add_layout(Legend(), "right") | ||
p.add_layout( | ||
Title( | ||
text="Count of Devices Identified with OpenStreetMap tag", | ||
text_font_size="12pt", | ||
text_font_style="italic", | ||
), | ||
"above", | ||
) | ||
p.add_layout( | ||
Title( | ||
text=f"Source: Veraset Movement. Creation date: {datetime.datetime.today().strftime('%d %B %Y')}. Feedback: [email protected].", | ||
text_font_size="10pt", | ||
text_font_style="italic", | ||
), | ||
"below", | ||
) | ||
|
||
# plot spans | ||
p.renderers.extend( | ||
[ | ||
Span( | ||
location=datetime.datetime(2023, 10, 7), | ||
dimension="height", | ||
line_color="grey", | ||
line_width=2, | ||
line_dash=(4, 4), | ||
), | ||
Span( | ||
location=datetime.datetime(2023, 11, 17), | ||
dimension="height", | ||
line_color="grey", | ||
line_width=2, | ||
line_dash=(4, 4), | ||
), | ||
] | ||
) | ||
|
||
# plot lines | ||
for i, (col, color) in enumerate(zip(data.columns, COLORS)): | ||
try: | ||
r = p.line( | ||
data.index, | ||
data[col], | ||
legend_label=col, | ||
line_color=color, | ||
line_width=2, | ||
) | ||
if i != 0: | ||
r.muted = True | ||
except KeyError: | ||
pass | ||
|
||
p.add_tools( | ||
HoverTool( | ||
tooltips=[("Date", "@x{%F}"), ("Count", "@y")], | ||
formatters={"@x": "datetime"}, | ||
) | ||
) | ||
|
||
p.legend.location = "bottom_left" | ||
p.legend.click_policy = "mute" | ||
p.title.text_font_size = "16pt" | ||
p.sizing_mode = "scale_both" | ||
return p |