Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

data_dir = os.path.join(os.path.abspath(''),'data')
image_dir = os.path.join('assets/images')
assets_dir = os.path.join('assets')
static_image_route = '/static/'

# We download each csv and store it in a pd.DataFrame
Expand Down Expand Up @@ -338,8 +339,9 @@ def convertList_hex2rgba(hex_list):

mapCI = go.Figure(
data=go.Choropleth(
geojson=os.path.join(data_dir, 'world.geo.json'),
geojson='data/world-geo-json',
locations = map_df.ISO3,
featureidkey="properties.ISO_A3",
locationmode='geojson-id',
z=map_df.carbonIntensity.astype(float),
colorscale=myColors['map1'],
Expand Down Expand Up @@ -2248,10 +2250,13 @@ def fillin_report_text(aggData, data):
# Loader IO
@app.server.route('/loaderio-1360e50f4009cc7a15a00c7087429524/')
def download_loader():
return send_file('assets/loaderio-1360e50f4009cc7a15a00c7087429524.txt',
mimetype='text/plain',
attachment_filename='loaderio-1360e50f4009cc7a15a00c7087429524.txt',
return send_file(os.path.join(assets_dir, 'loaderio-1360e50f4009cc7a15a00c7087429524.txt'),
as_attachment=True)
# world.geo.json
@app.server.route('/data/world-geo-json')
def download_world_geo_json():
return send_file(os.path.join(data_dir, 'world.geo.json'))


if __name__ == '__main__':
# allows app to update when code is changed!
Expand Down