Skip to content

Commit

Permalink
added readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gagantalreja committed Apr 21, 2019
1 parent d1df356 commit 9cee161
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 75 deletions.
42 changes: 5 additions & 37 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,16 @@
from rasterio.plot import show
#import rasterio.plot as plt #import show
import matplotlib.pyplot as plt
from matplotlib import colors
import numpy as np
import pandas as pd
plt.style.use('seaborn-deep')


class MidpointNormalize(colors.Normalize):

def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):
self.midpoint = midpoint
colors.Normalize.__init__(self, vmin, vmax, clip)

def __call__(self, value, clip=None):

x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1]
return np.ma.masked_array(np.interp(value, x, y), np.isnan(value))


def index(b2, b1):

logor = lambda x, y: np.logical_or(x>0, y>0)
calc = lambda x, y, ch: np.where(ch, (x-y)/(x+y), 0)

#calculating NDVI
np.seterr(divide='ignore', invalid='ignore')
ind = calc(b1, b2, logor(b2, b1))
print(ind.min(), ind.max())
return ind


Expand All @@ -46,7 +29,7 @@ def plot_hist(plot_percent, dates, d):
p = list(plot_percent[i])
ax.bar(ind, p, bottom = bottom, width = 0.35, label = d[i])
bottom = [bottom[i]+p[i] for i in range(len(p))]
ax.legend().set_draggable(True)

ax.set_xticks(ind, minor=False)
ax.set_xticklabels(dates)
ax.set_title('Percent Area Cover for years {} \n'.format(', '.join(dates[:-1])+' and ' + dates[-1]))
Expand Down Expand Up @@ -103,7 +86,6 @@ def calc_table(ind, x, y, d):

area.append(round(tot_area, 3))
perc.append(100)
#df = pd.DataFrame({'Area(in m2)': area, 'Percentage Area': perc})
return (perc, area)

def diff_table(ind_arr, bands, dates, d):
Expand Down Expand Up @@ -151,7 +133,6 @@ def diff_table(ind_arr, bands, dates, d):
date.append(str(last[i]))
date.append('100%')
df_dict['Total Area'] = date
print(df_dict)
dfres = pd.DataFrame(df_dict)

dfres.to_excel('result.xlsx')
Expand All @@ -168,7 +149,7 @@ def calc_diff(l, ch):
bands.append([l[i][0].read(1), l[i][1].read(1),
l[i][2].read(1), l[i][3].read(1), trans[0], -trans[4]])

bands = list(map(lambda x: [i.astype(float) for i in x[:4]]+[x[4], x[5]], bands))


if ch==1:
ind_arr = [index(band[1], band[2]) for band in bands]
Expand All @@ -190,7 +171,7 @@ def calc_diff(l, ch):

date_dict = plot_diff_util(ind_arr, bands, years, ch)

colormap = plt.cm.RdYlGn


while 1:

Expand All @@ -199,9 +180,9 @@ def calc_diff(l, ch):
mid = ind.mean()
minx=np.nanmin(ind)
maxx=np.nanmax(ind)
norm = MidpointNormalize(vmin=minx, vmax=maxx, midpoint=mid)

ax = plt.subplot(121)
ax.imshow(ind, cmap=colormap, vmin=minx, vmax=maxx, norm=norm)
ax.imshow(ind, cmap=colormap, vmin=minx, vmax=maxx)
ax.set_title('YEAR: {}'.format(date))
ax1 = plt.subplot(122)
ax1.imshow(band)
Expand All @@ -222,17 +203,4 @@ def calc_diff(l, ch):
l = sorted(l, key = lambda x:x[4])
calc_diff(l, ch)


'''
lsat/15/b3.tif lsat/15/b4.tif lsat/15/b5.tif lsat/15/b6.tif 2015
lsat/19/b3.tif lsat/19/b4.tif lsat/19/b5.tif lsat/19/b6.tif 2019
img1/8/b2.tif img1/8/b3.tif img1/8/b4.tif img1/8/b5.tif 2008
img1/11/b2.tif img1/11/b3.tif img1/11/b4.tif img1/11/b5.tif 2011
img1/12/b2.tif img1/12/b3.tif img1/12/b4.tif img1/12/b5.tif 2012
img1/13/b2.tif img1/13/b3.tif img1/13/b4.tif img1/13/b5.tif 2013
img1/14/b2.tif img1/14/b3.tif img1/14/b4.tif img1/14/b5.tif 2014
img1/15/b2.tif img1/15/b3.tif img1/15/b4.tif img1/15/b5.tif 2015
img1/16/b2.tif img1/16/b3.tif img1/16/b4.tif img1/16/b5.tif 2016
'''

