Wednesday, April 20, 2022

Google Earth Engine (GEE) Normalized Difference Vegetation Index (NDVI) For MODIS

Normalized Difference Vegetation Index (NDVI) in Google Earth Engine (GEE) for MODIS Data:

Here we will be doing satellite image processing by Google Earth Engine (GEE), the first of we will Normalized Difference Vegetation Index (NDVI) for MODIS Data using Google Earth Engine (GEE)

We've put the whole process of this NDVI on YouTube, and the programming code is given below to make the process easier.

YouTube Link: https://youtu.be/hVUMpvTlYNA

Code:

-------------------------------------------------------------------------------------------------------

var dataset = ee.ImageCollection('LANDSAT/LC08/C01/T1_8DAY_NDVI') .filterDate('2017-01-01', '2017-12-31'); var colorized = dataset.select('NDVI'); print(colorized) var ndvi=colorized.reduce(ee.Reducer.mean()); print(ndvi) var ndvi_crop=ndvi.clip(geometry); var colorizedVis = { min: 0.0, max: 1.0, palette: [ 'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301' ], }; Map.setCenter(87.45, 21.55, 12); Map.addLayer(ndvi_crop, colorizedVis, 'Colorized'); Export.image.toDrive({ image: ndvi_crop, description: 'avg_NDVI_2017', scale: 30, maxPixels: 1e13, });

-------------------------------------------------------------------------------------------------------------

We hope you find this code useful. Stay tuned with us to find out and learn new things like this. If there is any problem you can let us know by commenting below or contacting us.


Monday, April 18, 2022

R for Basic Image Processing (Landsat Image) Part 1

 Basic Image Processing using R-Programing (Landsat Image):

Here we will be doing satellite image processing by R-programming, the first of the basic satellite image processing we will layer stack the satellite image using R-programming. 

We've put the whole process of this layer stack on YouTube, and the programming code is given below to make the process easier.

YouTube Link: https://youtu.be/_nCUUBKKHsg

---------------------------------------------------------------------------------------------

Code:

#To install packages

install.packages("raster")

install.packages("rgdal")


#Add Library

library(raster)     #raster

library(rgdal)      #vector


#Read and plot data (LANDSAT 5 Data)

a<-"D:/Landsat_image/LT05_L1TP_139046_20050303/LT05_L1TP_139046_20050303_20161128_

01_T1_B1.TIF"

a

??raster

a1<-raster(a)

a1


a4<-raster("D:/Landsat_image/LT05_L1TP_139046_20050303/LT05_L1TP_139046_20050303_2

0161128_01_T1_B4.TIF")

a4

?plot

plot(a4)

?dim

dim(a4) #dimension of data, row, column and band



#Set Working directory

setwd("D:/Landsat_image/LT05_L1TP_139046_20050303")

getwd()




#Read bulk data

bands<-list.files(pattern=".TIF")

bands

bands[[2]]      # select layer2 from list


band2<-raster(bands[[2]])



#Layer stack; band selection; plot

sfcc<-stack(bands[1],bands[2],bands[3],bands[4],bands[5],bands[7])

sfcc

sfcc[[4]]      # select layer 4 from stack

plot(sfcc[[3]])

plotRGB(sfcc, 4,3,2)

plotRGB(sfcc, 4,3,2, stretch='lin')

?plotRGB

?writeRaster

writeRaster(sfcc, "Landsat_5.tif", format="GTiff", datatype='INT1U', overwrite=TRUE)



#READ LANDSAT 8 Data

setwd("D:/Landsat_image/LC08_L1TP_139046_20150227")

getwd()


#Read bulk data

bands<-list.files(pattern=".TIF")

bands

bands[[4]]      # select Blue band from list




#Layer stack; band selection; plot

sfcc<-stack(bands[4],bands[5],bands[6],bands[7])

sfcc

sfcc[[4]]      # select layer 4 from stack

plot(sfcc[[4]])

plotRGB(sfcc, 4,3,2)

plotRGB(sfcc, 4,3,2, scale=65535)

plotRGB(sfcc, 4,3,2, scale=65535, stretch='lin')

writeRaster(sfcc, "Landsat_8.tif", 

            format="GTiff", datatype='INT2U', overwrite=TRUE)



L8<-brick("Landsat_8.tif")

L8

--------------------------------------------------------------------------------------------

We hope you find this code useful. Stay tuned with us to find out and learn new things like this. If there is any problem you can let us know by commenting below or contacting us.