User Tools

Site Tools


wiki:urbanmod

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:urbanmod [2017/12/05 22:53] (current)
Line 1: Line 1:
  
 +==== Urban and Peri-Urban Tree Cover in European Cities: Current Distribution and Future Vulnerability Under Climate Change Scenarios. ====
 +
 +Casalegno S. 2011. Urban and Peri-Urban Tree Cover in European Cities: Current Distribution and Future Vulnerability Under Climate Change Scenarios. In: Global warming impacts: case studies on the economy, human health, and on urban and natural environments. Editor: ​ S. Casalegno. Intech Open Access Publisher. [[http://​www.intechopen.com/​books/​show/​title/​global-warming-impacts-case-studies-on-the-economy-human-health-and-on-urban-and-natural-environments|ISBN 978-953-307-785-7]]. ​ \\
 +
 +
 +<code bash>
 +# #!/bin/bash
 +#
 +# Angera June 2011
 +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 +
 +# Author: Stefano Casalegno
 +
 +# FBK MPBA research unit: Predictive Models for Biomedicine & Environment,​ Trento Italy
 +
 +
 +##########################################################################​
 +# Download CORINE Land cover from EEA
 +# http://​www.eea.europa.eu/​data-and-maps/​data
 +# Corine Land Cover (clc) 2000 raster data, resolution 100 m (g100_06.zip,​ ZIP archive 101.46 MB)
 +# Legends :: clc_legend.csv (Plain Text  3.88 KB) 
 +# /​data-and-maps/​data/​ga-downloads/​SH04UZP80M/​corine-land-cover-2006-raster/​clc_legend.csv
 +#
 +# Download
 +mkdir ~/​tmpDWNLOAD
 +wget -O ~/​tmpDWNLOAD/​g100_00.zip "​http://​www.eea.europa.eu/​data-and-maps/​data/​corine-land-cover-2006-raster/​clc-2006-100m/​g100_00.zip/​at_download/​file"​
 +# unzip data
 +unzip ~/​tmpDWNLOAD/​g100_00.zip ​
 +
 +
 +# Create a working directory at your choice:
 +mkdir /​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO
 +
 +# Create a New Grass project using LAEA projection EPSG:3035;
 +# GRASSDB: grassdbwv
 +# Grass Location:​LAEA
 +# GRASS Mapset UFO
 +# You need to have the bash script create_location.sh saved in your "​~/​ost4sem/"​ folder
 +cd ~/ost4sem/
 +cp ~/​tmpDWNLOAD/​g100_00/​g100_00.tif ~/​ost4sem/​g100_00.tif
 +bash  create_location.sh g100_00.tif LAEA  ~/​ost4sem/​grassdbwv/​
 +rm ~/​ost4sem/​g100_00.tif
 +cd /​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO
 +# Start grass in text mode
 +grass -text /​home/​ste/​ost4sem/​grassdbwv/​LAEA/​PERMANENT ​
 +g.mapset mapset=UFO -c
 +
 +
 +# Import Corine in Grass
 +r.in.gdal -o input=~/​data10/​EEA/​corine_LC_2000_100m/​g100_00.tif output=clc --overwrite
 +# g.region rast=clc
 +# r.mapcalc water = "if( clc == 44 || clc == 43 ||  clc == 40 , 0 , 1)"
 +# r.mask -o input=water maskcats=1
 +
 +###############################################################################​
 +# Download Urban Morphological Zones Raster Data from EEA Raster 100m and 250m
 +# Urban morphological zones (UMZ) are defined by Corine land cover classes considered to contribute to the urban tissue and function
 +#     DATA: UMZ2000_f3v0_raster.zip (ZIP archive)
 +#     ​SIZE: ​ 32.63 MB 
 +# Web site http://​www.eea.europa.eu/​data-and-maps
 +mkdir ~/​tmpDWNLOAD
 +wget -O ~/​tmpDWNLOAD/​UMZ2000.zip "​http://​www.eea.europa.eu/​data-and-maps/​data/​urban-morphological-zones-2000-umz2000-f1v0-1/​zipped-tiff-files-100m-and-25/​zipped-tiff-files-100m-and-25/​at_download/​file"​
 +# unzip data
 +unzip ~/​tmpDWNLOAD/​UMZ2000.zip -d ~/​data10/​EEA/​UMZ/​UMZ2000/​UMZ2000_100m.tif
 +
 +
 +# Imprort Urban Morphological Zones in Grass
 +r.in.gdal input=/​home/​ste/​data10/​EEA/​UMZ/​UMZ2000/​UMZ2000_100m.tif output=UMZ_100m
 +# r.mapcalc UMZ_100m = UMZ_100m
 +
 +
 +###############################################################################​
 +# Download 100m resolution Forest Non Forest Map from Joint Research Centre
 +# see: http://​forest.jrc.ec.europa.eu/​forestmap-download
 +for tile in 21 22 23 31 32 33 41 42 43 44 45 51 52 53 54 55 61 62 72 ; do
 +wget -O ~/​tmpDWNLOAD/​ "​http://​geohub.jrc.ec.europa.eu/​forest/​forest-map/​2000/​tile$tile.zip"​
 +unzip ~/​tmpDWNLOAD/​tile$tile.zip  ​
 +done
 +
 +# merge tiles
 +gdalwarp ~/​tmpDWNLOAD/​tile* ​   ~/​tmpDWNLOAD/​FOR_2000_CM_FMAP_4500025000.tif
 +
 +# import forest non forest map into grass
 +r.in.gdal -o input=~/​tmpDWNLOAD/​FOR_2000_CM_FMAP_4500025000.tif output=FMAP2000 --overwrite
 +# r.mapcalc FMAP2000 = FMAP2000
 +rm ~/​tmpDWNLOAD/​tile*
 +rm ~/​tmpDWNLOAD/​FOR_2000_CM_FMAP_4500025000.tif
 +
 +
 +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
 +# Download Species suitability maps from Joint Research Centre
 +# See: http://​forest.jrc.ec.europa.eu/​climate-change
 +# http://​efdac.jrc.ec.europa.eu/​climate
 +for species in ; 134 51 46 125 do
 +wget -O ~/​tmpDWNLOAD/​ "​http://​geohub.jrc.ec.europa.eu/​forest/​climatechange/​suitability/​sp'​$specie'​_suit_all.tar.gz"​
 +unzip ~/​tmpDWNLOAD/​sp'​$specie'​_suit_all.tar.gz  ​
 +mv ~/​tmpDWNLOAD/​sp'​$specie'​* ​  ​~/​data10/​JRC_data/​suitability_maps/​
 +done
 +
 +for time in ENS_A2a_2020b ENS_A2a_2050b ENS_A2a_2080b PRESENT ; do
 +r.in.gdal -o input=/​home/​ste/​data10/​JRC_data/​suitability_maps/​$time/​map_C_134.tif output=$time"​_p_sylv"​ --overwrite
 +r.in.gdal -o input=/​home/​ste/​data10/​JRC_data/​suitability_maps/​$time/​map_C_51.tif output=$time"​_q_robur"​ --overwrite
 +r.in.gdal -o input=/​home/​ste/​data10/​JRC_data/​suitability_maps/​$time/​map_C_46.tif output=$time"​_q_ilex"​ --overwrite
 +r.in.gdal -o input=/​home/​ste/​data10/​JRC_data/​suitability_maps/​$time/​map_C_125.tif output=$time"​_p_halep"​ --overwrite
 +done
 +
 +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
 +# Set your region of interest
 +# g.region n=2465000 s=2393000 w=4108000 e=4168000 res=100 save=torino --o
 +g.region n=2915100 s=2858600 w=3726300 e=3789900 res=100 save=paris --o
 +g.region n=3233000 s=3177000 w=3587000 e=3651000 res=100 save=london --o
 +g.region n=2048000 s=2009000 w=3133000 e=3182000 res=100 save=madrid --o
 +g.region n=2109000 s=2073000 w=4508300 e=4554700 res=100 save=rome --o
 +g.region n=3292000 s=3247000 w=4525000 e=4582000 res=100 save=berlin --o
 +g.region n=3650000 s=3602000 w=4451000 e=4493000 res=100 save=copenhagen --o
 +g.region n=4237000 s=4195000 w=5119000 e=5160000 res=100 save=helsinki --o
 +g.region n=4078000 s=4025000 w=4751000 e=4820000 res=100 save=stockholm --o
 +g.region n=3112700 s=3073000 w=3904000 e=3949000 res=100 save=bruxelles --o
 +g.region n=3283000 s=3242000 w=3949900 e=3990000 res=100 save=amsterdam --o
 +g.region n=1977000 s=1926000 w=2636000 e=2693000 res=100 save=lisbon --o
 +g.region n=2825000 s=2788500 w=4770000 e=4817000 res=100 save=wien --o
 +g.region n=2780000 s=2727000 w=4978000 e=5030000 res=100 save=budapest --o
 +g.region n=3321700 s=3260600 w=5037000 e=5100000 res=100 save=warsaw --o
 +g.region n=1789000 s=1743000 w=5502000 e=5548000 res=100 save=athen --o
 +# g.region n=3019000 s=2991600 w=4621000 e=4658000 res=100 save=prague --o
 +
 +# create a list of UMZ vectors per city
 +list=`ls /​home/​ste/​ost4sem/​grassdbwv/​LAEA/​UFO/​windows/​`
 +for city in $list ; do
 +g.region region=$city
 +r.to.vect -sv  input=UMZ_100m output=UMZ$city feature=area --overwrite ​
 +done
 +
 +# compute the statistics of urban greening, peri urban greening, total area, percentage green in urban and in peri urban
 +rm sum.txt
 +rm PUsum.txt
 +list=`ls /​home/​ste/​ost4sem/​grassdbwv/​LAEA/​UFO/​windows/​`
 +for city in $list ; do
 +echo $city
 +r.mask -r
 +g.region region=$city
 +r.mapcalc clc$city=clc
 +r.mapcalc water = "if( clc == 40 ||  clc == 41 ||  clc == 42 || clc == 43 || clc == 44 || clc == 32 ||  clc == 34, 0 , 1)"
 +r.mask -o input=water maskcats=1
 +
 +r.mapcalc UMZ_$city = UMZ_100m
 +r.mapcalc FMAP_$city = FMAP2000
 +r.mapcalc UFOREST_$city = "if( UMZ_$city == 1, FMAP_$city , null())"​
 +r.stats -gn input=UFOREST_$city output=uforest_$city.txt
 +awk -v city=$city ​ '{ sum=sum+$3} END {print city , sum ,  NR , sum/NR }' ​ uforest_$city.txt >> sum.txt
 +
 +r.mapcalc PUFOREST_$city = "if( UMZ_$city == 0, FMAP_$city , null())"​
 +r.stats -gn input=PUFOREST_$city output=PUforest_$city.txt
 +awk -v city=$city ​ '{ sum=sum+$3} END {print city , sum ,  NR , sum/NR }' ​ PUforest_$city.txt >> PUsum.txt
 +done
 +# Add an index 
 +awk ' {  print NR , $0 }' sum.txt > sum_id.txt ​
 +awk ' {  print NR , $0 }' PUsum.txt > PUsum_id.txt ​
 +
 +# Add a header
 +awk 'BEGIN { print "ID city UF U_tot pc_UF"​} { print $0 }' sum_id.txt > sum_id_head.txt ​
 +awk 'BEGIN { print "ID city PUF PU_tot pc_PUF"​} { print $0 }' PUsum_id.txt > PUsum_id_head.txt ​
 +awk '​{gsub(/​ /,","​);​print}'​ PUsum_id_head.txt > ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​PUFstat.csv ​
 +awk '​{gsub(/​ /,","​);​print}'​ sum_id_head.txt > ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​UFstat.csv
 +rm *.txt
 +
 +R  --no-save ​ -q <     ​~/​work/​GlobalWarming_Intech/​mypaper/​scripts/​synt.R
 +
 +## PLOT city maps with urban and periurban greening
 +mkdir /​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO/​output_png_maps/​
 +mkdir ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett
 +echo 0 255:153:0 > ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_palet
 +echo 1 0:53:0 >> ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_palet
 +echo 10 153:51:0 >> ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_palet
 +echo 11 85:255:0 >> ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_palet
 +
 +r.mask -r
 +list=`ls /​home/​ste/​ost4sem/​grassdbwv/​LAEA/​UFO/​windows/​`
 +for city in $list ; do
 +g.region region=$city
 +r.mapcalc "​tmp_"​$city =  "​UFOREST_"​$city+10
 +r.null map=tmp_$city null=3
 +r.mapcalc "​U_PU_F_"​$city = "if( "​tmp_"​$city == 3, "​PUFOREST_"​$city , "​tmp_"​$city)"  ​
 +cat ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_palet | r.colors map="​U_PU_F_"​$city color=rules
 +g.region -p | grep "​rows"​ > tmp_height.txt
 +g.region -p | grep "​cols"​ > tmp_width.txt
 +export GRASS_WIDTH=`awk ' {print $2 } ' tmp_width.txt`
 +export GRASS_HEIGHT=`awk ' {print $2+130 } ' tmp_height.txt`
 +# export GRASS_PNGFILE=filename
 +export GRASS_BACKGROUNDCOLOR=000000
 +# export GRASS_TRANSPARENT=TRUE
 +d.mon start=png1  ​
 +d.rast "​U_PU_F_"​$city bg=173:​216:​230
 +# d.vect UMZ$city fcolor="​none"​ color=black
 +d.text -b -p text=$city size=7 color=white bgcolor=black ​ at=50,​40 ​
 +d.barscale ​  ​at=30,​94 bcolor=black tcolor=white --quiet ​
 +d.mon stop=png1
 + ​mv ​ map.png /​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO/​output_png_maps/​map_$city.png
 +done
 +
 +
 +
 +# #  Compute future trends of 4 species suitability in time
 +g.mapset mapset=UFO_Fut -c
 +mkdir /​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO/​output_fut_trend_table
 +outdirT=/​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO/​output_fut_trend_table/​
 +
 +list=`ls /​home/​ste/​ost4sem/​grassdbwv/​LAEA/​UFO/​windows/​`
 +for sp in p_sylv q_robur q_ilex p_halep ; do 
 +for time in ENS_A2a_2020b ENS_A2a_2050b ENS_A2a_2080b PRESENT ; do
 +for city in $list ; do
 +echo $city
 +echo $sp
 +echo $time
 +g.region region=$city@UFO
 +r.mask -r
 +r.mapcalc clc$city=clc@UFO
 +r.mapcalc water = "if( clc$city == 40 ||  clc$city == 41 ||  clc$city == 42 || clc$city == 43 || clc$city == 44 || clc$city == 32 ||  clc$city == 34, 0 , 1)"
 +r.mask -o input=water maskcats=1
 +r.mapcalc $sp"​_"​$city"​_"​$time = "if( $time"​_"​$sp@UFO == 2, 1 , 0)"  ​
 +r.stats -gn input=$sp"​_"​$city"​_"​$time output=$sp"​_"​$city"​_"​$time.txt
 +awk -v city=$city ​ '{ sum=sum+$3} END {print city , sum ,  NR , sum/NR }' ​ $sp"​_"​$city"​_"​$time.txt >> $outdirT"​sum_"​$sp"​_"​$time.txt
 +done
 +done
 +done
 +
 +
 +# # extract summary table of suitability trends
 +for sp in p_sylv q_robur q_ilex p_halep ; do 
 +for time in ENS_A2a_2020b ENS_A2a_2050b ENS_A2a_2080b PRESENT ; do
 +# Add an index 
 +awk ' {  print NR , $0 }' sum_$sp"​_"​$time.txt > sumID_$sp"​_"​$time.txt ​
 +# Add an header
 +awk -v sp=$sp 'BEGIN { print "ID city" , sp , "​tot_ha pc_sp"​} { print $0 }' sumID_$sp"​_"​$time.txt > sumIDH_$sp"​_"​$time.txt
 +# convert to csv
 +awk '​{gsub(/​ /,","​);​print}'​ sumIDH_$sp"​_"​$time.txt >  ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​stat_$sp"​_"​$time.csv ​
 +done
 +done
 +
 +
 +# difference maps between current and fut scenarios
 +g.mapset mapset=UFO_D -c
 +list=`ls /​home/​ste/​ost4sem/​grassdbwv/​LAEA/​UFO/​windows/​`
 +for city in $list ; do
 +for specie in p_sylv q_robur q_ilex p_halep ; do 
 +mkdir ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​diff_$specie
 +for scenario in ENS_A2a_2020b ENS_A2a_2050b ENS_A2a_2080b ; do
 +g.region region=$city@UFO
 +r.mask -r
 +r.mapcalc clc$city=clc@UFO
 +r.mapcalc water = "if( clc$city == 40 ||  clc$city == 41 ||  clc$city == 42 || clc$city == 43 || clc$city == 44 || clc$city == 32 ||  clc$city == 34, 0 , 1)"
 +r.mask -o input=water maskcats=1
 +r.mapcalc Amap = "if( $specie"​_"​$city"​_PRESENT"​@UFO_Fut == 1, 2 , 1)"
 +r.mapcalc Bmap = "if( $specie"​_"​$city"​_"​$scenario@UFO_Fut == 1, 2 , 1)"
 +r.mapcalculator amap=Amap bmap=Bmap formula=Amap*10+Bmap outfile=D_$scenario"​_"​$specie"​_"​$city --overwrite
 +r.stats -c D_$scenario"​_"​$specie"​_"​$city > ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​diff_$specie/​D_$scenario"​_"​$specie"​_"​$city
 +done
 +done
 +done
 +
 +
 +# [1] class 11 : No suitable
 +# [2] class 12 : Gain of suitability
 +# [3] class 21 : Loss of suitability
 +# [4] class 22 : Stable suitability
 +# [5] *        : No data
 +
 +
 +
 +## PLOT difference ​ maps current / future with urban and periurban greening
 +echo 11 127:127:127 > ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_D_palet
 +echo 12 0:255:0 >> ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_D_palet
 +echo 21 255:0:0 >> ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_D_palet
 +echo 22 0:0:255 >> ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_D_palet
 +mkdir /​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO/​output_Dmaps
 +r.mask -r
 +
 +list=`ls /​home/​ste/​ost4sem/​grassdbwv/​LAEA/​UFO/​windows/​`
 +for city in $list ; do
 +for sp in p_sylv q_robur q_ilex p_halep ; do 
 +for scenario in  2020 2050 2080 ; do
 +# ENS_A2a_2020b ENS_A2a_2050b ENS_A2a_2080b ​
 +g.region region=$city@UFO
 +cat ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_D_palet | r.colors map=D_ENS_A2a_$scenario"​b_"​$sp"​_"​$city@UFO_D color=rules
 +g.region -p | grep "​rows"​ > tmp_height.txt
 +g.region -p | grep "​cols"​ > tmp_width.txt
 +export GRASS_WIDTH=`awk ' {print $2 } ' tmp_width.txt`
 +export GRASS_HEIGHT=`awk ' {print $2+130 } ' tmp_height.txt`
 +export GRASS_BACKGROUNDCOLOR=000000
 +d.mon start=png1  ​
 +d.rast D_ENS_A2a_$scenario"​b_"​$sp"​_"​$city@UFO_D bg=173:​216:​230
 +d.vect UMZ$city@UFO fcolor="​none"​ color=black
 +d.text -b -p text=$city"​ 2000 - "​$scenario size=6 color=white bgcolor=black ​ at=10,​40 ​
 +d.barscale ​  ​at=30,​94 bcolor=black tcolor=white --quiet ​
 +d.mon stop=png1
 + ​mv ​ map.png /​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO/​output_Dmaps/​Dmap_$city"​_"​$sp"​_"​$scenario.png
 +done
 +done
 +done
 +
 +
 +
 +
 +
 +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
 +# # Create a legend for Urban Peri urban greening distribution
 +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
 +r.mask -r
 +city=bruxelles
 +g.region region=$city
 +cat ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_palet | r.colors map="​U_PU_F_"​$city color=rules
 +export GRASS_HEIGHT=400
 +export GRASS_WIDTH=550
 +export GRASS_BACKGROUNDCOLOR=FFFFFF
 +# export GRASS_TRANSPARENT=TRUE
 +d.mon start=png1  ​
 +d.legend ​ -c map=U_PU_F_bruxelles use=0,​1,​10,​11
 +d.text -b -p text="​Peri urban" size=9 color=black at=90,120
 +d.text -b -p text="​Peri urban greening"​ size=9 color=black at=90,180
 +d.text -b -p text="​Urban"​ size=9 color=black at=90,240
 +d.text -b -p text="​Urban greening"​ size=9 color=black at=90,300
 +d.mon stop=png1
 + ​mv ​ map.png /​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO/​output_png_maps/​legend.png
 +
 +# Black background
 +r.mask -r
 +city=bruxelles
 +g.region region=$city
 +cat ~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​palett/​4cl_palet | r.colors map="​U_PU_F_"​$city color=rules
 +export GRASS_HEIGHT=400
 +export GRASS_WIDTH=550
 +export GRASS_BACKGROUNDCOLOR=000000
 +# export GRASS_TRANSPARENT=TRUE
 +d.mon start=png1  ​
 +d.legend ​ -c map=U_PU_F_bruxelles use=0,​1,​10,​11
 +d.text -b -p text="​Peri urban" size=9 color=white at=90,120
 +d.text -b -p text="​Peri urban greening"​ size=9 color=white at=90,180
 +d.text -b -p text="​Urban"​ size=9 color=white at=90,240
 +d.text -b -p text="​Urban greening"​ size=9 color=white at=90,300
 +d.mon stop=png1
 + ​mv ​ map.png /​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO/​output_png_maps/​legend_black.png
 +
 +
 +# # # # # # # # # # # # # # # # # # # # # 
 +# # Create a legend for Difference maps
 +# # # # # # # # # # # # # # # # # # # # # 
 +# Holm oak legend
 +export GRASS_HEIGHT=400
 +export GRASS_WIDTH=550
 +export GRASS_BACKGROUNDCOLOR=FFFFFF
 +d.mon start=png1  ​
 +d.legend ​ -c map=D_ENS_A2a_2020b_q_ilex_paris@UFO_D use=11,​12,​21,​22
 +d.text -b -p text="​Holm Oak suitability"​ size=10 color=black at=20,60
 +d.text -b -p text="​Never suitable"​ size=9 color=black at=90,120
 +d.text -b -p text="​Gain of suitability"​ size=9 color=black at=90,180
 +d.text -b -p text="​Vulnerable"​ size=9 color=black at=90,240
 +d.text -b -p text="​Stable suitability"​ size=9 color=black at=90,300
 +d.mon stop=png1
 + ​mv ​ map.png /​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO/​output_png_maps/​legend_Holm_oak_Diff.png
 +d.rast D_ENS_A2a_$scenario"​b_"​$sp"​_"​$city@UFO_D bg=173:​216:​230
 +
 +export GRASS_HEIGHT=400
 +export GRASS_WIDTH=650
 +export GRASS_BACKGROUNDCOLOR=FFFFFF
 +d.mon start=png1  ​
 +d.legend ​ -c map=D_ENS_A2a_2020b_q_ilex_paris@UFO_D use=11,​12,​21,​22
 +d.text -b -p text="​Scots Pine suitability"​ size=10 color=black at=20,60
 +d.text -b -p text="​Never suitable"​ size=9 color=black at=90,120
 +d.text -b -p text="​Gain of suitability"​ size=9 color=black at=90,180
 +d.text -b -p text="​Vulnerable"​ size=9 color=black at=90,240
 +d.text -b -p text="​Stable suitability"​ size=9 color=black at=90,300
 +d.mon stop=png1
 + ​mv ​ map.png /​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO/​output_png_maps/​legend_Scotts_pine_Diff.png
 +
 +## DONE
 +</​code>​
 +
 +**Below the related R script**
 +
 +<code R>
 +UF = read.table(file="​~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​UFstat.csv",​ header=TRUE,​ sep=","​)
 +PUF = read.table(file="​~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​PUFstat.csv",​ header=TRUE,​ sep=","​)
 +UPUF = PUF
 +UPUF$UF = UF$UF
 +UPUF$U_tot = UF$U_tot
 +UPUF$pc_UF = UF$pc_UF
 +UPUF$tot_Area = UPUF$U_tot+UPUF$PU_tot+UPUF$PUF+UPUF$PU_tot
 +UPUF$tot_FArea = UPUF$PUF+UPUF$UF
 +UPUF$tot_pc_green = UPUF$tot_Area/​UPUF$tot_FArea
 +
 +col=rainbow(15)
 +# col =terrain.colors(15,​ alpha = 1)
 +# col=topo.colors(n,​ alpha = 1)
 +#  col=heat.colors(15,​ alpha = 1)
 +png("​~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​UPUF_stat.png",​ width = 800, height = 800)
 +par(mar=c(5,​5,​1,​1))
 +plot(UPUF$pc_UF,​UPUF$pc_PUF, ​ axes=FALSE, xlab="​% Forest in Urban Areas" , ylab="​% Forest in Peri Urban Areas",​ cex.lab=2)
 +
 +axis(side = 1, at=c(0,​.1,​.2,​.3,​.4,​.5,​.6,​.7) , labels=c(0,​10,​20,​30,​40,​50,​60,​70),​ cex.axis=2)
 +axis(side = 2, at = c(0,​.1,​.2,​.3,​.4,​.5,​.6,​.7,​.8) , labels = c(0,​10,​20,​30,​40,​50,​60,​70,​80),​cex.axis=2)
 +# ,​xlabel=c(0,​10,​20,​30,​40,​50),​ ylabel=c(0,​10,​20,​30,​40,​50,​60,​70) )
 +
 +symbols(UPUF$pc_UF,​UPUF$pc_PUF,​circles=UPUF$tot_Area/​30000000,​ inches=FALSE, ​ bg = col , fg=col, add=TRUE)
 +text(UPUF$pc_U,​ UPUF$pc_PUF,​ labels =UPUF$city, cex=1.7)
 +box()
 +dev.off()
 +
 +# # # 
 +
 +UF = read.table(file="​~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​UFstat.csv",​ header=TRUE,​ sep=","​)
 +PUF = read.table(file="​~/​work/​GlobalWarming_Intech/​mypaper/​UFO/​PUFstat.csv",​ header=TRUE,​ sep=","​)
 +
 +syntM= matrix(NA,​15,​6)
 +rownames(syntM)=UPUF$city
 +colnames(syntM)=c("​Total ha","​Urban ha","​Periurban ha","​% G","​% UG","​% UPUG")
 +syntM[,​1]=UPUF$tot_Area
 +syntM[,​2]=UPUF$U_tot
 +syntM[,​3]=UPUF$PU_tot
 +syntM[,​4]=UPUF$tot_pc_green
 +syntM[,​5]=UPUF$pc_UF*100
 +syntM[,​6]=UPUF$pc_PUF*100
 +
 +library(xtable)
 +# export.kval = xtable(kval,​ align=c("​l","​l","​l","​l","​l"​))
 +# digits(export.kval)[c(1,​2,​3,​4,​5)]=c(0,​0,​0,​3,​3)
 +# print(export.kval,​ type="​latex",​ file=paste("/​space/​casalst/​REPORT/​tablesReport/​TEX_R_table/​R_kappa_table/​R_kappa_sp_",​i,"​.tex",​sep=""​),​ append=FALSE,​ floating=FALSE,​ table.placement = "​ht",​ caption.placement="​bottom", ​ latex.environments=c("​center"​))
 +
 +export.syntM = xtable(syntM,​ align=c("​l","​l","​l","​l","​l","​l","​l"​))
 +digits(export.syntM)[c(1,​2,​3,​4,​5,​6,​7)]=c(0,​0,​0,​0,​3,​3,​3)
 +print(export.syntM,​ type="​latex",​ file="/​home/​ste/​work/​GlobalWarming_Intech/​mypaper/​UFO/​output_table_R/​table1.tex",​ append=FALSE,​ floating=FALSE,​ table.placement = "​ht",​ caption.placement="​bottom", ​ latex.environments=c("​center"​))
 +</​code>​
 +
 +<note tip>​g.region can be set to 500 for a generalization of statistics in future applications</​note>​
wiki/urbanmod.txt ยท Last modified: 2017/12/05 22:53 (external edit)