-
Notifications
You must be signed in to change notification settings - Fork 58
/
NDSI.m
41 lines (37 loc) · 1.18 KB
/
NDSI.m
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
function ndsi = NDSI( green,swir )
%NDSI calculate Normalized Difference Snow Index (NDSI) using Green and
% SWIR bands.
% Syntax
%
% ndsi = NDSI(green,swir)
%
% Description
%
% This function calculates Normalized Difference Snow Index (NDSI)
% using Green and SWIR bands (as following equation). This can be used
% to detect snow, as the atmosphere is transparent at both these
% wavelengths, while snow is very reflective at 0.66 mm and not
% reflective at 1.6mm. At visible wavelengths (e.g. 0.66 microns), snow
% cover is just as bright as clouds, and is therefore difficult to
% distinguish from cloud cover. However, at 1.6 microns, snow cover
% absorbs sunlight, and therefore appears much darker than clouds.
%
% NDSI=(Green-SWIR)/(Green+SWIR).
%
% Input arguments
%
% green Green band
% swir Short-wave infrared band
%
% Output arguments
%
% ndsi Normalized Difference Snow Index
%
%
% Author: Shi Qiu (shi.qiu@ttu.edu)
% Date: 19. October, 2017
% calculate NDSI
ndsi=(green-swir)./(green+swir);
% fix unnormal pixels
ndsi((green+swir)==0)=0.01;
end