Guest User

Untitled

a guest
Mar 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. # Get a list of sds names
  2. sds <- get_subdatasets('C:\Users\Thomas\Desktop\NASA Sat Data\Cloud Layer Data\CAL_LID_L2_333mCLay-ValStage1-V3-01.2011-08-16T03-02-01ZN.hdf')
  3.  
  4. # Isolate name of subdataset and convert
  5. name <- sds[25]
  6. filename <- 'Cloud_Top_Height_Test.tif'
  7. gdal_translate(name, dst_dataset = filename)
  8.  
  9. # Load the Geotiff created into R
  10. r <- raster(filename)
  11.  
  12. # fix extent, projection and negative values
  13. e <- extent(-80.016243, 64.831413, -179.183868, -1.711731)
  14. r <- setExtent(r, e)
  15. values(r)[values(r) < 0] = 0 # replace -9999 with NA
  16. crs(r) <- '+proj=utm +zone=28 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'
Add Comment
Please, Sign In to add comment