Skip to content

Commit

Permalink
chore: set up GH pages for reports (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlFontal committed Oct 4, 2022
1 parent 466e6e6 commit 35cd007
Show file tree
Hide file tree
Showing 11 changed files with 188 additions and 7 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: deploy

on:
# Trigger the workflow on push to main branch
push:
branches:
- main

# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
build-and-deploy-book:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v2

# Install dependencies
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements.txt
# Copy README into build folder to include it as intro
- name: Copy README
run: |
cp README.md reports/index.md
# Build the book
- name: Build the book
run: |
jupyter-book build reports
- name: Clean notebook outputs for nicer HTML render
run: curl -s -S https://gist.githubusercontent.com/AlFontal/896e180f9f7772c4825067591f34c94b/raw > clean_notebook.py;
python clean_notebook.py --path reports

# Deploy the book's HTML to gh-pages branch
- name: GitHub Pages action
uses: peaceiris/actions-gh-pages@v3.6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: reports/_build/html
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ data/air_pollution/stations/doc/TM20140000.txt
data/air_pollution/stations/doc/TM20130000.txt
data/air_pollution/stations/doc/TM20120000.txt
data/air_pollution/stations/doc/TM20110000.txt
data/doc/images/*

# Japanese e-Stat site API key
.appID
data/shapefiles/administrative_boundaries/municipality_shapes.cpg
data/shapefiles/administrative_boundaries/municipality_shapes.dbf
data/shapefiles/administrative_boundaries/municipality_shapes.prj
data/shapefiles/administrative_boundaries/municipality_shapes.shp
data/shapefiles/administrative_boundaries/municipality_shapes.shx
data/shapefiles/administrative_boundaries/prefecture_shapes.cpg
data/shapefiles/administrative_boundaries/prefecture_shapes.dbf
data/shapefiles/administrative_boundaries/prefecture_shapes.prj
data/shapefiles/administrative_boundaries/prefecture_shapes.shp
data/shapefiles/administrative_boundaries/prefecture_shapes.shx
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# Japan's environmental Data

![License Badge](https://img.shields.io/github/license/AlFontal/environmental-data-japan?color=blue)
![Pages Badge](https://github.com/AlFontal/environmental-data-japan/actions/workflows/deploy.yml/badge.svg)
[![Pages site badge](https://img.shields.io/badge/Pages%20Site-Online-green)](https://alfontal.github.io/environmental-data-japan)

[![Stations data](https://img.shields.io/badge/Stations-Download-orange)](https://github.com/AlFontal/environmental-data-japan/tree/main/data/air_pollution/stations/clean)
[![Municipal data](https://img.shields.io/badge/Municipalities-Download-orange)](https://github.com/AlFontal/environmental-data-japan/tree/main/data/air_pollution/municipalities)
[![Prefectures data](https://img.shields.io/badge/Prefectures-Download-orange)](https://github.com/AlFontal/environmental-data-japan/tree/main/data/air_pollution/prefectures)

Repository collecting and organizing environmental data sources for Japan.

Here, we have downloaded and processed the data available through the site made available by the Japanese National Institute for Environmental Studies (NIES) (<https://tenbou.nies.go.jp/download/>).

More specifically, we have downloaded the Air Pollution Monitoring data for a total of 2039 stations located around the whole country (represented as red dots in the map below):

<img src="https://github.com/AlFontal/environmental-data-japan/raw/main/data/air_pollution/stations/doc/stations_map.png" alt="Japanese Monitoring Stations Map" title="Japanese Monitoring Stations Map">
<img src="https://github.com/AlFontal/environmental-data-japan/raw/main/data/air_pollution/stations/doc/stations_map.png" alt="Japanese Monitoring Stations Map" title="Japanese Monitoring Stations Map" width=400px>

## The stations

Information for the exact location of each station (latitude, longitude and altitude) and the environmental variables available can be found in the table in [`/data/air_pollution/stations/doc/stations_info.csv`](data/air_pollution/stations/doc/stations_info.csv)
Information for the exact location of each station (latitude, longitude and altitude) and the environmental variables available can be found in the table in [`/data/air_pollution/stations/doc/stations_info.csv`](https://github.com/AlFontal/environmental-data-japan/data/air_pollution/stations/doc/stations_info.csv)

## Variables measured

Expand Down Expand Up @@ -39,20 +47,20 @@ Since the repository includes data for over 2000 stations, the measured variable

### (1) Station data

Daily data for each station and its measured variables from 2011-01-01 to 2018-12-31 can be accessed in the [`data/air_pollution/stations/clean`](data/air_pollution/stations/clean) folder, classified in subfolders according to the prefecture where they are located.
Daily data for each station and its measured variables from 2011-01-01 to 2018-12-31 can be accessed in the [`data/air_pollution/stations/clean`](https://github.com/AlFontal/environmental-data-japan/data/air_pollution/stations/clean) folder, classified in subfolders according to the prefecture where they are located.

### (2) Municipalities

Averaged daily data for all stations within each municipality in Japan during the same period can be found in the [`data/air_pollution/municipalities`](data/air_pollution/municipalities/) folder, with the first 2 digits of each CSV file indicating the prefecture code and the last 3 digits indicating the municipal code.
Averaged daily data for all stations within each municipality in Japan during the same period can be found in the [`data/air_pollution/municipalities`](https://github.com/AlFontal/environmental-data-japan/data/air_pollution/municipalities/) folder, with the first 2 digits of each CSV file indicating the prefecture code and the last 3 digits indicating the municipal code.

### (3) Prefectures

Estimates of the daily data for each prefecture have been estimated by averaging over the municipal averages in each prefecture.

At this point, three different methods have been used to compute the averages, weighing the municipalities differently according to diverse criteria:

+ **Area-based weighted averages**: These averages are completely population-naïve and try to better estimate the overall values for each variable across the whole area of the prefecture, wheighing high and low population density areas exactly the same. The time-series for these can be found in [`data/air_pollution/prefectures/area_weighted`](data/air_pollution/prefectures/area_weighted).
+ **Area-based weighted averages**: These averages are completely population-naïve and try to better estimate the overall values for each variable across the whole area of the prefecture, wheighing high and low population density areas exactly the same. The time-series for these can be found in [`data/air_pollution/prefectures/area_weighted`](https://github.com/AlFontal/environmental-data-japan/data/air_pollution/prefectures/area_weighted).

+ **Population-weighted averages**: These averages are computed trying to estimate the values of each variable that represent the most accurate exposure of the population of each prefecture to each pollutant/meteorological variable. For these purpose, the values for each variable have been averaged weighing every municipal term according to their population share in the prefecture. The time-series for these can be found in [`data/air_pollution/prefectures/population_weighted`](data/air_pollution/prefectures/population_weighted).
+ **Population-weighted averages**: These averages are computed trying to estimate the values of each variable that represent the most accurate exposure of the population of each prefecture to each pollutant/meteorological variable. For these purpose, the values for each variable have been averaged weighing every municipal term according to their population share in the prefecture. The time-series for these can be found in [`data/air_pollution/prefectures/population_weighted`](https://github.com/AlFontal/environmental-data-japan/data/air_pollution/prefectures/population_weighted).

+ **Infant population-weighted averages**: Following the same principal as the previous averages, these include the daily prefecture-level estimates of each measured variable based on the share of *children under 5 years old* in each municipal term. The time-series for these can be found in [`data/air_pollution/prefectures/under_5_weighted`](data/air_pollution/prefectures/under_5_weighted).
+ **Infant population-weighted averages**: Following the same principal as the previous averages, these include the daily prefecture-level estimates of each measured variable based on the share of *children under 5 years old* in each municipal term. The time-series for these can be found in [`data/air_pollution/prefectures/under_5_weighted`](https://github.com/AlFontal/environmental-data-japan/data/air_pollution/prefectures/under_5_weighted).
Binary file modified data/air_pollution/stations/doc/stations_map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions reports/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# yaml-language-server: $schema=./_config.yaml
#######################################################################################
# A default configuration that will be loaded for all jupyter books
# See the documentation for help and more options:
# https://jupyterbook.org/customize/config.html

#######################################################################################
# Book settings
title : Japan's Environmental Data # The title of the book. Will be placed in the left navbar.
author : Alejandro Fontal # The author of the book
copyright : "2022" # Copyright year to be placed in the footer
logo : images/logo.png # A path to the book logo

execute:
execute_notebooks: "off"

repository:
url: https://github.com/AlFontal/environmental-data-japan
branch: main
html:
use_repository_button: true
use_issues_button: true
favicon: images/favicon.ico
baseurl: 'https://alfontal.github.io/environmental-data-japan'
comments:
utterances:
repo: 'AlFontal/environmental-data-japan'
extra_navbar: |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div>
<hr>
<a href="https://helical-itn.eu/">
<img src="https://helical-itn.eu/wp-content/uploads/2020/01/cropped-HELICAL_logo-3.png" width=200px>
</a>
<p></p>
<a href="https://www.isglobal.org/en/-/clima-y-salud">
<img src="https://www.isglobal.org/isglobal-new-theme/assets/images/isglobal/logo-isglobal-en.png" width=200px>
</a>
<hr>
<a href="https://www.linkedin.com/in/alfontal/">
<img class="profile" src="https://avatars.githubusercontent.com/u/10958332?s=400&amp;u=51edd1406d2af0c2f1723a0bf8f111d48a1b7fe7&amp;v=4" alt="Alejandro Fontal">
<p style="text-align: center; font-size:16px"><b>Alejandro Fontal</b></p>
</a>
<a href="https://github.com/AlFontal" class="fa fa-github" style="font-size: 25px;"></a>
<a href="https://www.linkedin.com/in/alfontal/" class="fa fa-linkedin" style="font-size: 25px;"></a></a>
<a href="https://twitter.com/alefontal" class="fa fa-twitter" style="font-size: 25px;"></a></a>
<a href="mailto:alejandro.fontal.92@gmail.com" class="fa fa-envelope" style="font-size: 25px;"></a></a>
</div>
bibtex_bibfiles: references.bib

sphinx:
config:
html_js_files:
- https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js
bibtex_reference_style: author_year

html_baseurl: 'https://alfontal.github.io/environmental-data-japan/'

extra_extensions:
- sphinx_sitemap

40 changes: 40 additions & 0 deletions reports/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro&family=Noto+Serif&display=swap');

div.cell div.cell_input {
padding-left: 0em;
padding-right: 0em;
border: 1px #ccc solid;
background-color: #f7f7f7;
/* I am overriding the default green left sidebar for code cells */
/*! border-left-color: green; */
/*! border-left-width: medium; */
}

:root {
--pst-font-family-base-system: 'Noto serif', serif;
}

p {
text-align: justify;
}

.fa {
margin: 0 10px 0 0;
color: #083466;
text-decoration: none;
}




.fa:hover {
opacity: 0.7;
}

img.profile {
display: block;
border-radius: 50%;
margin: 0 auto;
width: 120px;
height: 120px;
}
7 changes: 7 additions & 0 deletions reports/_toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
format: jb-article
root: index
sections:
- file: prefecture_weighted_averages
title: From station to prefectural data


Binary file added reports/images/favicon.ico
Binary file not shown.
Binary file added reports/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added reports/references.bib
Empty file.
8 changes: 8 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
bs4
html5lib
jupyter-book==v0.12.3
matplotlib
numpy
ghp-import
sphinxcontrib-bibtex==2.2.0
sphinx-sitemap

0 comments on commit 35cd007

Please sign in to comment.