41 changes: 3 additions & 38 deletions lst.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@
import numpy as np
from matplotlib import colors
import seaborn as sns
sns.set()

class MidpointNormalize(colors.Normalize):

def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):
self.midpoint = midpoint
colors.Normalize.__init__(self, vmin, vmax, clip)

def __call__(self, value, clip=None):

x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1]
return np.ma.masked_array(np.interp(value, x, y), np.isnan(value))


normalize = lambda array: ((array - array.min())/(array.max() - array.min()))
Expand All @@ -35,26 +23,7 @@ def get_index(green, red, nir, swir):

def get_LST(thermal, sat_name):

if sat_name == 7:
ml = 6.7087E-02
al = -0.06709
l_max = 17.040
l_min = 0.000
qcal_max = 255
qcal_min = 1
k1 = 666.09
k2 = 1282.71

else:
ml = 3.3420E-04
al = 0.10000
l_max = 22.00180
l_min = 0.10033
qcal_max = 65535
qcal_min = 1
k1 = 774.8853
k2 = 1321.0789

#k1, k2 qcal, ml, al values acquired from landsat data
L_lambda = ml * thermal + al
temp_cel = k2 / np.log(k1/L_lambda + 1) - 273.15
return temp_cel
Expand All @@ -78,7 +47,7 @@ def show_corr(temp, l):
print(e)
pass
temp = [i.mean() for i in temp]
print(temp, ndvi, ndwi, ndbi)

ax = plt.subplot(131)
ax.plot(temp, ndvi, marker = 'o')
ax.set_title('LST vs NDVI')
Expand Down Expand Up @@ -116,11 +85,7 @@ def calc_everything(l):
temp = calc_everything(l)
show_corr(temp, l)

'''
lsat/00/b2.tif lsat/00/b3.tif lsat/00/b4.tif lsat/00/b5.tif lsat/00/b6.tif 7 2000
lsat/15/b3.tif lsat/15/b4.tif lsat/15/b5.tif lsat/15/b6.tif lsat/15/b10.tif 8 2015
lsat/19/b3.tif lsat/19/b4.tif lsat/19/b5.tif lsat/19/b6.tif lsat/19/b10.tif 8 2019
'''




44 changes: 44 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# README
## About geoStudy

- Remote sensing is the process of detecting and monitoring the physical traits of an area by measuring its reflected and emitted radiation at a distance from the targeted area. It is the acquisition of information about an object without making any physical contact with it. The data used in remote sensing can be categorized based on their resolution, electromagnetic spectrum, energy source, imaging media and number of bands. We decided to extract features like vegetation, water and built-up using the different indices like NDVI, NDWI and NDBI.

- We decided to make a software that can be used calculate different features from satellite imagery. The software allows you to select raster imagery and find as well as compare the changes in different indices over a period of time. The software can also be used to study the effect of change in vegetation, water and built-up on Land Surface Temperature of the selected region.

## An Insight

- **Home Screen**

![image](screenshots/1.png)


- **NDVI Plot and False Color Composite of uploaded Raster Image**

![image](screenshots/2.png)



- **Area Cover Analysis of uploaded Raster Image**

![image](screenshots/3.png)


- **Percentage Area Cover for uploaded Images**

![image](screenshots/5.png)



- **Graph showing effect of change in all three indices on Land Surface Temperature**

![image](screenshots/4.png)



- The data was acquired from the [USGS portal](https://earthexplorer.usgs.gov) of NASA and [Bhuvan portal](https://bhuvan-app3.nrsc.gov.in/data/download/index.php) of ISRO

- Find project video on: [YouTube](https://youtu.be/qfo3D78Pezc)




Binary file added screenshots/1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/3.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/4.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/5.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9cee161

Please sign in to comment.