Last active
February 6, 2020 17:21
-
-
Save twnawrocki/4a02b33619008c696e598e2fc24a593e to your computer and use it in GitHub Desktop.
This script charts the mean Normalized Difference Vegetation Index (NDVI) using the MODIS data collection for the period of June 1-15 from 2000 to 2019 within generalized calving areas of the Western Arctic Herd, Teshekpuk Herd, Central Arctic Herd, and Porcupine Herd. This script was created as an example of wildlife-related applications of Goo…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* -*- coding: utf-8 -*- | |
--------------------------------------------------------------------------- | |
Summary Chart of NDVI Trends in Calving Grounds for Four Arctic Caribou Herds | |
Author: Timm Nawrocki, Alaska Center for Conservation Science | |
Last Updated: 2020-02-05 | |
Usage: Must be executed from the Google Earth Engine code editor. | |
Description: This script charts the mean Normalized Difference Vegetation Index (NDVI) using | |
the MODIS data collection for the period of June 1-15 from 2000 to 2019 within generalized | |
calving areas of the Western Arctic Herd, Teshekpuk Herd, Central Arctic Herd, and Porcupine | |
Herd. This script was created as an example of wildlife-related applications of Google Earth | |
Engine in Alaska. | |
---------------------------------------------------------------------------*/ | |
// Define the calving areas | |
var calving_central = ee.FeatureCollection("users/twnawrocki/CentralCalvingRange") | |
.first() | |
.geometry(); | |
var calving_porcupine = ee.FeatureCollection("users/twnawrocki/PorcupineCalvingRange") | |
.first() | |
.geometry(); | |
var calving_teshekpuk = ee.FeatureCollection("users/twnawrocki/TeshekpukCalvingRange") | |
.first() | |
.geometry(); | |
var calving_western = ee.FeatureCollection("users/twnawrocki/WesternCalvingRange") | |
.first() | |
.geometry(); | |
// Define new feature collection that includes all herds | |
var regions = ee.FeatureCollection([ | |
ee.Feature(calving_western, {label: 'Western Arctic Herd'}), | |
ee.Feature(calving_teshekpuk, {label: 'Teshekpuk Herd'}), | |
ee.Feature(calving_central, {label: 'Central Arctic Herd'}), | |
ee.Feature(calving_porcupine, {label: 'Porcupine Herd'}) | |
]); | |
// Define the MODIS image collection | |
var collection = ee.ImageCollection('MODIS/006/MOD13Q1'); | |
print('Image Collection: ', collection); | |
// Filter the collection to specific dates | |
var collection_june = collection.filter( | |
ee.Filter.calendarRange(152, 166, 'day_of_year') | |
); | |
// Visualize NDVI for 2019 | |
var dataset = collection_june.filter( | |
ee.Filter.calendarRange(2019, 2019, 'year') | |
); | |
var ndvi = dataset.select('NDVI'); | |
var ndviVis = { | |
min: 0.0, | |
max: 10000.0, | |
palette: [ | |
'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', | |
'66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', | |
'012E01', '011D01', '011301' | |
], | |
}; | |
Map.setCenter(-153, 69.5, 6); | |
Map.addLayer(ndvi, ndviVis, 'NDVI'); | |
Map.addLayer(regions); | |
// Create and print chart for NDVI over time for four herds | |
var herds_chart = ui.Chart.image.seriesByRegion( | |
collection_june, | |
regions, | |
ee.Reducer.mean(), | |
'NDVI', | |
100, // Reduce Scale | |
'system:time_start', | |
'label') | |
.setOptions({ | |
title: 'Trend of early June mean NDVI per year for four arctic caribou herds from 2000 to 2019', | |
vAxis: {title: 'Mean Early June NDVI'}, | |
hAxis: {title: 'Year'}, | |
lineWidth: 2, | |
pointSize: 4, | |
series: { | |
0: {color: '00429D'}, // Western Arctic Herd | |
1: {color: '73A2C6'}, // Teshekpuk Herd | |
2: {color: 'F4777F'}, // Central Arctic Herd | |
3: {color: '93003A'} // Porcupine Herd | |
} | |
} | |
); | |
// Display chart | |
print(herds_chart); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment