hopping-cities

Artifact Content
Login

Artifact 000e60dc58722d033e6c5cf72398b261f720ee97:


.SUFFIXES: .csv .xls .pcm .flac
.PHONY: all clean

SS = ssconvert -T Gnumeric_stf:stf_csv fd://0 fd://1
SAMPLING_RATE = 72000

all: flights.csv external-trade.csv retail-sales.csv dwelling-stock.csv beds.csv catering.csv inbound-trips.csv consumer-price-index.csv gross-domestic-product.csv stocks.csv employment.csv government-payments.csv government-revenues.csv government-expenditures.csv investments-in-national-economy.csv employee-earnings.csv manual-worker-earnings.csv non-manual-worker-earnings.csv demographics.csv population.csv countryInfo.csv country_centroids_all.csv schengen.csv Amp_Clap_1.pcm CHH_1.pcm Clap_1.pcm FX_Chh_01.pcm HardHse_K_02.pcm HardHse_K_03_B.pcm Hard_CHH_01.pcm Hard_CHH_02.pcm Hard_Hse_OHH_1.pcm PowR_BD_1.pcm PowR_HH_1.pcm PowR_HH_2.pcm PowR_SN_1.pcm xFX_6.pcm yFX_3.pcm yFX_8.pcm

clean:
	rm *.csv *.pcm

employment.csv: employment.xls
	cat $< | $(SS) | sed -e 1d -e 3,4d -e '/Male/,$$ d' > $@

gross-domestic-product.csv: gross-domestic-product.xls
	cat $< | $(SS) | sed 1d > $@

external-trade.csv: external-trade.xls
	cat $< | $(SS) | sed -n -e 2p -e '238 s/Total/Imports/p' -e '477 s/Total/Exports/p' > external-trade.csv

retail-sales.csv: retail-sales.xls
	cat $< | $(SS) | sed -n -e '2p' -e '/Retail trade/p' | sed 's/.*",//' > retail-sales.csv

beds.csv: accomodation.xls
	cat accomodation.xls | $(SS) | cut -d, -f 1,2,11 | sed -n -e '/bed-places/,$$ p' | sed -e 's/.*bed-places.*/Year,Hotels,Total/' > beds.csv

catering.csv: catering.xls
	cat $< | $(SS) | sed 1d > $@

flights.csv: flights.xlsx
	ssconvert flights.xlsx flights.csv

flights.xlsx:
	wget -O flights.xlsx http://budapest.satrdays.org/BUD%20flights%202007-2012%20v2.xlsx

demographics.csv: demographics.html
	cat demographics.html | sed -n '/id="data-cens/,/<\/table/ p' | $(SS) | sed -e '2,$$ s/[ "]*//g' -e 's/\.[^,]*//' > demographics.csv

demographics.html:
	wget -O demographics.html 'http://www.ksh.hu/apps/hntr.telepules?p_lang=HU&p_id=13578'

.xls.csv:
	ssconvert $< $@

.flac.pcm:
	ffmpeg -i $< -f f64le -acodec pcm_f64le -ar $(SAMPLING_RATE) $@

#
# The rest of this file is xls downloads.
#

external-trade.xls:
	wget -O external-trade.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/3_5_6ie.xls

retail-sales.xls:
	wget -O retail-sales.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/4_4_12ie.xls

dwelling-stock.xls:
	wget -O dwelling-stock.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/2_3_1ie.xls

accomodation.xls:
	wget -O accomodation.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/4_5_11ie.xls

catering.xls:
	wget -O catering.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/4_5_19ie.xls

inbound-trips.xls:
	wget -O inbound-trips.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_infra/xls/4_5_1he.xls

consumer-price-index.xls:
	wget -O consumer-price-index.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_infra/xls/3_6_1he.xls

gross-domestic-product.xls:
	wget -O gross-domestic-product.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_infra/xls/3_1_1he.xls

stocks.xls:
	wget -O stocks.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_infra/xls/3_1_18he.xls

employment.xls:
	wget -O employment.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_infra/xls/2_1_0_2he.xls

# http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/i_qse005.html
government-payments.xls:
	wget -O government-payments.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/3_7_1_1ie.xls

government-revenues.xls:
	wget -O government-revenues.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/3_7_2ie.xls

government-expenditures.xls:
	wget -O government-expenditures.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/3_7_3ie.xls

investments-in-national-economy.xls:
	wget -O investments-in-national-economy.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/3_3_1ie.xls

employee-earnings.xls:
	wget -O employee-earnings.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/2_1_35ie.xls 

manual-worker-earnings.xls:
	wget -O manual-worker-earnings.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/2_1_36ie.xls

non-manual-worker-earnings.xls:
	wget -O non-manual-worker-earnings.xls http://www.ksh.hu/docs/eng/xstadat/xstadat_annual/xls/2_1_37ie.xls

population.csv: population.html
	cat population.html | sed -n '/class="wikitable/,/<\/table/ p' | $(SS) | cut -d, -f2- > population.csv
	
country_centroids.zip:
	wget http://gothos.info/resource_files/country_centroids.zip

country_centroids_all.csv: country_centroids.zip
	unzip -o country_centroids.zip
	@touch country_centroids_all.csv # so make doesn't run this again

countryInfo.txt:
	wget http://download.geonames.org/export/dump/countryInfo.txt

countryInfo.csv: countryInfo.txt
	sed -n -e 's/^#ISO/ISO/' -e '/^[^#]/ p' countryInfo.txt | ssconvert -I Gnumeric_stf:stf_csvtab fd://0 countryInfo.csv

schengen.csv: schengen.txt
	echo Country > schengen.csv && cat schengen.txt >> schengen.csv