Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update01 #1

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,58 @@
# 2018_06_copernicus_by_newbies
## SK WASTE SCRAPPER:

## Summary:

The partial aims of the attempt were:
1. Find a faster way to download data covering annual waste production and managment at SK NUTS3 and SK LAU1.
2. Based on the combination of Aim 1's outcomes and INSPIRE dataset (SK Protected sites) find a way to identify if district with higher percentage of their are covered with protected sites have lower waste produciton.
3. Based on copernicus datasets (eg. Carbon dioxide data from 2002 to present derived from satellite sensors, CAMS Regional Air Quality etc.) identify if waste production has impact on variables (eg. air polution, CO2, Methane etc.).

## Motivation a Target user groups:

The main aim was to use the partial aims' outcomes (listed below) for:
1. Communication with citizens about the impacts of waste production on their living conditions.
2. Creating an easier access to the listed data for non-programers, but still relevant stakeholders:
a. local public administrators,
b. academia and environmental researchers.

## Results:
SPOILER ALERT1: Since it was the first time that one of the authors(C) met with NetCDF, copernicus data has been postponed till proper self-tutoring.
SPOILER ALERT2: ST_UNION on the INSPIRE SK protected_sites has not yet finnished (My mistake)

1. sk_lau1_waste_scrapper.py
For using (default setting dumps to csv):
a. add sql_engine.py or drop result to csv
b. chose type of waste category by calling the function (lines xxxx - xxxx)

# sk_lau1_waste_scrapper:

a. scraps data on waste from the Slovak Ministry of Environment's Partial Monitoring System of Waste @ http://cms.enviroportal.sk/odpady/verejne-informacie.php? with official sk nuts 3 and lau 1 id and in annual 'series'

b. gives the user to opportunity to dump:
b1: to sql database with geom,
b3: csv.

# posts/sk_lau1_waste_scrapper:
A Simple Django app in a simpler template with each waste category represented by a button, that allows the user to download correspondent waste category for all available years and regions at once into .CSV 2 in 60 seconds
Usage:
Unpack posts.rar in the same directory as the other file

pip install --user posts/dist/posts-0.1.tar.gz

- works on locahost just fine,
- works fine on pythonanywhere with a paid account.

#COLUMNS ABBREVIATIONS:
#r_material MEANS material valuation -> column: Zhodnocovonie materiálové
#r_energetic MEANS energetic valuation -> column: Zhodnocovanie energetické
#r_other MEANS other valuation -> column: Zhodnocovanie ostatné
#d_landfilling MEANS disposal by landfilling -> column: Zneškodňovanie skládkovaním
#d_non_energy_combustion MEANS disposal by disposal by combsution without energetic valuation -> column Zneškodňovanie bez energetického využitia
#d_other MEANS other type of disposal -> column: Zneškodňovanie ostatné
#o_managed MEANS other type of management -> column: Iný spôsob nakladania
#total MEAS total volume of waste -> column: Spolu

ips_xx_ha = size of protected areas with a date of legal foundation in hectares
Ips_xx_pct = pct coverage of the district by protected sites with a date of legal foundation
Ips_nlf_ha = size of protected areas without a date of legal foundation in hectares
t_ips_xx_ha = ips_xx_ha + _ips_nlf_ha
Binary file added SK_LAU1_scapper.pptx
Binary file not shown.
Binary file added db.sqlite3
Binary file not shown.
Binary file added djangoproject/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added djangoproject/__pycache__/settings.cpython-36.pyc
Binary file not shown.
Binary file added djangoproject/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file added djangoproject/__pycache__/wsgi.cpython-36.pyc
Binary file not shown.
121 changes: 121 additions & 0 deletions djangoproject/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
"""
Django settings for djangoproject project.

Generated by 'django-admin startproject' using Django 2.1.3.

For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'o$j6g+z=nqp^ord04a=q==2_lzb_m@c5^@+099f$*nv0kbmap6'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'posts',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'djangoproject.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'djangoproject.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/

STATIC_URL = '/static/'
10 changes: 10 additions & 0 deletions djangoproject/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.contrib import admin
from django.urls import path
from django.conf.urls import url, include

urlpatterns = [
url(r'^$', include('posts.urls')),
url(r'^admin/', admin.site.urls),
url(r'^posts/', include('posts.urls')),

]
16 changes: 16 additions & 0 deletions djangoproject/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for djangoproject project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoproject.settings')

application = get_wsgi_application()
15 changes: 15 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python
import os
import sys

if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoproject.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
Binary file added posts.rar
Binary file not shown.
1 change: 1 addition & 0 deletions shp/ips_m_0512.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UTF-8
Binary file added shp/ips_m_0512.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions shp/ips_m_0512.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["ETRS89",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
1 change: 1 addition & 0 deletions shp/ips_m_0512.qpj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["ETRS89",DATUM["European_Terrestrial_Reference_System_1989",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6258"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4258"]]
Binary file added shp/ips_m_0512.shx
Binary file not shown.
1 change: 1 addition & 0 deletions shp/ips_nn_union.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UTF-8
Binary file added shp/ips_nn_union.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions shp/ips_nn_union.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["S_JTSK_Krovak_East_North",GEOGCS["GCS_S-JTSK",DATUM["D_S_JTSK",SPHEROID["Bessel_1841",6377397.155,299.1528128]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Krovak"],PARAMETER["latitude_of_center",49.5],PARAMETER["longitude_of_center",24.83333333333333],PARAMETER["azimuth",30.28813972222222],PARAMETER["pseudo_standard_parallel_1",78.5],PARAMETER["scale_factor",0.9999],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]]
1 change: 1 addition & 0 deletions shp/ips_nn_union.qpj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["S-JTSK / Krovak East North",GEOGCS["S-JTSK",DATUM["System_Jednotne_Trigonometricke_Site_Katastralni",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],TOWGS84[589,76,480,0,0,0,0],AUTHORITY["EPSG","6156"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4156"]],PROJECTION["Krovak"],PARAMETER["latitude_of_center",49.5],PARAMETER["longitude_of_center",24.83333333333333],PARAMETER["azimuth",30.28813972222222],PARAMETER["pseudo_standard_parallel_1",78.5],PARAMETER["scale_factor",0.9999],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","5514"]]
Binary file added shp/ips_nn_union.shp
Binary file not shown.
Binary file added shp/ips_nn_union.shx
Binary file not shown.
1 change: 1 addition & 0 deletions shp/sk_lau1_ips_pct.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UTF-8
Binary file added shp/sk_lau1_ips_pct.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions shp/sk_lau1_ips_pct.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["ETRS89",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
1 change: 1 addition & 0 deletions shp/sk_lau1_ips_pct.qpj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["ETRS89",DATUM["European_Terrestrial_Reference_System_1989",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6258"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4258"]]
Binary file added shp/sk_lau1_ips_pct.shp
Binary file not shown.
Binary file added shp/sk_lau1_ips_pct.shx
Binary file not shown.
Loading