Skip to content

Commit

Permalink
move-spam-files
Browse files Browse the repository at this point in the history
  • Loading branch information
kauedesousa committed Jan 30, 2024
1 parent 7be2431 commit 0106024
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ token/api-key.txt
data/wc2.1-global
ecocrop-raw
ecocrop
data/SPAM

24 changes: 24 additions & 0 deletions script/01.1-move-spam-files.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
library("geodata")

from = "/Users/kauedesousa/local-workflow/geo-raster-shapefile/spam2010v2r0_global_harv_area/"

here = "data/SPAM/"

crops = read.csv("data/mapspam-crop-names.csv")

crops = toupper(crops$spamname)

identifier = paste(crops, collapse = "|")

files = list.files(from, pattern = identifier, full.names = TRUE)

f = grep("H.tif$|A.tif$", files)

f = files[f]

n = gsub(from, "", f)

file.copy(f, paste0(here, n))



0 comments on commit 0106024

Please sign in to comment.