** 	THIS FILE ANALYSES THE LAND USE

** 	CHANGE THE DIRECTORY
	cd $DIR

** 	OPEN SOLUTION.DTA
	use FER1_Solution, clear

 	drop if period==1
*************************************************************************************


** 	GROUP THE CROPS

**	RICE AREA
	egen c_irice = rowtotal(grow_irice_*)
	egen c_rfrice = rowtotal(grow_rfrice_*)
	egen c_sprice = rowtotal(grow_sprice_*)

**	RAINFED CROPS
	egen c_rfmaize = rowtotal(grow_rfmaize)
	egen c_millet = rowtotal( grow_cp_mil_1 grow_cp_mil_2 grow_cp_mil_gc_1 grow_cp_mil_gc_2 grow_cp_gc_mil_1 grow_cp_gc_mil_2 grow_millet_wocash) /*Millet and guinea corn*/
	egen c_mil_bean = rowtotal(grow_b_mb_* grow_cp_mil_b_* grow_cp_gmil_b_* grow_cp_gmil2_b_* grow_b_mb_wocash)
	egen c_gnut_bean = rowtotal(grow_b_gb grow_b_gb_m grow_b_gb_fm grow_cp_gnut_b grow_cp_gnut_b_m grow_cp_gnut_b_fm grow_cp_gnut_bb)
	egen c_groundnut = rowtotal(grow_b_gnut_* grow_cp_gnut) /*Groundnut sole crop*/

**	IRRIGATED CROP AREA
	egen c_tomato = rowtotal(grow_tom_*)
	egen c_onion = rowtotal(grow_onion_*)
	egen c_irmaize = rowtotal(grow_feb_irrimaize_* grow_mar_irrimaize_* grow_aprl_irrimaize_*)

*******************************************************************************************************
** 	BUSH AND COMPOUND FARM CROP AREA
**	egen c_bush = rowtotal(grow_b_mb_* grow_b_gnut_m grow_b_gnut_fm grow_b_gb grow_b_gb_m grow_b_gb_fm)
**	egen c_cp = rowtotal(grow_cp_mil_* grow_cp_mil_gc_* grow_cp_gc_mil_* grow_cp_mil_b_* grow_cp_gmil_b_* grow_cp_gmil2_b_* grow_cp_gnut grow_cp_gnut_b grow_cp_gnut_b_m grow_cp_gnut_b_fm)

*********************************************************************************************************************

**	PERCENTAGE OF TOTAL CROP AREA 

*************************************************************************************
**	TOTAL AREA UNDER CROPS
	egen carea = rowtotal(c_irice c_rfrice c_sprice c_rfmaize c_millet c_mil_bean c_gnut_bean c_groundnut c_tomato c_onion c_irmaize)
	
	egen ircarea = rowtotal(c_irice  c_sprice c_tomato c_onion c_irmaize)
	


	g pa_irrice = (c_irice +  c_sprice)/ircarea *100
	
	g pa_tomato=c_tomato/ircarea*100
	g pa_onion=c_onion/ircarea*100
	g pa_irmaize =c_irmaize/ircarea*100


**	COLLAPSE BY PERIOD

	collapse (mean) pa_* (sum) c_*, by( run period) fast

	graph bar  pa_irrice  pa_tomato pa_onion pa_irmaize, over(period, gap(*0.5)) stack nofill ylabel(#5,angle(horizontal))  title("Percentage to total irrigated crop area, in %") legend(col(4) label(1 "Rice") label(2 "Tomato") label(3 "onion") label(4 "Irrigated-Maize")  size(medium) width(200) nobox) plotregion(margin(zero) lc(black)) graphregion(margin(b+0 l+3) fc(white)) ysize(8) xsize(12) 	

	graph export "D:\MPMAS\Ghana_casestudy\TONO_10\Stata\results\Pecentage to total Irrigated crop area_DMIG.tif", as(tif) replace
*********************************************************************************************



** TABLES

	table period, c(sum c_irice sum c_rfrice sum c_sprice sum c_rfmaize sum c_mil_bean ) format(%9.2f)


	graph bar  c_irice  c_sprice  c_tomato c_onion c_irmaize, over(period, gap(*0.5)) stack nofill ylabel(#5,angle(horizontal))  title("Land use per period, total in ha") legend(col(4) label(1 "Irri rice")  label(2 "Spl rice")   label(3 "Tomato") label(4 "onion") label(5 "Irrigated-Maize") size(medium) width(200) nobox) plotregion(margin(zero) lc(black)) graphregion(margin(b+0 l+3) fc(white)) ysize(8) xsize(12) 		
	graph export "D:\MPMAS\Ghana_casestudy\TONO_10\Stata\results\Landuse_Irrigated_crops_DMIG.tif", as(tif) replace

*********************************************************************************************


