-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path2018Spring_GSFC_WesternEuropeHealthAQII_Code_FD.txt
2253 lines (1777 loc) · 84.7 KB
/
2018Spring_GSFC_WesternEuropeHealthAQII_Code_FD.txt
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
// ***START***
//iMMOD: An Interactive Model of Mosquito Distribution
//Western Europe Health and Air Quality II
//March 30, 2018
//__________________________________________GLOBAL OPTIONS___________________________________________//
//set map center
Map.setCenter(1, 46, 4);
//custom basemap style
var styles = {
'Soft Blue': [
{
featureType: 'all',
stylers: [
{ saturation: -80 }
]
},{
featureType: 'road.arterial',
elementType: 'geometry',
stylers: [
{ hue: '#00ffee' },
{ saturation: 50 }
]
},{
featureType: 'poi.business',
elementType: 'labels',
stylers: [
{ visibility: 'off' }
]
}
]
};
Map.setOptions('satellite', styles);
//__________________________________________SET VARIABLES___________________________________________//
{
var LST = ee.ImageCollection("MODIS/006/MOD11A1"); //MODIS Land Surface Temperature
var NDVI = ee.ImageCollection("MODIS/MOD09GA_006_NDVI"); //MODIS Normalized Difference Vegetation Index
var Precip = ee.ImageCollection("NASA/GPM_L3/IMERG_V04"); //Global Precipitation Measurement
var Moisture = ee.ImageCollection("NASA/GLDAS/V021/NOAH/G025/T3H"); //Soil Moisture and Humidity
var Elevation = ee.Image('CGIAR/SRTM90_V4'); //Elevation
var LandCover = ee.Image("MODIS/051/MCD12Q1/2013_01_01"); //Land Cover
var PopDens = ee.Image('CIESIN/GPWv4/unwpp-adjusted-population-density/2015'); //Population Density
var WaterBodies = ee.Image('JRC/GSW1_0/GlobalSurfaceWater'); //Water bodies
var MajRoads = ee.FeatureCollection("users/juliaheslin/MajorRoads"); //Major Roads
var Rails = ee.FeatureCollection("users/juliaheslin/Rails"); //Railroads
var Ferry = ee.FeatureCollection("users/juliaheslin/Ferry"); //Ferry Routes
var Outbreaks = ee.FeatureCollection("users/juliaheslin/PublicHealth"); //Mosquito Outbreak Data
var Jun16 = ee.FeatureCollection('ft:1HldmIcHDQ-t8fgMukkXdVA13JCI-KM_HOIOf3FL3'); //June 2016 Citizen Science Data
var Jul16 = ee.FeatureCollection('ft:1P7718Wxj-bk2RwoMoMvOXT8G-Ojw09Ot7lreKqL7'); //July 2016 Citizen Science Data
var Aug16 = ee.FeatureCollection('ft:1t9K74TTrn2POnoYl0gww7jkafEaMXcweEdp_ZHpo'); //August 2016 Citizen Science Data
var Sep16 = ee.FeatureCollection('ft:1TK2iFjap6GU6uDsEuYYEee-iywwMcpq9EpEVsmdp'); //September 2016 Citizen Science Data
var Oct16 = ee.FeatureCollection('ft:1k8Lgo4Dl6hCe0PUYIbnUP43T3Q2EAUr2lnCXO4Ny'); //October 2016 Citizen Science Data
var Nov16 = ee.FeatureCollection('ft:1FjrFHYfoO1wjyCErJMqXWV5aIzHuj9mRKdDH9b8X'); //November 2016 Citizen Science Data
var Dec16 = ee.FeatureCollection('ft:1fmc1OQQKFFzFD3xPaGwxVqU1hmF8aNDb5NR6m_PV'); //December 2016 Citizen Science Data
var Jan17 = ee.FeatureCollection('ft:17W4A_jb5TI3vIZZ1_m_7OU-DWNw2LNMd43pvnmLU'); //January 2017 Citizen Science Data
var Feb17 = ee.FeatureCollection('ft:1iWNQ5dX9SAZa8lrVt8bzDUP4T3XtWvJDeYqIer-2'); //Feburary 2017 Citizen Science Data
var Mar17 = ee.FeatureCollection('ft:1-W3YNJZr3YaQCBHl-kIbOkvP4CQce3VbtbZs1jg-'); //March 2017 Citizen Science Data
var Apr17 = ee.FeatureCollection('ft:1GTEKcHBLM_qVTGyH-K8LjcmB7I3ex2lAVRllSsGW'); //April 2017 Citizen Science Data
var May17 = ee.FeatureCollection('ft:1NjjKQF34SWf2X0ph05k-hPx_l_NRmjh3LhuX0mTW'); //May 2017 Citizen Science Data
var Jun17 = ee.FeatureCollection('ft:1n5OD8ZrSpTOgZiZ3TtB5XBV3slrj-gi3kaVkLLhf'); //June 2017 Citizen Science Data
var Jul17 = ee.FeatureCollection('ft:1xmK6vDjj5AMYskuKd3WF1E9WveprgjhoN7wZBXU8'); //July 2017 Citizen Science Data
var Aug17 = ee.FeatureCollection('ft:1274UTOvTke2FS25KgHnbtr8efIcYBBJ5PCH6p42J'); //August 2017 Citizen Science Data
var GLOBE = ee.FeatureCollection('ft:1mgJU3sMIflF-nv9jA25vGUZNj1N1bpR7nCTNdxMx'); //GLOBE data
var countries = ee.FeatureCollection("USDOS/LSIB/2013"); //Country boundaries
// here are some variables we did not use, but may prove useful in the future
// var cisc = ee.FeatureCollection('ft:1OEaPOntsHvq1y3OJ-rKqakKtJAP6DRRiRh221qEe'); //All Citizen Science Data
// var bel = countries.filter(ee.Filter.inList('name', ['BELGIUM'])); //Belgium boundaries
// var ita = countries.filter(ee.Filter.inList('name', ['ITALY'])); //Italy boundaries
// var nld = countries.filter(ee.Filter.inList('name', ['NETHERLANDS'])); //Netherlands boundaries
// var esp = countries.filter(ee.Filter.inList('name', ['SPAIN'])); //Spain boundaries
// var europe = countries.filter(ee.Filter.inList('name', ['ALBANIA', 'ANDORRA', 'AUSTRIA',
// 'BELARUS', 'BELGIUM', 'BOSNIA & HERZEGOVINA', 'BULGARIA',
// 'CROATIA', 'CYRPUS','CZECH REPUBLIC',
// 'DENMARK',
// 'ESTONIA',
// 'FINLAND', 'FRANCE',
// 'GERMANY', 'GREECE',
// 'HUNGARY',
// 'ICELAND', 'IRELAND', 'ITALY',
// 'KOSOVO',
// 'LATVIA', 'LIECHTENSTEIN', 'LITHUANIA', 'LUXEMBOURG',
// 'MACEDONIA', 'MALTA', 'MOLDOVA', 'MONACO', 'MONTENEGRO',
// 'NETHERLANDS', 'NORWAY',
// 'POLAND', 'PORTUGAL',
// 'ROMANIA', 'RUSSIA',
// 'SAN MARINO', 'SERBIA', 'SLOVAKIA', 'SLOVENIA', 'SPAIN', 'SWEDEN', 'SWITZERLAND',
// 'TURKEY',
// 'UKRAINE', 'UNITED KINGDOM',
// 'VATICAN CITY'])); //European countries
// var StudyArea = countries.filter(ee.Filter.inList('name', ['NETHERLANDS', 'ITALY', 'SPAIN', 'BELGIUM'])); //Study area
}
//=======================================================================================================//
//=============================================INTRODUCTION==============================================//
//=======================================================================================================//
//__________________________________________INTRO PANEL___________________________________________//
//intro panel
var intro_panel = ui.Panel({
layout: ui.Panel.Layout.flow('vertical'),
style: {width: '350px',
backgroundColor: '#150E07',
border: '10px ridge #B28355',
position: 'top-center',
shown: true}})
//add a label with the title of the tool, "iMMOD"
.add(ui.Label({
value: 'iMMOD',
style: {fontSize: '36px',
fontWeight: 'bold',
textAlign: 'center',
stretch: 'horizontal',
color: '#cf8c4a',
backgroundColor: '#150E07',
//padding: '0px 30px 0px 30px'
}}))
//add the long title
.add(ui.Label({
value: 'An Interactive Model of Mosquito Distribution',
style: {fontSize: '24px',
textAlign: 'center',
position: 'top-center',
stretch: 'horizontal',
color: '#9C5D1F',
backgroundColor: '#150E07',
//padding: '0px 30px 0px 30px'
}}))
//add a short description about the tool
.add(ui.Label({
value: 'The NASA DEVELOP Western Europe Health and Air Quality Team created this open-source, ' +
'interactive mosquito habitat suitability modeling application to assist with vector-borne disease '+
'management in Western Europe.',
style: {fontSize: '14px',
textAlign: 'justify',
color: '#74491F',
backgroundColor: '#150E07',
//padding: '10px 30px 10px 30px'
}}))
//continue the description about the tool
.add(ui.Label({
value: 'Using the Maximum Entropy (MaxEnt) algorithm, you can visualize how NASA Earth observations '+
'and citizen science mosquito observances predict suitable habitat for mosquitoes.',
style: {fontSize: '14px',
textAlign: 'justify',
color: '#74491F',
backgroundColor: '#150E07',
//padding: '10px 30px 10px 30px'
}}));
//add the panel to the map
Map.add(intro_panel);
//create a button to hide the panel
intro_panel.add(ui.Button(
{label: 'CLOSE',
style: {color: '#000000',
stretch: 'horizontal'
},
onClick: function() {
intro_panel.style().set('shown', false);
intro_button.style().set('shown', true);
}
}));
//create a button to reveal the intro panel
var intro_button = ui.Button({
label: 'INTRODUCTION',
style: {position: 'top-center',
color: '#000000',
padding: '0px',
shown: false
},
onClick: function() {
//hide the panel
intro_button.style().set('shown', false);
//reveal the panel
intro_panel.style().set('shown', true);
}
});
Map.add(intro_button);
//__________________________________________DATE WRAPPER___________________________________________//
//specify the date range
var startDate = ee.Date('2016-06-01');
var endDate = ee.Date('2017-31-08');
//create a function that retrieves monthly data based on specified date range
var getLayers = function(startDate){
var dateRange = ee.Date(startDate).getRange('month');
print(dateRange);
Map.layers().reset();
//=======================================================================================================//
//==========================================DATA VISUALIZATION===========================================//
//=======================================================================================================//
//__________________________________________DATA PROCESSING___________________________________________//
//land surface temperature
//create a function to convert Kelvin to degrees Celsius
function convertToCelsius(image){
var result = image.toFloat().multiply(0.02)
.subtract(273.15);
result = result.copyProperties(image);
return result;
}
//select and filter land surface temperature data
var LSTrange = LST.select('LST_Day_1km')
.filterDate(dateRange)
.mean()
.clip(countries);
//convert to Celsius
var cLST = ee.Image(convertToCelsius(LSTrange));
//ndvi
//filter ndvi data
var NDVIrange = NDVI.filterDate(dateRange)
.mean()
.clip(countries);
var cNDVI = ee.Image(NDVIrange);
//precipitation
//filter precipitation data
var precipRange = Precip.select('precipitationCal')
.filterDate(dateRange)
.sum()
.clip(countries);
var cPrecip = ee.Image(precipRange);
//humidity
//select and filter humidity data
var humidity = Moisture.select('Qair_f_inst')
.filterDate(dateRange)
.mean()
.clip(countries);
var cHumidity = ee.Image(humidity);
//soil moisture
//select and filter soil moisture data
var soilMoisture = Moisture.select('SoilMoi0_10cm_inst')
.filterDate(dateRange)
.mean()
.clip(countries);
var cSoilMoisture = ee.Image(soilMoisture);
//land cover
//filter land cover data
var LandCoverBands = LandCover.select('Land_Cover_Type_2')
.clip(countries);
var cLandCover = ee.Image(LandCoverBands);
//elevation
//clip elevation
var cElevation = Elevation.clip(countries);
//population density
//clip population density
var cPopDens = PopDens.clip(countries);
//water bodies
var water = WaterBodies.select('occurrence')
.clip(countries);
//distance to water
var cWater = WaterBodies.fastDistanceTransform(256, 'pixels', 'squared_euclidean')
.clip(countries);
//transportation routes
//railways
var railroad = ee.Image().paint(Rails, 0, 0.1);
//roads
var roads = ee.Image().paint(MajRoads, 0, 0.1);
//ferries
var ferries = ee.Image().paint(Ferry, 0, 0.1);
//__________________________________________LEGEND PROPERTIES___________________________________________//
var LSTviz = {min: -5, max: 60, palette: ['#14cec5', '#ffed19', '#ff1b79']};
var NDVIviz = {min: -1, max: 1, palette: ['#b30000', '#e6e600', '#00802b']};
var Precipviz = {min: 0, max: 399, palette: ['#cc3030', '#c89a32', '#b3c42b',
'#52ab24', '#20ab73', '#2682b8',
'#00037e']};
var Humidityviz = {min: 0.0060336, max: 0.0114012, palette: ['#eb4c1c', '#f1ae33', '#ede72b',
'#9dd62f', '#43d83a', '#2fd698',
'#41b8cc', '#3b82c0']};
var SoilMoistureviz = {min: 0, max: 50, palette: ['#9b792e', '#959b3b', '#74973c',
'#3d9f37', '#45a85f', '#3d6fa3']};
var Elevationviz = {min: 0, max: 3000, palette: ['#aff0e9', '#f8fcb3', '#2fab2b',
'#12823f', '#f2a202', '#870801',
'#fffcff']};
var LandCoverviz = {min: 0, max: 17, palette: ['#aec3d6', '#162103', '#235123',
'#399b38', '#38eb38', '#39723b',
'#6a2424', '#c3a55f', '#b76124',
'#d99125', '#92af1f', '#cdb400',
'#cc0202', '#f7e174', '#743411',]};
var PopDensviz = {min: 0, max: 750, palette: ['#081d58', '#253494', '#225ea8',
'#1d91c0', '#41b6c4', '#7fcdbb',
'#c7e9b4', '#edf8b1', '#ffffd9']};
var Waterviz= {min: 0, max: 50, palette: ['#2d77ff', '#1be9ff', '#1bff8b',
'#9bff2f', '#fbff2f', '#ff7525',
'#ff2525']};
//__________________________________________ADD LAYERS TO MAP___________________________________________//
var layers = [
ui.Map.Layer(cLST, LSTviz, 'Land Surface Temperature', false),
ui.Map.Layer(cNDVI, NDVIviz, 'Normalized Difference Vegetation Index', false),
ui.Map.Layer(cPrecip, Precipviz, 'Total Precipitation', false),
ui.Map.Layer(cHumidity, Humidityviz, 'Humidity', false),
ui.Map.Layer(cSoilMoisture, SoilMoistureviz, 'Soil Moisture', false),
ui.Map.Layer(cElevation, Elevationviz, 'Elevation', false),
ui.Map.Layer(cLandCover, LandCoverviz, 'Land Cover', false),
ui.Map.Layer(cPopDens, PopDensviz, 'Population Density', false),
//ui.Map.Layer(cWater, Waterviz, 'Distance to Water Bodies', false),
//ui.Map.Layer(Outbreaks, {color: 'bc0909'}, 'Mosquito Outbreak Records', false),
//ui.Map.Layer(railroad, {palette: '62A7A7'}, 'Railways', false),
//ui.Map.Layer(roads, {palette: 'C70606'}, 'Major Roads', false),
//ui.Map.Layer(ferries, {palette: '045A8D'}, 'Ferry', false),
];
Map.layers().reset(layers);
Map.addLayer(railroad, {palette: '62A7A7'}, 'Railways', false);
Map.addLayer(roads, {palette: 'C70606'}, 'Major Roads', false);
Map.addLayer(ferries, {palette: '045A8D'}, 'Ferry', false);
Map.addLayer(Outbreaks, {color: 'bc0909'}, 'Mosquito Outbreak Records', false);
//__________________________________________EXPLORE LAYERS PANEL___________________________________________//
//create a layers panel
var layers_panel = ui.Panel({
style: {width: '275px',
position: 'top-left',
color: '#002e4d',
backgroundColor: '#150E07',
border: '10px groove #B28355',
shown: false}});
//add layers panel to the map
ui.root.insert(0, layers_panel);
//add a title "Explore Layers"
layers_panel.add(ui.Label({
value: 'Explore Layers',
style: {fontSize: '24px',
color: '#cf8c4a',
backgroundColor: '#150E07',
textAlign: 'center',
fontWeight: 'bold',
stretch: 'horizontal'
}}));
//textbox to search by date
var dateText = ui.Textbox({
placeholder: 'yyyy-mm-dd',
onChange: function(text){ },
style: {width: '100px'
}});
//button to search by date
var dateButton = ui.Button({label: 'Get monthly data...',
onClick: function(){
getLayers(dateText.getValue());}});
//create a panel to hold the date textbox and button
var datePanel = ui.Panel({
layout: ui.Panel.Layout.flow('horizontal'),
widgets: [dateText, dateButton],
style:{width: '250px',
position: 'top-right',
color: '#000000',
backgroundColor: '#150E07'
}});
//add date textbox and button to layers panel
layers_panel.add(datePanel);
var places = {
Belgium: [4.469936, 50.503887],
Italy: [12.56738, 41.87194],
Netherlands: [5.291266, 52.132633],
Spain: [-3.74922, 40.463667]
};
var select = ui.Select({
items: Object.keys(places),
placeholder: ('Choose an area of interest...'),
style: {color: '#000000'},
onChange: function(key) {
Map.setCenter(places[key][0], places[key][1], 6);
}
});
layers_panel.add(select);
//create a function that retrieves selected map layer based on input date
var nav = layers.map(function(layer){
var name = layer.getName();
return ui.Button({
label: name,
onClick: function(){
Map.layers().forEach(function(mapLayer){
mapLayer.setShown(mapLayer.getName() == name);});},
style: {stretch: 'horizontal'}
});});
//add this function to the layers panel
layers_panel.add(ui.Panel({
widgets: nav,
style: {color: '#000000',
backgroundColor: '#150E07'
}
}));
//create and add a button to hide the panel
layers_panel.add(ui.Button(
{label: 'CLOSE',
style: {color: '#000000',
stretch: 'horizontal'},
onClick: function() {
layers_panel.style().set('shown', false);
layers_button.style().set('shown', true);
}
}));
//create a button to reveal the layers panel
var layers_button = ui.Button({
label: 'EXPLORE DATA',
style: {position: 'bottom-left',
color: '#000000',
padding: '0px'
},
onClick: function() {
//hide the panel
layers_button.style().set('shown', false);
//reveal the panel
layers_panel.style().set('shown', true);
}
});
//add button to the map
Map.add(layers_button);
//__________________________________________END DATE WRAPPER___________________________________________//
};
getLayers(startDate);
//=======================================================================================================//
//=======================================HABITAT SUITABILITY MODEL=======================================//
//=======================================================================================================//
//__________________________________________MAXIMUM ENTROPY MODEL___________________________________________//
//visualize model for whole study area
//set study areas
var WestEur = ee.Geometry.Rectangle([-9.823036083797, 35.312027706114, 18.426963916203, 54.662027706114]) //Western Europe
//set date ranges
var janDate = ee.DateRange('2017-01-01', '2017-02-01')
var febDate = ee.DateRange('2017-02-01', '2017-03-01')
var marDate = ee.DateRange('2017-03-01', '2017-04-01')
var aprDate = ee.DateRange('2017-04-01', '2017-05-01')
var mayDate = ee.DateRange('2017-05-01', '2017-06-01')
var junDate = ee.DateRange('2016-06-01', '2016-07-01')
var julDate = ee.DateRange('2016-07-01', '2016-08-01')
var augDate = ee.DateRange('2016-08-01', '2016-09-01')
var sepDate = ee.DateRange('2016-09-01', '2016-10-01')
var octDate = ee.DateRange('2016-10-01', '2016-11-01')
var novDate = ee.DateRange('2016-11-01', '2016-12-01')
var decDate = ee.DateRange('2016-12-01', '2017-01-01')
//suitability visualization parameters
var suitability = {min: 0, max: 1, palette: ['310bff', '053bff', '078cff',
'01adff', '05d1ff', '0bffd2',
'0bff78', '07ff1a', 'e4ff09',
'ffeb03', 'ffa501', 'ff0b00']};
//call function that calculates lst to celsius
function convertToCelsius(image){
var result = image.toFloat().multiply(0.02)
.subtract(273.15);
result = result.copyProperties(image);
return result;
}
//june 2016
//get monthly variables
//lst
var LSTJun = LST.select('LST_Day_1km')
.filterDate(junDate)
.mean()
.clip(WestEur)
var cLSTJun = ee.Image(convertToCelsius(LSTJun))
//ndvi
var NDVIJun = NDVI.filterDate(junDate)
.mean()
.clip(WestEur)
var cNDVIJun = ee.Image(NDVIJun)
//precipitation
var precipJun = Precip.select('precipitationCal')
.filterDate(junDate)
.mean()
.clip(WestEur)
var cPrecipJun = ee.Image(precipJun)
//humidity
var humidityJun = Moisture.select('Qair_f_inst')
.filterDate(junDate)
.mean()
.clip(WestEur)
var cHumidityJun = ee.Image(humidityJun)
//soil moisture
var soilMoistureJun = Moisture.select('SoilMoi0_10cm_inst')
.filterDate(junDate)
.mean()
.clip(WestEur);
var cSoilMoistureJun = ee.Image(soilMoistureJun)
//elevation
var ElevationWestEur = Elevation.clip(WestEur)
var cElevationWestEur = ee.Image(ElevationWestEur)
//normalize environmental variables
var lstnormalizeJun = cLSTJun.expression('((lst - 11.57857421875002) / (41.460000000000036 - 11.57857421875002))',
{'lst': cLSTJun})
var ndvinormalizeJun = cNDVIJun.expression('((ndvi + 0.4753955900669098) / (0.5785678029060364 + 0.4753955900669098))',
{'ndvi': cNDVIJun})
var precipnormalizeJun = cPrecipJun.expression('((precip - 0) / (0.3780468702316284 - 0))',
{'precip': cPrecipJun})
var humiditynormalizeJun = cHumidityJun.expression('((humidity - 0.006033657118678093) / (0.011514261364936829 - 0.006033657118678093))',
{'humidity': cHumidityJun})
var soilMoisturenormalizeJun = cSoilMoistureJun.expression('((soilmoisture - 10.698196411132812) / (40.58652114868164 - 10.698196411132812))',
{'soilmoisture': cSoilMoistureJun})
var elevationnormalizeJun = cElevationWestEur.expression('(((2378 - elevation) / (2258 + 4)))',
{'elevation': cElevationWestEur})
//apply percent contribution weights to environmental variables
var lstJunWeight = lstnormalizeJun.multiply(.202)
var ndviJunWeight = ndvinormalizeJun.multiply(.319)
var precipitationJunWeight = precipnormalizeJun.multiply(.018)
var humidityJunWeight = humiditynormalizeJun.multiply(.289)
var soilMoistureJunWeight = soilMoisturenormalizeJun.multiply(.095)
var elevationJunWeight = elevationnormalizeJun.multiply(.078)
var junWeight = ee.Image.cat([lstJunWeight,
ndviJunWeight,
humidityJunWeight,
soilMoistureJunWeight,
precipitationJunWeight,
elevationJunWeight])
//sum them all together
var junSuit = junWeight.select('LST_Day_1km')
.add(junWeight.select('NDVI'))
.add(junWeight.select('precipitationCal'))
.add(junWeight.select('Qair_f_inst'))
.add(junWeight.select('SoilMoi0_10cm_inst'))
.add(junWeight.select('constant'))
.rename('suitability')
//normalize on a 0 to 1 scale
var junSuitFinal = junSuit.expression('((suitability - 0.24983780631097194) / (0.8433298738762135 - 0.24983780631097194))',
{'suitability': junSuit})
Map.addLayer(junSuitFinal, suitability, 'June Suitability', false)
//july 2016
//lst
var LSTJul = LST.select('LST_Day_1km')
.filterDate(julDate)
.mean()
.clip(WestEur)
var cLSTJul = ee.Image(convertToCelsius(LSTJul))
//ndvi
var NDVIJul = NDVI.filterDate(julDate)
.mean()
.clip(WestEur)
var cNDVIJul = ee.Image(NDVIJul)
//precipitation
var precipJul = Precip.select('precipitationCal')
.filterDate(julDate)
.mean()
.clip(WestEur)
var cPrecipJul = ee.Image(precipJul)
//humidity
var humidityJul = Moisture.select('Qair_f_inst')
.filterDate(julDate)
.mean()
.clip(WestEur)
var cHumidityJul = ee.Image(humidityJul)
//soil moisture
var soilMoistureJul = Moisture.select('SoilMoi0_10cm_inst')
.filterDate(julDate)
.mean()
.clip(WestEur);
var cSoilMoistureJul = ee.Image(soilMoistureJul)
//normalize environmental variables
var lstnormalizeJul = cLSTJul.expression('((lst - 13.503339843750041) / (46.29000000000002 - 13.503339843750041))',
{'lst': cLSTJul})
var ndvinormalizeJul = cNDVIJul.expression('((ndvi + 0.6469473242759705) / (0.6553890109062195 + 0.6469473242759705))',
{'ndvi': cNDVIJul})
var precipnormalizeJul = cPrecipJul.expression('((precip - 0) / (0.5112987160682678 - 0))',
{'precip': cPrecipJul})
var humiditynormalizeJul = cHumidityJul.expression('((humidity - 0.006705486681312323) / (0.013109609484672546 - 0.006705486681312323))',
{'humidity': cHumidityJul})
var soilMoisturenormalizeJul = cSoilMoistureJul.expression('((soilmoisture - 7.428398132324219) / (37.3492317199707 - 7.428398132324219))',
{'soilmoisture': cSoilMoistureJul})
var elevationnormalizeJul = cElevationWestEur.expression('(((2378 - elevation) / (2258 + 4)))',
{'elevation': cElevationWestEur})
//apply percent contribution weights to environmental variables
var lstJulWeight = lstnormalizeJul.multiply(.203)
var ndviJulWeight = ndvinormalizeJul.multiply(.032)
var precipitationJulWeight = precipnormalizeJul.multiply(.028)
var humidityJulWeight = humiditynormalizeJul.multiply(.237)
var soilMoistureJulWeight = soilMoisturenormalizeJul.multiply(.075)
var elevationJulWeight = elevationnormalizeJul.multiply(.426)
var julWeight = ee.Image.cat([lstJulWeight,
ndviJulWeight,
humidityJulWeight,
soilMoistureJulWeight,
precipitationJulWeight,
elevationJulWeight])
//sum them all together
var julSuit = julWeight.select('LST_Day_1km')
.add(julWeight.select('NDVI'))
.add(julWeight.select('precipitationCal'))
.add(julWeight.select('Qair_f_inst'))
.add(julWeight.select('SoilMoi0_10cm_inst'))
.add(julWeight.select('constant'))
.rename('suitability')
//normalize on a 0 to 1 scale
var julSuitFinal = julWeight.expression('((suitability - 0.12426219367584529) / (0.8753980447073735 - 0.12426219367584529))',
{'suitability': julSuit})
Map.addLayer(julSuitFinal, suitability, 'July Suitability', false)
//august 2016
//get monthly variables
//lst
var LSTAug = LST.select('LST_Day_1km')
.filterDate(augDate)
.mean()
.clip(WestEur)
var cLSTAug = ee.Image(convertToCelsius(LSTAug))
//ndvi
var NDVIAug = NDVI.filterDate(augDate)
.mean()
.clip(WestEur)
var cNDVIAug = ee.Image(NDVIAug)
//precipitation
var precipAug = Precip.select('precipitationCal')
.filterDate(augDate)
.mean()
.clip(WestEur)
var cPrecipAug = ee.Image(precipAug)
//humidity
var humidityAug = Moisture.select('Qair_f_inst')
.filterDate(augDate)
.mean()
.clip(WestEur)
var cHumidityAug = ee.Image(humidityAug)
//soil moisture
var soilMoistureAug = Moisture.select('SoilMoi0_10cm_inst')
.filterDate(augDate)
.mean()
.clip(WestEur);
var cSoilMoistureAug = ee.Image(soilMoistureAug)
var aug = ee.Image.cat([cLSTAug, cNDVIAug, cPrecipAug, cHumidityAug, cSoilMoistureAug, cElevationWestEur])
//Map.addLayer(aug, {}, 'aug')
//normalize environmental variables
var lstnormalizeAug = cLSTAug.expression('((lst - 13.756992187500032) / (44.867246093750055 - 13.756992187500032))',
{'lst': cLSTAug})
var ndvinormalizeAug = cNDVIAug.expression('((ndvi + 0.7319386601448059) / (0.6732020974159241 + 0.7319386601448059))',
{'ndvi': cNDVIAug})
var precipnormalizeAug = cPrecipAug.expression('((precip - 0) / (0.39616936445236206 - 0))',
{'precip': cPrecipAug})
var humiditynormalizeAug = cHumidityAug.expression('((humidity - 0.006154877599328756) / (0.013087166473269463 - 0.006154877599328756))',
{'humidity': cHumidityAug})
var soilMoisturenormalizeAug = cSoilMoistureAug.expression('((soilmoisture - 7.925228595733643) / (38.385215759277344 - 7.925228595733643))',
{'soilmoisture': cSoilMoistureAug})
var elevationnormalizeAug = cElevationWestEur.expression('(((2378 - elevation) / (2258 + 4)))',
{'elevation': cElevationWestEur})
//apply percent contribution weights to environmental variables
var lstAugWeight = lstnormalizeAug.multiply(.278)
var ndviAugWeight = ndvinormalizeAug.multiply(.024)
var precipitationAugWeight = precipnormalizeAug.multiply(.017)
var humidityAugWeight = humiditynormalizeAug.multiply(.378)
var soilMoistureAugWeight = soilMoisturenormalizeAug.multiply(.090)
var elevationAugWeight = elevationnormalizeAug.multiply(.213)
var augWeight = ee.Image.cat([lstAugWeight,
ndviAugWeight,
humidityAugWeight,
soilMoistureAugWeight,
precipitationAugWeight,
elevationAugWeight])
//sum them all together
var augSuit = augWeight.select('LST_Day_1km')
.add(augWeight.select('NDVI'))
.add(augWeight.select('precipitationCal'))
.add(augWeight.select('Qair_f_inst'))
.add(augWeight.select('SoilMoi0_10cm_inst'))
.add(augWeight.select('constant'))
.rename('suitability')
//normalize on a 0 to 1 scale
var augSuitFinal = augWeight.expression('((suitability - 0.14409925205809093) / (0.7904174117248721 - 0.14409925205809093))',
{'suitability': augSuit})
Map.addLayer(augSuitFinal, suitability, 'August Suitability', false)
//september 2016
//get monthly variables
//lst
var LSTSep = LST.select('LST_Day_1km')
.filterDate(sepDate)
.mean()
.clip(WestEur)
var cLSTSep = ee.Image(convertToCelsius(LSTSep))
//ndvi
var NDVISep = NDVI.filterDate(sepDate)
.mean()
.clip(WestEur)
var cNDVISep = ee.Image(NDVISep)
//precipitation
var precipSep = Precip.select('precipitationCal')
.filterDate(sepDate)
.mean()
.clip(WestEur)
var cPrecipSep = ee.Image(precipSep)
//humidity
var humiditySep = Moisture.select('Qair_f_inst')
.filterDate(sepDate)
.mean()
.clip(WestEur)
var cHumiditySep = ee.Image(humiditySep)
//soil moisture
var soilMoistureSep = Moisture.select('SoilMoi0_10cm_inst')
.filterDate(sepDate)
.mean()
.clip(WestEur);
var cSoilMoistureSep = ee.Image(soilMoistureSep)
//normalize environmental variables
var lstnormalizeSep = cLSTSep.expression('((lst - 9.970000000000027) / (40.51927734375005 - 9.970000000000027))',
{'lst': cLSTSep})
var ndvinormalizeSep = cNDVISep.expression('((ndvi + 0.6563261151313782) / (0.6044386625289917 + 0.6563261151313782))',
{'ndvi': cNDVISep})
var precipnormalizeSep = cPrecipSep.expression('((precip - 0) / (0.4293142259120941 - 0))',
{'precip': cPrecipSep})
var humiditynormalizeSep = cHumiditySep.expression('((humidity - 0.00562438415363431) / (0.01323721744120121 - 0.00562438415363431))',
{'humidity': cHumiditySep})
var soilMoisturenormalizeSep = cSoilMoistureSep.expression('((soilmoisture - 6.281616687774658) / (40.909549713134766 - 6.281616687774658))',
{'soilmoisture': cSoilMoistureSep})
var elevationnormalizeSep = cElevationWestEur.expression('(((2378 - elevation) / (2258 + 4)))',
{'elevation': cElevationWestEur})
//apply percent contribution weights to environmental variables
var lstSepWeight = lstnormalizeSep.multiply(.336)
var ndviSepWeight = ndvinormalizeSep.multiply(.015)
var precipitationSepWeight = precipnormalizeSep.multiply(.015)
var humiditySepWeight = humiditynormalizeSep.multiply(.263)
var soilMoistureSepWeight = soilMoisturenormalizeSep.multiply(.206)
var elevationSepWeight = elevationnormalizeSep.multiply(.165)
var sepWeight = ee.Image.cat([lstSepWeight,
ndviSepWeight,
humiditySepWeight,
soilMoistureSepWeight,
precipitationSepWeight,
elevationSepWeight])
//sum them all together
var sepSuit = sepWeight.select('LST_Day_1km')
.add(sepWeight.select('NDVI'))
.add(sepWeight.select('precipitationCal'))
.add(sepWeight.select('Qair_f_inst'))
.add(sepWeight.select('SoilMoi0_10cm_inst'))
.add(sepWeight.select('constant'))
.rename('suitability')
//normalize on a 0 to 1 scale
var sepSuitFinal = sepWeight.expression('((suitability - 0.19007236269936886) / (0.751429961425225 - 0.19007236269936886))',
{'suitability': sepSuit})
Map.addLayer(sepSuitFinal, suitability, 'September Suitability', false)
//october 2016
//get monthly variables
//lst
var LSTOct = LST.select('LST_Day_1km')
.filterDate(octDate)
.mean()
.clip(WestEur)
var cLSTOct = ee.Image(convertToCelsius(LSTOct))
//ndvi
var NDVIOct = NDVI.filterDate(octDate)
.mean()
.clip(WestEur)
var cNDVIOct = ee.Image(NDVIOct)
//precipitation
var precipOct = Precip.select('precipitationCal')
.filterDate(octDate)
.mean()
.clip(WestEur)
var cPrecipOct = ee.Image(precipOct)
//humidity
var humidityOct = Moisture.select('Qair_f_inst')
.filterDate(octDate)
.mean()
.clip(WestEur)
var cHumidityOct = ee.Image(humidityOct)
//soil moisture
var soilMoistureOct = Moisture.select('SoilMoi0_10cm_inst')
.filterDate(octDate)
.mean()
.clip(WestEur);
var cSoilMoistureOct = ee.Image(soilMoistureOct)
//normalize environmental variables
var lstnormalizeOct = cLSTOct.expression('((lst - 2.7915429687500364) / (32.04267578125001 - 2.7915429687500364))',
{'lst': cLSTOct})
var ndvinormalizeOct = cNDVIOct.expression('((ndvi + 0.3094300925731659) / (0.4054821729660034 + 0.3094300925731659))',
{'ndvi': cNDVIOct})
var precipnormalizeOct = cPrecipOct.expression('((precip - 0.007964178919792175) / (0.7403478026390076 - 0.007964178919792175))',
{'precip': cPrecipOct})
var humiditynormalizeOct = cHumidityOct.expression('((humidity - 0.003703861264511943) / (0.0115650100633502 - 0.003703861264511943))',
{'humidity': cHumidityOct})
var soilMoisturenormalizeOct = cSoilMoistureOct.expression('((soilmoisture - 11.435077667236328) / (39.074798583984375 - 11.435077667236328))',
{'soilmoisture': cSoilMoistureOct})
var elevationnormalizeOct = cElevationWestEur.expression('(((2378 - elevation) / (2258 + 4)))',
{'elevation': cElevationWestEur})
//apply percent contribution weights to environmental variables
var lstOctWeight = lstnormalizeOct.multiply(.427)
var ndviOctWeight = ndvinormalizeOct.multiply(.001)
var precipitationOctWeight = precipnormalizeOct.multiply(.204)
var humidityOctWeight = humiditynormalizeOct.multiply(.130)
var soilMoistureOctWeight = soilMoisturenormalizeOct.multiply(.068)
var elevationOctWeight = elevationnormalizeOct.multiply(.169)
var octWeight = ee.Image.cat([lstOctWeight,
ndviOctWeight,
humidityOctWeight,
soilMoistureOctWeight,
precipitationOctWeight,
elevationOctWeight])
//sum them all together
var octSuit = octWeight.select('LST_Day_1km')
.add(octWeight.select('NDVI'))
.add(octWeight.select('precipitationCal'))
.add(octWeight.select('Qair_f_inst'))
.add(octWeight.select('SoilMoi0_10cm_inst'))
.add(octWeight.select('constant'))
.rename('suitability')
//normalize on a 0 to 1 scale
var octSuitFinal = octWeight.expression('((suitability - 0.06682992855393113) / (0.7654883093700033 - 0.06682992855393113))',
{'suitability': octSuit})
Map.addLayer(octSuitFinal, suitability, 'October Suitability', false)
//november 2016
//get monthly variables
//lst
var LSTNov = LST.select('LST_Day_1km')
.filterDate(novDate)
.mean()
.clip(WestEur)
var cLSTNov = ee.Image(convertToCelsius(LSTNov))
//ndvi
var NDVINov = NDVI.filterDate(novDate)
.mean()
.clip(WestEur)
var cNDVINov = ee.Image(NDVINov)
//precipitation
var precipNov = Precip.select('precipitationCal')
.filterDate(novDate)
.mean()
.clip(WestEur)
var cPrecipNov = ee.Image(precipNov)
//humidity
var humidityNov = Moisture.select('Qair_f_inst')
.filterDate(novDate)
.mean()
.clip(WestEur)
var cHumidityNov = ee.Image(humidityNov)
//soil moisture
var soilMoistureNov = Moisture.select('SoilMoi0_10cm_inst')
.filterDate(novDate)
.mean()