-
Notifications
You must be signed in to change notification settings - Fork 7
/
rainfall_maps.html
870 lines (846 loc) · 48 KB
/
rainfall_maps.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Rainfall Maps | Visualising Water Data</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Visualising Water Data for India Water Portal">
<meta name="author" content="ajantriks">
<!-- Google Web Fonts -->
<link href='http://fonts.googleapis.com/css?family=Bitter|Open+Sans' rel='stylesheet' type='text/css'>
<!-- Bootstrap CSS -->
<link href="lib/bootstrap/css/bootstrap.css" rel="stylesheet">
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>
<link href="lib/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<!-- Lightbox -->
<script src="lib/lightbox/js/jquery-1.7.2.min.js"></script>
<script src="lib/lightbox/js/lightbox.js"></script>
<link href="lib/lightbox/css/lightbox.css" rel="stylesheet" />
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="lib/bootstrap/js/html5shiv.js"></script>
<![endif]-->
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="../assets/ico/favicon.png">
<!-- Highlight.js -->
<link rel="stylesheet" href="lib/highlight.js/styles/github.css">
<script src="lib/highlight.js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="brand">Visualising Water Data</div>
<div class="nav-collapse collapse">
<ul class="nav">
<li class=""><a href="index.html">Home</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Visualisations <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="drought_maps.html">Drought Maps</a></li>
<li><a href="ground_water.html">Ground Water Charts</a></li>
<li><a href="kausani_rainfall.html">Kausani Rainfall Charts</a></li>
<li><a href="rainfall_ground_water_motion_charts.html">Rainfall and Ground Water Motion Charts</a></li>
<li><a href="rainfall_maps.html">Rainfall Maps</a></li>
</ul>
</li>
</ul>
</div>
<div class="navbar-inner pull-right">
<ul class="nav">
<li><a href="http://indiawaterportal.org/" target="_blank">India Water Portal</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container">
<h3>Rainfall Maps</h3>
<p>Maps of average monthly rainfall in each district for each year from 1901 to 2002. The rainfall data is sourced from <a href="http://www.indiawaterportal.org/articles/meteorological-datasets-download-entire-datasets-various-meteorological-indicators-1901" target="_blank">India Meteorological Department</a> (IMD), the Indian district boundaries are sourced from the <a href="http://gadm.org/" target="_blank">GADM database</a>, and the national boundary of India is extracted from the <a href="http://www.censusindia.gov.in/2011census/maps/administrative_maps/INDIA2011.pdf" target="_blank">administrative divisions map of Census of India 2011</a>.</p>
<br />
<h4>Maps:</h4>
<p><strong>How to use:</strong> Click on thumbnails to see full-size maps. Hit *Escape* to exit the lightbox.</p>
<p><strong>Legends:</strong> These are <a href="https://en.wikipedia.org/wiki/Choropleth" target="_blank">choropleth maps</a>. Each district is shaded according to the volume of average monthly rainfall for that district for that year. Colour chart is given with each map. Darker blue indicates greater rainfall. Lighter cyan indicates lesser rainfall.</p>
<p><strong>Note on rainfall data:</strong> The rainfall data available from IMD does not provide measurements for several districts, such as Ashoknagar, Annupur and Burhanpur in Madhya Pradesh, and Bongaigaon and Marigaon in Assam. In the maps, these districts can be found as white (absent data) areas. Details of the districts with absent data can be found in the file containing the <a href="https://github.com/ajantriks/iwp/blob/master/R_code/rainfall_maps.R">R code for generating these maps</a>.</p>
<p><strong>Note on administrative boundaries data:</strong> Please note that district and national boundary data available from <a href="http://gadm.org/" target="_blank">GADM</a> and extracted from <a href="http://www.censusindia.gov.in/2011census/maps/administrative_maps/INDIA2011.pdf" target="_blank">administrative divisions map of Census of India 2011</a> may not accurately represent the official national boundary of the country, and may neither include the most recent list of districts.</p>
<p><strong>Animated rainfall map:</strong> <a href="http://ajantriks.github.io/iwp/images/rainfall_maps/imd_rainfall_1901-2002_animation.gif" target="_blank">Click here to watch</a> an animated version of the rainfall maps from 1901 to 2002. The original file can also be accessed <a href="https://github.com/ajantriks/iwp/blob/master/images/rainfall_maps/imd_rainfall_1901-2002_animation.gif" target="_blank">at GitHub</a>.</p>
<br />
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1901_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1901"><img src="images/rainfall_maps/imd_rainfall_1901_web_small.png">
<h8>1901</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1902_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1902"><img src="images/rainfall_maps/imd_rainfall_1902_web_small.png">
<h8>1902</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1903_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1903"><img src="images/rainfall_maps/imd_rainfall_1903_web_small.png">
<h8>1903</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1904_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1904"><img src="images/rainfall_maps/imd_rainfall_1904_web_small.png">
<h8>1904</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1905_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1905"><img src="images/rainfall_maps/imd_rainfall_1905_web_small.png">
<h8>1905</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1906_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1906"><img src="images/rainfall_maps/imd_rainfall_1906_web_small.png">
<h8>1906</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1907_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1907"><img src="images/rainfall_maps/imd_rainfall_1907_web_small.png">
<h8>1907</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1908_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1908"><img src="images/rainfall_maps/imd_rainfall_1908_web_small.png">
<h8>1908</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1909_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1909"><img src="images/rainfall_maps/imd_rainfall_1909_web_small.png">
<h8>1909</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1910_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1910"><img src="images/rainfall_maps/imd_rainfall_1910_web_small.png">
<h8>1910</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1911_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1911"><img src="images/rainfall_maps/imd_rainfall_1911_web_small.png">
<h8>1911</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1912_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1912"><img src="images/rainfall_maps/imd_rainfall_1910_web_small.png">
<h8>1912</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1913_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1913"><img src="images/rainfall_maps/imd_rainfall_1913_web_small.png">
<h8>1913</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1914_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1914"><img src="images/rainfall_maps/imd_rainfall_1914_web_small.png">
<h8>1914</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1915_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1915"><img src="images/rainfall_maps/imd_rainfall_1915_web_small.png">
<h8>1915</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1916_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1916"><img src="images/rainfall_maps/imd_rainfall_1916_web_small.png">
<h8>1916</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1917_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1917"><img src="images/rainfall_maps/imd_rainfall_1917_web_small.png">
<h8>1917</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1918_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1918"><img src="images/rainfall_maps/imd_rainfall_1918_web_small.png">
<h8>1918</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1919_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1919"><img src="images/rainfall_maps/imd_rainfall_1919_web_small.png">
<h8>1919</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1920_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1920"><img src="images/rainfall_maps/imd_rainfall_1920_web_small.png">
<h8>1920</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1921_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1921"><img src="images/rainfall_maps/imd_rainfall_1921_web_small.png">
<h8>1921</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1922_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1922"><img src="images/rainfall_maps/imd_rainfall_1922_web_small.png">
<h8>1922</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1923_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1923"><img src="images/rainfall_maps/imd_rainfall_1923_web_small.png">
<h8>1923</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1924_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1924"><img src="images/rainfall_maps/imd_rainfall_1924_web_small.png">
<h8>1924</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1925_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1925"><img src="images/rainfall_maps/imd_rainfall_1925_web_small.png">
<h8>1925</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1926_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1926"><img src="images/rainfall_maps/imd_rainfall_1926_web_small.png">
<h8>1926</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1927_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1927"><img src="images/rainfall_maps/imd_rainfall_1927_web_small.png">
<h8>1927</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1928_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1928"><img src="images/rainfall_maps/imd_rainfall_1928_web_small.png">
<h8>1928</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1929_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1929"><img src="images/rainfall_maps/imd_rainfall_1929_web_small.png">
<h8>1929</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1930_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1930"><img src="images/rainfall_maps/imd_rainfall_1930_web_small.png">
<h8>1930</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1931_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1931"><img src="images/rainfall_maps/imd_rainfall_1931_web_small.png">
<h8>1931</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1932_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1932"><img src="images/rainfall_maps/imd_rainfall_1932_web_small.png">
<h8>1932</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1933_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1933"><img src="images/rainfall_maps/imd_rainfall_1933_web_small.png">
<h8>1933</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1934_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1934"><img src="images/rainfall_maps/imd_rainfall_1934_web_small.png">
<h8>1934</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1935_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1935"><img src="images/rainfall_maps/imd_rainfall_1935_web_small.png">
<h8>1935</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1936_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1936"><img src="images/rainfall_maps/imd_rainfall_1936_web_small.png">
<h8>1936</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1937_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1937"><img src="images/rainfall_maps/imd_rainfall_1937_web_small.png">
<h8>1937</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1938_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1938"><img src="images/rainfall_maps/imd_rainfall_1938_web_small.png">
<h8>1938</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1939_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1939"><img src="images/rainfall_maps/imd_rainfall_1939_web_small.png">
<h8>1939</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1940_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1940"><img src="images/rainfall_maps/imd_rainfall_1940_web_small.png">
<h8>1940</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1941_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1941"><img src="images/rainfall_maps/imd_rainfall_1941_web_small.png">
<h8>1941</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1942_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1942"><img src="images/rainfall_maps/imd_rainfall_1942_web_small.png">
<h8>1942</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/ground_water/rainfall_maps/imd_rainfall_1943_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1943"><img src="images/rainfall_maps/imd_rainfall_1943_web_small.png">
<h8>1943</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1944_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1944"><img src="images/rainfall_maps/imd_rainfall_1944_web_small.png">
<h8>1944</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1945_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1945"><img src="images/rainfall_maps/imd_rainfall_1945_web_small.png">
<h8>1945</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1946_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1946"><img src="images/rainfall_maps/imd_rainfall_1946_web_small.png">
<h8>1946</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1947_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1947"><img src="images/rainfall_maps/imd_rainfall_1947_web_small.png">
<h8>1947</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1948_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1948"><img src="images/rainfall_maps/imd_rainfall_1948_web_small.png">
<h8>1948</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1949_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1949"><img src="images/rainfall_maps/imd_rainfall_1949_web_small.png">
<h8>1949</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1950_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1950"><img src="images/rainfall_maps/imd_rainfall_1950_web_small.png">
<h8>1950</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1951_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1951"><img src="images/rainfall_maps/imd_rainfall_1951_web_small.png">
<h8>1951</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1952_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1952"><img src="images/rainfall_maps/imd_rainfall_1952_web_small.png">
<h8>1952</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1953_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1953"><img src="images/rainfall_maps/imd_rainfall_1953_web_small.png">
<h8>1953</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1954_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1954"><img src="images/rainfall_maps/imd_rainfall_1954_web_small.png">
<h8>1954</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1955_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1955"><img src="images/rainfall_maps/imd_rainfall_1955_web_small.png">
<h8>1955</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1956_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1956"><img src="images/rainfall_maps/imd_rainfall_1956_web_small.png">
<h8>1956</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1957_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1957"><img src="images/rainfall_maps/imd_rainfall_1957_web_small.png">
<h8>1957</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1958_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1958"><img src="images/rainfall_maps/imd_rainfall_1958_web_small.png">
<h8>1958</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1959_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1959"><img src="images/rainfall_maps/imd_rainfall_1959_web_small.png">
<h8>1959</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1960_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1960"><img src="images/rainfall_maps/imd_rainfall_1960_web_small.png">
<h8>1960</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1961_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1961"><img src="images/rainfall_maps/imd_rainfall_1961_web_small.png">
<h8>1961</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1962_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1962"><img src="images/rainfall_maps/imd_rainfall_1962_web_small.png">
<h8>1962</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1963_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1963"><img src="images/rainfall_maps/imd_rainfall_1963_web_small.png">
<h8>1963</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1964_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1964"><img src="images/rainfall_maps/imd_rainfall_1964_web_small.png">
<h8>1964</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1965_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1965"><img src="images/rainfall_maps/imd_rainfall_1965_web_small.png">
<h8>1965</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1966_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1966"><img src="images/rainfall_maps/imd_rainfall_1966_web_small.png">
<h8>1966</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1967_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1967"><img src="images/rainfall_maps/imd_rainfall_1967_web_small.png">
<h8>1967</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1968_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1968"><img src="images/rainfall_maps/imd_rainfall_1968_web_small.png">
<h8>1968</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1969_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1969"><img src="images/rainfall_maps/imd_rainfall_1969_web_small.png">
<h8>1969</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1970_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1970"><img src="images/rainfall_maps/imd_rainfall_1970_web_small.png">
<h8>1970</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1971_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1971"><img src="images/rainfall_maps/imd_rainfall_1971_web_small.png">
<h8>1971</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1972_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1972"><img src="images/rainfall_maps/imd_rainfall_1972_web_small.png">
<h8>1972</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1973_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1973"><img src="images/rainfall_maps/imd_rainfall_1973_web_small.png">
<h8>1973</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1974_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1974"><img src="images/rainfall_maps/imd_rainfall_1974_web_small.png">
<h8>1974</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1975_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1975"><img src="images/rainfall_maps/imd_rainfall_1975_web_small.png">
<h8>1975</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1976_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1976"><img src="images/rainfall_maps/imd_rainfall_1976_web_small.png">
<h8>1976</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1977_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1977"><img src="images/rainfall_maps/imd_rainfall_1977_web_small.png">
<h8>1977</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1978_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1978"><img src="images/rainfall_maps/imd_rainfall_1978_web_small.png">
<h8>1978</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1979_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1979"><img src="images/rainfall_maps/imd_rainfall_1979_web_small.png">
<h8>1979</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1980_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1980"><img src="images/rainfall_maps/imd_rainfall_1980_web_small.png">
<h8>1980</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1981_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1981"><img src="images/rainfall_maps/imd_rainfall_1981_web_small.png">
<h8>1981</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1982_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1982"><img src="images/rainfall_maps/imd_rainfall_1982_web_small.png">
<h8>1982</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1983_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1983"><img src="images/rainfall_maps/imd_rainfall_1983_web_small.png">
<h8>1983</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1984_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1984"><img src="images/rainfall_maps/imd_rainfall_1984_web_small.png">
<h8>1984</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1985_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1985"><img src="images/rainfall_maps/imd_rainfall_1985_web_small.png">
<h8>1985</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1986_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1986"><img src="images/rainfall_maps/imd_rainfall_1986_web_small.png">
<h8>1986</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1987_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1987"><img src="images/rainfall_maps/imd_rainfall_1987_web_small.png">
<h8>1987</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1988_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1988"><img src="images/rainfall_maps/imd_rainfall_1988_web_small.png">
<h8>1988</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1989_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1989"><img src="images/rainfall_maps/imd_rainfall_1989_web_small.png">
<h8>1989</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1990_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1990"><img src="images/rainfall_maps/imd_rainfall_1990_web_small.png">
<h8>1990</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1991_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1991"><img src="images/rainfall_maps/imd_rainfall_1991_web_small.png">
<h8>1991</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1992_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1992"><img src="images/rainfall_maps/imd_rainfall_1992_web_small.png">
<h8>1992</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1993_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1993"><img src="images/rainfall_maps/imd_rainfall_1993_web_small.png">
<h8>1993</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1994_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1994"><img src="images/rainfall_maps/imd_rainfall_1994_web_small.png">
<h8>1994</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1995_web.png" rel="lightbox[gw]" title="Average Monthly Rainfall across Districts, India, 1995"><img src="images/rainfall_maps/imd_rainfall_1995_web_small.png">
<h8>1995</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1996_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1996"><img src="images/rainfall_maps/imd_rainfall_1996_web_small.png">
<h8>1996</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1997_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1997"><img src="images/rainfall_maps/imd_rainfall_1997_web_small.png">
<h8>1997</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1998_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1998"><img src="images/rainfall_maps/imd_rainfall_1998_web_small.png">
<h8>1998</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_1999_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 1999"><img src="images/rainfall_maps/imd_rainfall_1999_web_small.png">
<h8>1999</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_2000_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 2000"><img src="images/rainfall_maps/imd_rainfall_2000_web_small.png">
<h8>2000</h8>
</a></div>
</li>
</ul>
<ul class="thumbnails">
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_2001_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 2001"><img src="images/rainfall_maps/imd_rainfall_2001_web_small.png">
<h8>2001</h8>
</a></div>
</li>
<li class="span2">
<div class="thumbnail">
<a href="images/rainfall_maps/imd_rainfall_2002_web.png" rel="lightbox[rm]" title="Average Monthly Rainfall across Districts, India, 2002"><img src="images/rainfall_maps/imd_rainfall_2002_web_small.png">
<h8>2002</h8>
</a></div>
<li>
</ul>
<br />
<h4>Documentation:</h4>
<br />
<p>The original IMD rainfall data for 1901-2002 comes in three MS Excel spreadsheets, and each of them contains data for a set of states (for the entire period). The data is organised as follows (with the state and district codes given in a separate sheet of the spreadsheet file):</p>
<pre><code>State ID,District ID,Year,January,February,March,April,May,June,July,August,September,October,November,December
1,1,1901,398.24,331.86,563.32,757.26,944.61,802.88,1020.44,432.67,717.18,223.14,44.45,101.16
1,1,1902,255.22,331.97,746.78,962.14,954.47,1116.03,910.09,688.77,542.22,434.55,523.79,159.64
1,1,1903,607.9,589.12,692.71,594.51,830.91,817.7,1094.51,983.38,732.75,165.03,146.73,210.24</pre></code>
<p>To use this data along with the Indian district boundaries datset from <a href="http://gadm.org/" target="_blank">GADM</a>, it needs to be re-organised in the following format, where each row gives the annual (aggregate) rainfall (for the year concerned) for a specific district for a specific year:</p>
<pre><code>"State.ID","District.ID","Year","Annual.Rainfall"
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1901,6337.21
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1902,7625.67
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1903,7465.49</pre></code>
<p>This format is useful because it allows the *District.ID* value of a row to be used to link up the count of annual (aggregate) rainfall for a district (and for a year) to its corresponding district boundary shape (available from the Indian district boundaries data file). To enable this, the name of the districts must match between the rainfall data file and the district boundaries shapefile.</p>
<p>To do this, first IMD rainfall data files are converted from MS Excel spreadsheet format to .csv (Comma Separated Value) format, and read into R using the <code>read.csv</code> command. Then they are combined into a single file ("imd_states_name_1-35.csv") using the <code>rbind</code> command.</p>
<pre><code>d1 <- read.csv("imd_states_1-10.csv")
d2 <- read.csv("imd_states_11-25.csv")
d3 <- read.csv("imd_states_26-35.csv")
data <- rbind(d1,d2,d3)
View(data)
write.csv(data, file="imd_states_name_1-35.csv")</pre></code>
<p>Then the state and district codes from the IMD rainfall data file is converted to their respective names, by following the spellings of those state and district names as given in the GADM district boundaries shapefile. The second line below replace the values of *State.ID* by "Jammu and Kashmir" (spelt as in GADM district boundaries shapefile) if the present value is "1". The third line below replace the values of *District.ID* by "Kupwara (Muzaffarabad)" (spelt as in GADM district boundaries shapefile) if the present value is "1" and the corresponding *District.ID* value is "Jammu and Kashmir".</p>
<pre><code>d <- read.csv ("imd_states_1-10.csv")
d$State.ID [d$State.ID == "1"] <- "Jammu and Kashmir"
d$District.ID [d$State.ID == "Jammu and Kashmir" & d$District.ID == "1"] <- "Kupwara (Muzaffarabad)"</code></pre>
<p>Once such replacing of the state and district codes by their corresponding names (spelt as in GADM district boundaries shapefile) is done, the data takes the following form:</p>
<pre><code>"State.ID","District.ID","Year","January","February","March","April","May","June","July","August","September","October","November","December"
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1901,398.24,331.86,563.32,757.26,944.61,802.88,1020.44,432.67,717.18,223.14,44.45,101.16
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1902,255.22,331.97,746.78,962.14,954.47,1116.03,910.09,688.77,542.22,434.55,523.79,159.64
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1903,607.9,589.12,692.71,594.51,830.91,817.7,1094.51,983.38,732.75,165.03,146.73,210.24</pre></code>
<p>The three IMD rainfall data spreadsheets are converted to this form and combined into a single .csv file, using the <code>rbind</code> command, and the resultant data file is named "imd_states_name_1-35.csv"</p>
<pre><code>d1 <- read.csv("imd_states_1-10.csv")
d2 <- read.csv("imd_states_11-25.csv")
d3 <- read.csv("imd_states_26-35.csv")
data <- rbind(d1,d2,d3)
View(data)
write.csv(data, file="imd_states_name_1-35.csv")</code></pre>
<p>Now the present structure of the table, where each row shows monthly rainfall counts for all months for a single year, needs to be changed to a structure where each rows gives the annual (aggregate) rainfall in a district for an unique combination of year and month. This is done using the <code>melt</code> command from the <a href="http://cran.r-project.org/web/packages/reshape2/" target="_blank">Rehape2 package of R</a>, by converting the month columns ("January" to "December") into a single column that takes the months as its values.</p>
<pre><code>d <- read.csv ("imd_states_name_1-35.csv")
library(reshape2)
dm <- melt(d, id = c('State.ID', 'District.ID', 'Year'))</code></pre>
<p>This converts the data to the following format:</p>
<pre><code>"State.ID","District.ID","Year","variable","value"
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1901,"January",398.24
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1902,"January",255.22
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1903,"January",607.9</pre></code>
<p>But this gives the volume of rainfall for each district for each month (for each year), and not the annual (aggregate) rainfall for each district (for each year) that we need to generate the maps concerned.</p>
<p>The following commands generate this annual (aggregate) rainfall for each district (for each year), by taking the average of *value* for all rows with unique combinations of *State.ID*, *District.ID* and *Year*, and multiplying it by "12".</p>
<pre><code>dm$Avg.Monthly.Rainfall <- with(dm, ave(value, State.ID, District.ID, Year))
dm$Annual.Rainfall <- with(dm, Avg.Monthly.Rainfall * 12)</pre></code>
<p>This converts the data to the following format:</p>
<pre><code>"State.ID","District.ID","Year","variable","value","Avg.Monthly.Rainfall","Annual.Rainfall"
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1901,"January",398.24,528.100833333333,6337.21
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1902,"January",255.22,635.4725,7625.67
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1903,"January",607.9,622.124166666667,7465.49</code></pre>
<p>The reformatted data table is saved.</p>
<pre><code>write.csv(dm, file = "imd_states_name_1-35_annual-rainfall.csv")</code></pre>
<p>The resultant data file still has separate rows for all the months of each year. Since, the annual (aggregate) rainfall for each year have already been generated, there is no need for these rows for separate months. The first line below takes a subset of the data with only rows for the month of "January" (for all years); and the next lines remove the variables that are not needed anymore and save the data table again.</p>
<pre><code>d2 <- subset(dm, dm$variable == "January")
d2$variable <- NULL
d2$value <- NULL
d2$Avg.Monthly.Rainfall <- NULL
write.csv(d2, file = "imd_states_name_1-35_annual-rainfall-edited.csv")</code></pre>
<p>Now we have the data in the following format, and it is ready for mapping:</p>
<pre><code>"State.ID","District.ID","Year","Annual.Rainfall"
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1901,6337.21
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1902,7625.67
"Jammu and Kashmir","Kupwara (Muzaffarabad)",1903,7465.49</code></pre>
<p>The Indian administrative boundaries (shapefile) data file is downloaded from the <a href="http://gadm.org/country" target="_blank">GADM website</a>, and opened using the <code>readOGR</code> command of the <a href="http://cran.r-project.org/web/packages/rgdal/index.html" target="_blank">rgdal library of R</a>. Further, the shapefile data is converted to a R data frame, which can be used by the <a href="http://cran.r-project.org/web/packages/ggplot2/index.html" target="_blank">ggplot2 library</a> for mapping, by using the <code>fortify</code> command.</p>
<pre><code>library(sp)
library(rgdal)
i <- readOGR (dsn = "IND_adm/", layer = "IND_adm2")
library(maptools)
gpclibPermit()
library(ggplot2)
library(scales)
m <- fortify(i, region = "NAME_2")</pre></code>
<p>Please note that the Indian administrative boundaries data file from GADM contains state, district and sub-district boundaries. For the purpose of these maps, the district level boundaries are used, by choosing the "IND_adm2" layer, and by fortifying the map data with the "NAME_2" variable that contains the district names.</p>
<p>To create map of annual (aggregate) rainfall across districts for a specific year, the final re-organised rainfall data file is opened and the corresponding subset is taken (the year "1901" is used in the example below).</p>
<p>Please note that if the opened data file has a column titled *X*, remove it using this command: <code>d$X <- NULL</code></p>
<pre><code>d <- read.csv ("imd_states_name_1-35_annual-rainfall.csv")
d1901 <- subset (d, d$Year == "1901")</code></pre>
<p>Finally, we draw the map using the <a href="http://cran.r-project.org/web/packages/ggplot2/index.html" target="_blank">ggplot2 library of R</a>.<p>
<pre><code>ggplot(d1901, aes(map_id = District.ID)) + geom_map(aes(fill = Annual.Rainfall), map = m) + expand_limits(x = m$long, y = m$lat) + scale_fill_gradient(low = "#00FFFF", high = "#0000C8", space = "Lab", limits = c(0, 14000), breaks = c(0, 3000, 6000, 9000, 12000, 14000)) + theme(panel.background = element_rect(fill = "white"), axis.line = element_line(color = "white"), axis.ticks = element_line(color = "white"), axis.text = element_text(color = "white")) + guides(fill = guide_colorbar(title = "Annual Rainfall\n(mm)\n", title.theme = element_text(colour = "#444444", size = "40", angle = 0), barwidth = 2, barheight = 30, label.theme = element_text(colour = "#444444", size = "38", angle = 0))) + xlab("") + ylab("")</code></pre>
<br />
<h4>Code and Data:</h4>
<br />
<p>The entire R code (as given in the documentation) for this visualisation can be downloaded <a href="https://github.com/ajantriks/iwp/blob/master/R_code/rainfall_maps.R" target="_blank">from here</a>.</p>
<p>Data (reorganised from the original data shared by IMD) used to create the above charts can also be downloaded <a href="https://github.com/ajantriks/iwp/blob/master/data/imd_states_name_1-35_annual-rainfall.csv" target="_blank">from here</a>.</p>
<br />
<h4>Credits and License:</h4>
<br />
<p>Created by <a href="http://www.ajantriks.net/" target="_blank">Sumandro Chattapadhyay</a> for <a href="http://indiawaterportal.org/" target="_blank">India Water Portal</a>.</p>
<p>All visualisations are developed using <a href="http://cran.r-project.org/" target="_blank">R</a>.</p>
<p>Pages written using <a href="http://twitter.github.com/bootstrap/" target="_blank">Bootstrap</a>, <a href="http://www.google.com/webfonts/" target="_blank">Google Web Fonts</a>, <a href="http://softwaremaniacs.org/soft/highlight/en/" target="_blank">Highlight.js</a> and <a href="http://lokeshdhakar.com/projects/lightbox2/" target="_blank">Lightbox</a>.</p>
<p>Code for all the visualisations is available on <a href="https://github.com/ajantriks/iwp" target="_blank">GitHub</a>.</p>
<p>Code (but not data) is shared under Creative Commons <a href="http://creativecommons.org/licenses/by-sa/3.0/" target="_blank">Attribution-ShareAlike 3.0 Unported</a> license.</p>
<p>Reorganised <a href="https://github.com/ajantriks/iwp/tree/master/data" target="_blank">data</a> has been shared only for the purpose of checking and validating the charts and maps.</p>
<p>It is necessary to take required permission from the original creator of data before re-using it.</p>
<p><strong>Note: Please link back to this page while sharing or re-using this work.</strong></p>
<br />
<br />
</div> <!-- /container -->
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="lib/bootstrap/js/jquery.js"></script>
<script src="lib/bootstrap/js/bootstrap-dropdown.js"></script>
<script src="lib/bootstrap/js/bootstrap-collapse.js"></script>
</body>
</html>