Guest User

Untitled

a guest
Nov 17th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. lulc_2015 <- raster("E:\LandCover_Data\2015_lulc")
  2.  
  3. #Load matrix to be used for reclassification
  4. rec <- read.csv("E:\LandCover_ReclassifyMatrix.csv")
  5.  
  6. #Reclassifying the Raster to convert 70 LC to 15 LC
  7. rc <- as.matrix(data.frame(from=rec$V2, to=rec$To))
  8.  
  9. New_LULC_2015 <- reclassify(lulc_2015,rc)
  10.  
  11. New_LULC_2015 <- ratify(New_LULC_2015)
  12. rat <- data.frame(
  13. ID= 1:15,
  14. LandCover = c("Evergreen","Deciduous","Mixed Forest",
  15. "grass","Degraded Forest","Scrubland",
  16. "Dry Grassland","Wet Grassland","Plantation",
  17. "Settlement","High Elevation Plantation","Coastal",
  18. "Barren Land","Cropland","Wetlands")
  19. )
  20.  
  21. levels(New_LULC_2015)<- rat
  22.  
  23. # Resampled raster to achieve same resolution as other data
  24. Resam_LC <- resample(agg_modal, newelev, method='ngb')
  25.  
  26. > Resam_LC
  27. class : RasterLayer
  28. dimensions : 642, 382, 245244 (nrow, ncol, ncell)
  29. resolution : 1000, 1000 (x, y)
  30. extent : 461951, 843951, 892583.3, 1534583 (xmin, xmax, ymin, ymax)
  31. coord. ref. : +proj=utm +zone=43 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
  32. data source : in memory
  33. names : layer
  34. values : 1, 15 (min, max)
  35. attributes :
  36. ID LandCover
  37. from: 1 Evergreen
  38. to : 15 Wetlands
  39.  
  40. > raster(Resam_LC@data@attributes[[1]]$ID==1)
  41. Error in (function (classes, fdef, mtable) :
  42. unable to find an inherited method for function ‘raster’ for signature
  43. ‘"logical"’
Add Comment
Please, Sign In to add comment