-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
1609 lines (1464 loc) · 80.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin="" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.6/nv.d3.css" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css"
integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
<style>
.nvtooltip {
margin-top: -50px;
}
#title {
padding-top: 20px;
}
.cropping_pie svg {
height: 300px;
width: 100%;
}
.crop_c_Breeding {
background-color: #8ebf3f;
cursor: pointer;
}
.crop_c_Growing {
background-color: #cad32b;
cursor: pointer;
}
.crop_c_Harvesting {
background-color: #f5d226;
cursor: pointer;
}
.crop_c_Planting {
background-color: #f68b33;
cursor: pointer;
}
.climatology_plot {
height: 500px;
width: 100%;
}
.indicator_plot {
height: 500px;
width: 100%;
}
.indicator_map {
height: 500px;
width: 100%;
}
#map_scale {
width: 100px;
height: 50px;
}
.legend {
line-height: 18px;
color: #555;
}
.info {
padding: 6px 8px;
background: white;
background: rgba(255, 255, 255, 0.8);
box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
border-radius: 5px;
}
.info h4 {
margin: 0 0 5px;
color: #777;
}
.cell_green {
background-color: #eaf1dd;
}
.cell_yellow {
background-color: #fdfed0;
}
.cell_orange {
background-color: #fde9d9;
}
.cell_red {
background-color: #ffb3b3;
}
.practices_img_icons {
height: 60px;
width: 60px;
}
.practices_item {
background-color: #cccccc;
padding: 12px 12px 12px;
}
.practices_border {
border-width: 1px;
border-style: solid;
border-color: #ffffff;
}
.practices_table {
border: 1px solid #ffffff;
}
.borderless td,
.borderless th {
border: none;
}
table.table-bordered {
border: 1px solid #ffffff;
margin-top: 20px;
}
table.table-bordered>thead>tr>th {
border: 1px solid #ffffff;
}
table.table-bordered>tbody>tr>td {
border: 1px solid #ffffff;
}
.practices_id {
font-size: 70px;
color: #e8e8e8;
font-weight: 900;
}
</style>
<title>Pakistan</title>
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="#">Pakistan</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse"
aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#" onclick="click_tab('intro')">
<i class="fas fa-book"></i>
Intro
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" onclick="click_tab('site')">
<i class="fas fa-globe-asia"></i>
Site selection
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" onclick="click_tab('cropping')">
<i class="fab fa-envira"></i>
Cropping system
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" onclick="click_tab('climate')">
<i class="fas fa-cloud-sun-rain"></i>
Climate
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" onclick="click_tab('risk')">
<i class="fas fa-biohazard"></i>
Climate risk
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" onclick="click_tab('impacts')">
<i class="fas fa-bolt"></i>
Climate impacts
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" onclick="click_tab('practices')">
<i class="fas fa-child"></i>
Practices
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" onclick="click_tab('enablers')">
<i class="fas fa-code-branch"></i>
Enablers
</a>
</li>
</ul>
<form class="d-flex">
<h2 class="navbar-brand">Location: <strong><span id="txt_site_selected"></span></strong></h2>
</form>
</div>
</nav>
</header>
<main role="main" class="flex-shrink-0">
<div class="container">
<!-- Start Intro -->
<div id="intro" style="margin-top: 70px;" class="tab_layout">
<div class="row">
<div class="row row-cols-1 row-cols-sm-2 g-2">
<div class="col">
<div class="card shadow-sm">
<img src="https://ciat-dapa.github.io/pakistan_web/img/logos/l_fao.png" width="100%"
height="225px" role="img" class="img-fluid" alt="FAO" />
</div>
</div>
<div class="col">
<div class="card shadow-sm">
<img src="https://ciat-dapa.github.io/pakistan_web/img/logos/l_alliance.png" width="100%"
height="225px" role="img" class="img-fluid"
alt="Alliance Bioversity International - CIAT" />
</div>
</div>
</div>
</div>
<h2>About the project</h2>
<p class="text-justify">
The data presented in this dashboard is the output of a series of workshops and online consultations
conducted as part of a Food and Agriculture Organisation of the United Nations (FAO) led, and
Alliance of Bioversity International & CIAT designed project on Climate-Smart Agriculture in
Pakistan.
The project developed a series of District Climate Risk Profiles (DCRP's) and Climate Smart Village
(CSV) plans,
covering 13 districts and 43 villages from across Punjab, Sindh, and Khyber Pakhtunkhwa. The
implementation
of the project was supported by national partners in each of the three provinces, namely the Pir
Mehar Ali Shah (PMAS)
Arid Agriculture University Rawalpindi; the University of Agriculture Peshawar; and the Directorate
Training and
Research for Agriculture Engineering and Water management Sindh.
</p>
<p class="text-justify">
This dashboard acts as a centralised data store and visualisation tool for decision makers,
researchers
and agricultural practitioners to quickly access and review information gathered through this study,
based on consultations with over 1,000 agricultural experts and farmers from across the three
provinces.
We see this as an important tool in helping decision makers get a quick snap shot of the major
hazards,
their impacts, and recommended response strategies, supporting future policy and programming around
CSA
in Pakistan.
</p>
<p class="text-justify">
The authors of this study are extremely grateful for the contribution of all of those who took part
in the
study and helped to shed light on the importance of CSA in supporting Pakistan's agriculture sector.
</p>
<h3>How to use the dashboard</h3>
<p class="text-justify">
<b>Site selection</b> - The first step in navigating through the dashboard is to select the region
you would like to look at.
This will allow you to either look at Pakistan as a whole, each of the three provinces or a single
district.
It is worth noting that depending on the type of information you are looking for some will be
available
aggregated at national or provincial levels, others will be available only at district or village
level.
</p>
<p class="text-justify">
<b>Cropping systems</b> - This tab displays district level data on production area and volume for
the major crops,
along with the livestock headcount. It also shows the cropping calendar and hazard calendar for the
villages
from that district covered in the study.
</p>
<p class="text-justify">
<b>Climate</b> - The climate tab presents the results of a number of modelling exercises conducted
by the
Alliance of Bioversity International and CIAT's modelling team. This includes climatology data on
monthly mean
precipitation, minimum and maximum temperatures, modelling of future annual mean temperatures and
precipitation
using an ensemble of Global Circulation Models (GCM's), and the historic and future time series of a
number of
climatic indicators that impact agricultural production.
</p>
<p class="text-justify">
<b>Climate risk</b> - This tab presents a risk matrix generated through responses from agricultural
experts
in the districts on the frequency and severity of major hazards.
</p>
<p class="text-justify">
<b>Climate Impacts</b> - This tab presents the results of the climate impact analysis where value
chain experts
in each of the districts identified the impacts of certain hazards on key commodity value chains for
the district.
</p>
<p class="text-justify">
<b>Practices</b> - Presents the types of CSA practices prioritised by experts in the district, along
with the
areas were they have an impact, the hazards they address, and the barriers to adoption.
</p>
<p class="text-justify">
<b>Enablers</b> - CSA enablers provide essential services and build core capacities, empowering
individuals
and agrarian communities to better manage their response to climate related pressures. This section
looks at which types of enabler are prioritised in each of the districts.
</p>
</div>
<!-- End Intro-->
<!-- Start General -->
<div id="general">
<h1 id="title" class="mt-5 text-center"></h1>
<p id="description" class="text-justify"></p>
</div>
<!-- End General -->
<!-- Start Site -->
<div id="site" class="tab_layout">
<div id="map" style="height: 500px; width: 100%;"></div>
</div>
<!-- End Site -->
<!-- Start Cropping -->
<div id="cropping" class="tab_layout">
<div
class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h2 id="cropping_title"></h2>
</div>
<h3>Production</h3>
<div class="row">
<div class="col-md-4">
<div class="card mb-4 shadow-sm">
<h4 class="text-center">Planted area</h4>
<div id="cropping_planted_plot" class="cropping_pie">
<svg></svg>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card mb-4 shadow-sm">
<h4 class="text-center">Production</h4>
<div id="cropping_production_plot" class="cropping_pie">
<svg></svg>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card mb-4 shadow-sm">
<h4 class="text-center">Livestock</h4>
<div id="cropping_livestock_plot" class="cropping_pie">
<svg></svg>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div
class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3">
<h3>Village</h3>
<div class="btn-toolbar mb-2 mb-md-0">
<div class="btn-group mr-2">
<select id="cbo_village" class="form-control form-control-lg">
</select>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h3>Cropping calendar</h3>
<table class="table table-sm">
<tr>
<td class="crop_c_Breeding"> </td>
<td class="">Breeding</td>
<td class="crop_c_Growing"> </td>
<td class="">Growing</td>
<td class="crop_c_Harvesting"> </td>
<td class="">Harvesting</td>
<td class="crop_c_Planting"> </td>
<td class="">Planting</td>
</tr>
</table>
<table id="cropping_calendar_table" class="table table-bordered table-sm">
<thead>
<tr>
<th>Crop / Livestock</th>
<th>Jan</th>
<th>Feb</th>
<th>Mar</th>
<th>Apr</th>
<th>May</th>
<th>Jun</th>
<th>Jul</th>
<th>Aug</th>
<th>Sep</th>
<th>Oct</th>
<th>Nov</th>
<th>Dec</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h3>Hazard calendar</h3>
<table id="cropping_hazard_table" class="table table-striped table-sm">
<thead>
<tr>
<th>Hazard</th>
<th>Jan</th>
<th>Feb</th>
<th>Mar</th>
<th>Apr</th>
<th>May</th>
<th>Jun</th>
<th>Jul</th>
<th>Aug</th>
<th>Sep</th>
<th>Oct</th>
<th>Nov</th>
<th>Dec</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<!-- End Cropping -->
<!-- Start Climate -->
<div id="climate" class="tab_layout">
<nav class="nav nav-tabs nav-justified" role="tablist" id="climate_tab">
<a class="nav-item nav-link active" id="cli_climatology_tab" data-toggle="tab"
href="#cli_climatology_content" role="tab" aria-controls="cli_climatology_content"
aria-selected="true">Climatology</a>
<a class="nav-item nav-link" id="cli_gcm_tab" data-toggle="tab" href="#cli_gcm_content" role="tab"
aria-controls="cli_gcm_content" aria-selected="false">GCM</a>
<a class="nav-item nav-link" id="cli_indicators_tab" data-toggle="tab"
href="#cli_indicators_content" role="tab" aria-controls="cli_indicators_content"
aria-selected="false">Indicators</a>
</nav>
<div class="tab-content" id="climate_content">
<div class="tab-pane fade show active" id="cli_climatology_content" role="tabpanel"
aria-labelledby="cli_climatology_tab">
<p class="text-justity">
For the figure below historical data is used to measure monthly mean precipitation and
maximum and minimum temperatures in the district.
</p>
<div class="row">
<div class="col-lg-6">
<div id="climate_prec_plot" class="climatology_plot">
<svg></svg>
</div>
</div>
<div class="col-lg-6">
<div id="climate_temp_plot" class="climatology_plot">
<svg></svg>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="cli_gcm_content" role="tabpanel" aria-labelledby="cli_gcm_tab">
<p class="text-justity">
Future climate data in the form of projected annual mean temperatures and precipitation was
modelled using the CMIP5 model ensemble.
</p>
<div class="row">
<div class="col-lg-6">
<div id="gcm_prec_plot" class="climatology_plot">
<svg></svg>
</div>
</div>
<div class="col-lg-6">
<div id="gcm_temp_plot" class="climatology_plot">
<svg></svg>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="cli_indicators_content" role="tabpanel"
aria-labelledby="cli_indicators_tab">
<p class="text-justity">
Given the sensitivity of crops to adverse climatic conditions modelling of future climatic
conditions needs to be more targeted to the growth requirements of crops, going beyond
yearly averages for temperatures and precipitation. To achieve this modelling was conducted
that focused on a set of indicators critical for plant and animal health. The indicators
used are described in the below table, with the analysis conducted for each of the Rabi and
Kharif seasons:
</p>
<table id="cli_indicators_list" class="table table-sm">
<tr>
<th>Acronym</th>
<th>Description</th>
<th>Hazard</th>
</tr>
<tr>
<td>CDD</td>
<td>Drought spell. Maximum number of consecutive dry days (precipitation < 1 mm
day-1).</td>
<td>Drought: there is a long drought spell during the growing season which reduces
productivity or causes crop failure.</td>
</tr>
<tr>
<td>NDWS</td>
<td>Moisture stress. Number of days with ratio of actual to potential evapotranspiration
ratio below 0.5.</td>
<td>Drought: crops experience wilting due to constantly low soil moisture levels during
the growing season.</td>
</tr>
<tr>
<td>IRR</td>
<td>Irrigation water requirement. Total amount of required irrigation water to satisfy
crop demand</td>
<td>Water scarcity: greater water requirements puts greater pressure on aquifers and
rivers.</td>
</tr>
<tr>
<td>P5D</td>
<td>Flooding. Maximum 5-day running average precipitation.</td>
<td>Flooding: too much rainfall during a week causes flooding, which causes crops to
wilt</td>
</tr>
<tr>
<td>NT35</td>
<td>Heat stress. Number of days with temperature above 35ºC.</td>
<td>Heat stress: many hot days during the growing period slow crop growth, hinder grain
filling and can lead to low productivity.</td>
</tr>
<tr>
<td>P95</td>
<td>95th percentile of daily precipitation. Sows the level of precipitation recorded for
extreme events</td>
<td>Flooding: Peak rainfall events increasing in intensity may result in flash flooding
</td>
</tr>
</table>
<div
class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3">
<h3>Indicators</h3>
<div class="btn-toolbar mb-2 mb-md-0">
<div class="btn-group mr-2">
<select id="cbo_climate_indicator" class="form-control form-control-lg">
</select>
<select id="cbo_climate_season" class="form-control form-control-lg">
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div id="climate_indicator_plot" class="indicator_plot">
<svg></svg>
</div>
</div>
<div class="col-lg-6">
<div id="climate_indicator_map" class="indicator_map">
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Climate -->
<!-- Start CC Impacts -->
<div id="impacts" class="tab_layout">
<div
class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<div class="btn-toolbar mb-2 mb-md-0">
<div class="btn-group mr-2">
<select id="cbo_impact_crop" class="form-control form-control-lg">
</select>
<select id="cbo_impact_hazard" class="form-control form-control-lg">
</select>
<!-- <button type="button" class="btn btn-sm btn-outline-secondary">Share</button>
<button type="button" class="btn btn-sm btn-outline-secondary">Export</button>
-->
</div>
</div>
</div>
<div class="row">
<div id="impacts_severity" class="col-md-12">
</div>
</div>
<div class="table-responsive">
<table id="impacts_table" class="table table-striped table-sm">
<thead>
<tr>
<th>1. Input</th>
<th>2. On-farm</th>
<th>3. Harvesting, storage & processing</th>
<th>4. Marketing</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<!-- End CC Impacts -->
<!-- Start Risk -->
<div id="risk" class="tab_layout">
<div class="table-responsive">
<table id="risk_table" class="table table-sm">
<tr>
<th>Severity / Frequency</th>
<th>Minor severity (<10% losses)</th>
<th>Moderate severity (10-30% losses)</th>
<th>Major severity (30-50% losses)</th>
<th>Severe severity (>50% losses)</th>
</tr>
<tr>
<th>Every 10 years</th>
<th id="r1-1" class="cell_green"></th>
<th id="r1-2" class="cell_green"></th>
<th id="r1-3" class="cell_yellow"></th>
<th id="r1-4" class="cell_orange"></th>
</tr>
<tr>
<th>Every 5 years</th>
<th id="r2-1" class="cell_green"></th>
<th id="r2-2" class="cell_yellow"></th>
<th id="r2-3" class="cell_yellow"></th>
<th id="r2-4" class="cell_orange"></th>
</tr>
<tr>
<th>Every second year</th>
<th id="r3-1" class="cell_yellow"></th>
<th id="r3-2" class="cell_yellow"></th>
<th id="r3-3" class="cell_orange"></th>
<th id="r3-4" class="cell_red"></th>
</tr>
<tr>
<th>Every year</th>
<th id="r4-1" class="cell_orange"></th>
<th id="r4-2" class="cell_orange"></th>
<th id="r4-3" class="cell_red"></th>
<th id="r4-4" class="cell_red"></th>
</tr>
</table>
</div>
</div>
<!-- End Risk -->
<!-- Start Practices -->
<div id="practices" class="tab_layout">
<div
class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<div class="btn-toolbar mb-2 mb-md-0">
<div class="btn-group mr-2">
<select id="cbo_practices_crop" class="form-control form-control-lg">
</select>
<select id="cbo_practices_hazard" class="form-control form-control-lg">
</select>
<!-- <button type="button" class="btn btn-sm btn-outline-secondary">Share</button>
<button type="button" class="btn btn-sm btn-outline-secondary">Export</button>
-->
</div>
</div>
</div>
<div class="table-responsive">
<div id="practices_table">
</div>
</div>
</div>
<!-- End Practices -->
<!-- Start Enablers -->
<div id="enablers" class="tab_layout">
<div
class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<div class="btn-toolbar mb-12 mb-md-0">
<div class="btn-group mr-2">
<label class="form-inline">
Select level of aggregation:
<select id="cbo_enablers_agg" class="form-control form-control-lg" onchange="enablers_load()">
<option value="dist">Districts</option>
<option value="prov">Province</option>
<option value="nati">National</option>
</select>
</label>
</div>
</div>
</div>
<div class="table-responsive">
<table id="enablers_table" class="table table-sm">
<tbody></tbody>
</table>
</div>
</div>
<!-- End Enablers -->
</div>
</main>
<footer class="text-muted">
<div class="container">
<p>© 2020 Alliance Bioversity International - CIAT</p>
</div>
</footer>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js"
integrity="sha384-+YQ4JLhjyBLPDQt//I+STsc9iw4uQqACwlvpslubQzn4u2UU2UFM80nGisd026JF"
crossorigin="anonymous"></script>
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"
integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="
crossorigin=""></script>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.6/nv.d3.min.js"></script>
<script src="https://d3js.org/d3-color.v2.min.js"></script>
<script src="https://d3js.org/d3-interpolate.v2.min.js"></script>
<script src="https://d3js.org/d3-scale-chromatic.v2.min.js"></script>
<script type="text/javascript">
// Global function
jQuery(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
});
$('#climate_tab a').on('click', function (e) {
e.preventDefault();
$(this).tab('show');
});
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
climate_load();
})
// Parameters
var tab = 'intro';
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var color_indicator;
var province = "";
var district = "";
var coords;
var type_agg="";
// Datasets
var hazard_d = [];
var practices_d = [];
var climate_indicator_d = [];
var climate_indicator_province = '';
var climate_indicator_district = '';
var climate_indicator_var = '';
var climate_indicator_coords = [];
var crop_c_full = [];
var hazard_c_full = [];
var tab = '';
// Controls
var map_i;
var map;
/**
* This function change the type of information and functionalities of the web page depending of the value
*/
function click_tab(tab_selected) {
tab = tab_selected;
$(".tab_layout").addClass("d-none");
$("#general").removeClass("d-none");
if (tab === 'intro') {
$("#title").html("Intro");
$("#description").html("");
$(".tab_layout").addClass("d-none");
$("#general").addClass("d-none");
$("#intro").removeClass("d-none");
}
else if (tab === 'site') {
$("#title").html("Site selection");
$("#description").html("Please use the below map to select the region (National, Province, District) you would like to focus on. You can also see in the project site tab a list of all districts and villages included in the study.");
$("#site").removeClass("d-none");
}
else if (tab === 'cropping') {
$("#title").html("Cropping system");
$("#description").html("In this tab you will find cropping and livestock data for each of the districts included in the study, based on the most recent provincial crop reporting data. Then for each of the villages in the province for which a CSV plan was prepared, you will find the cropping and hazard calendar constructed through village level consultations.");
$("#cropping").removeClass("d-none");
d3.csv("https://raw.githubusercontent.com/CIAT-DAPA/pakistan_web/master/data/cropping/production.csv", function (error, data) {
var c_production = data.filter(function (item) { return item.district == district; });
d3.csv("https://raw.githubusercontent.com/CIAT-DAPA/pakistan_web/master/data/cropping/cropping_calendar.csv", function (error, data2) {
crop_c_full = data2.filter(function (item) { return item.district == district; });
d3.csv("https://raw.githubusercontent.com/CIAT-DAPA/pakistan_web/master/data/cropping/hazard.csv", function (error, data3) {
hazard_c_full = data3.filter(function (item) { return item.district == district; });
cropping_fill(c_production);
// Filling the cbo controls village
var village = d3.map(crop_c_full, function (d) { return d.village; }).keys();
var cbo_village = $("#cbo_village");
cbo_village.empty();
$.each(village, function () {
cbo_village.append($("<option />").val(this).text(this));
});
// Set the event change for both controls
cbo_village.on('change', function (e) {
var crop_c_f = crop_c_full.filter(function (item) { return item.village == cbo_village.val() });
var hazard_c_f = hazard_c_full.filter(function (item) { return item.village == cbo_village.val() });
cropping_calendar_hazard(crop_c_f, hazard_c_f);
});
var crop_c_f = crop_c_full.filter(function (item) { return item.village == cbo_village.val() });
var hazard_c_f = hazard_c_full.filter(function (item) { return item.village == cbo_village.val() });
cropping_calendar_hazard(crop_c_f, hazard_c_f);
});
});
});
}
else if (tab === 'climate') {
$("#title").html("Climate");
$("#description").html('This tab presents the results of a number of modelling exercises conducted by the Alliance of Bioversity International and CIATs modelling team. This includes climatology data on monthly mean precipitation, minimum and maximum temperatures, modelling of future annual mean temperatures and precipitation using an ensemble of Global Circulation Models (GCMs), and the historic and future time series of a number of climatic indicators that impact agricultural production. For a breakdown of the modelling process please see modelling support doc through <a href="https://drive.google.com/file/d/1fXpeykS-ipEzR9NCBw1GeIXGORNMopZo/view" target="_blank">this link</a>.');
$("#climate").removeClass("d-none");
climate_load();
}
else if (tab === 'impacts') {
$("#title").html("Climate impacts");
$("#description").html("This tab presents the results of the climate impact analysis where value chain experts in each of the districts identified the impacts of certain hazards on key commodity value chains for the district. The impacts are ordered with those that were selected the most frequently at the top. It is possible to further filter the impacts looking at specific hazards of commodity value chains.");
$("#impacts").removeClass("d-none");
d3.csv("https://raw.githubusercontent.com/CIAT-DAPA/pakistan_web/master/data/impacts/impacts.csv", function (error, data) {
hazard_d = data.filter(function (item) { return item.district == district; });
// Filling the cbo controls with hazard and crops
var crops_livestock = d3.map(hazard_d, function (d) { return d.crop_livestock; }).keys();
var cbo_impact_crop = $("#cbo_impact_crop");
cbo_impact_crop.empty();
$.each(crops_livestock, function () {
cbo_impact_crop.append($("<option />").val(this).text(this));
});
cbo_impact_crop.append($("<option />").val("All").text("All"));
cbo_impact_crop.val("All");
var hazard = d3.map(hazard_d, function (d) { return d.hazard; }).keys();
var cbo_impact_hazard = $("#cbo_impact_hazard");
cbo_impact_hazard.empty();
$.each(hazard, function () {
cbo_impact_hazard.append($("<option />").val(this).text(this));
});
cbo_impact_hazard.append($("<option />").val("All").text("All"));
cbo_impact_hazard.val("All");
// Set the event change for both controls
cbo_impact_crop.on('change', function (e) {
impact_fill_table(cbo_impact_crop.val(), cbo_impact_hazard.val());
});
cbo_impact_hazard.on('change', function (e) {
impact_fill_table(cbo_impact_crop.val(), cbo_impact_hazard.val());
});
// Default fill
impact_fill_table(cbo_impact_crop.val(), cbo_impact_hazard.val());
});
}
else if (tab === 'risk') {
$("#title").html("Climate risk");
$("#description").html("This tab presents a risk matrix generated through responses from agricultural experts in the districts on the frequency and severity of major hazards.");
$("#risk").removeClass("d-none");
d3.csv("https://raw.githubusercontent.com/CIAT-DAPA/pakistan_web/master/data/risk/risk.csv", function (error, data) {
var risk_d = data.filter(function (item) { return item.district == district; });
risk_fill(risk_d);
});
}
else if (tab === 'practices') {
$("#title").html("Practices");
$("#description").html("This tab presents the types of CSA practices prioritised by experts in the district, along with the areas were they have an impact, the hazards they address, and the barriers to adoption. the practices can be filtered by the commodity they look at, the areas where they have an impact or the types of hazards they address, allowing decision makers to identify practices that address certain priority issues.");
$("#practices").removeClass("d-none");
d3.csv("https://raw.githubusercontent.com/CIAT-DAPA/pakistan_web/master/data/practices/practices.csv", function (error, data) {
practices_d = data.filter(function (item) { return item.district == district; });
// Filling the cbo controls with hazard and crops
var crop = Array.from(new Set(d3.map(practices_d, function (d) { return d.crop; }).keys()));
var cbo_practices_crop = $("#cbo_practices_crop");
cbo_practices_crop.empty();
crop.forEach(function (i, v) {
cbo_practices_crop.append($("<option />").val(i).text(i));
});
cbo_practices_crop.append($("<option />").val("All").text("All"));
cbo_practices_crop.val("All");
var hazard = Array.from(new Set(d3.map(practices_d, function (d) { return d.hazard; }).keys()));
var cbo_practices_hazard = $("#cbo_practices_hazard");
cbo_practices_hazard.empty();
hazard.forEach(function (i, v) {
cbo_practices_hazard.append($("<option />").val(i).text(i));
});
cbo_practices_hazard.append($("<option />").val("All").text("All"));
cbo_practices_hazard.val("All");
// Set the event change for both controls
cbo_practices_crop.on('change', function (e) {
practices_fill(cbo_practices_crop.val(), cbo_practices_hazard.val());
});
cbo_practices_hazard.on('change', function (e) {
practices_fill(cbo_practices_crop.val(), cbo_practices_hazard.val());
});
// Default fill
practices_fill(cbo_practices_crop.val(), cbo_practices_hazard.val());
});
}
else if (tab === 'enablers') {
$("#title").html("Enablers");
$("#description").html("CSA enablers provide essential services and build core capacities, empowering individuals and agrarian communities to better manage their response to climate related pressures. This section looks at which types of enabler are prioritised in each of the districts.");
$("#enablers").removeClass("d-none");
enablers_load();
}
if (map != null) {
map.off();
map.remove();
}
map = L.map('map').setView([29.8724623, 66.1822339], 5);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var layer_url = "https://raw.githubusercontent.com/CIAT-DAPA/pakistan_web/master/data/maps/pakistan_map.json";
$.getJSON(layer_url, function (data) {
L.geoJSON(data, { onEachFeature: onEachFeature }).addTo(map);
});
}
/**
* Function which fill cropping data
*/
function cropping_fill(production) {
// Clear chart
$("#cropping_planted_plot svg").html("");
$("#cropping_production_plot svg").html("");
$("#cropping_livestock_plot svg").html("");
// Filtering data
var d_pl = production.filter(function (d) { return d.sector == 'Crops'; }).map(function (d) { return { "label": d.crop_livestock, "value": parseFloat(d.value) } });
var d_pr = production.filter(function (d) { return d.sector == 'Production'; }).map(function (d) { return { "label": d.crop_livestock, "value": parseFloat(d.value) } });
var d_li = production.filter(function (d) { return d.sector == 'Livestock'; }).map(function (d) { return { "label": d.crop_livestock, "value": parseFloat(d.value) } });
var colors_pie = ["#6e4c1f", "#9d9fa2", "#0088c6", "#8ebf3f", "#cad32b", "#f5d226", "#f68b33", "#993399", "#009933", "#cc3333", "#414042", "#2f8927", "#003580", "#19191a"];
// Production plots
nv.addGraph(function () {
var d_pl_chart = nv.models.pieChart()
.x(function (d) { return d.label })
.y(function (d) { return d.value })
.color(colors_pie)
.showLabels(true);
d3.select("#cropping_planted_plot svg")
.datum(d_pl)
.transition().duration(1200)
.call(d_pl_chart);
return d_pl_chart;
});
nv.addGraph(function () {
var d_pr_chart = nv.models.pieChart()
.x(function (d) { return d.label })
.y(function (d) { return d.value })
.color(colors_pie)
.showLabels(true);
d3.select("#cropping_production_plot svg")
.datum(d_pr)
.transition().duration(1200)
.call(d_pr_chart);