SHARE
TWEET

Untitled

a guest May 23rd, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. library(sf)
  2. library(raster)
  3.  
  4. system('s3cmd --force get s3://silviaterra-brian/TCSI/us_140bps1.tif /tmp/')
  5. system('s3cmd --force sync s3://silviaterra-brian/TCSI/TCSI_Region_BPSMask.csv /tmp/TCSI_mask.csv')
  6.  
  7.  
  8. rast <- raster('/tmp/us_140bps1.tif')
  9.  
  10. keyTable <- read.csv('/tmp/TCSI_mask.csv')
  11.  
  12. keyTable$VALUE
  13. allCodes <- unique(rast)
  14. forestCodes <- unique(as.numeric(as.character(keyTable$VALUE)))
  15.  
  16.  
  17. fNf <- rast
  18.  
  19. values(fNf) <- values(fNf) %in% forestCodes
  20.  
  21. writeRaster(fNf, '/tmp/tcsi-fnf.tif')
  22.  
  23. system('s3cmd put /tmp/tcsi-fnf.tif s3://silviaterra-delivery/TCSI/')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top