Revision 190750cf
Added by Jim Regetz about 13 years ago
- ID 190750cf08ff1f4fa88a7940d7a1f828f5e002aa
terrain/dem/aster-check.R | ||
---|---|---|
16 | 16 |
# coordinates |
17 | 17 |
check <- function(tilename, path=".", silent=TRUE) { |
18 | 18 |
# build expected filename |
19 |
origin <- round(GDALinfo(file.path(path, tilename),
|
|
19 |
origin <- round(GDALinfo(path.expand(file.path(path, tilename)),
|
|
20 | 20 |
silent=silent)[c("ll.x", "ll.y")]) |
21 | 21 |
ly <- origin["ll.y"] |
22 | 22 |
y <- sprintf("%s%02d", if (ly>=0) "N" else "S", abs(ly)) |
... | ... | |
33 | 33 |
|
34 | 34 |
# produce vector of check results, with the actual file names as vector |
35 | 35 |
# element names (takes ~12 minutes on eos) |
36 |
aster.tiles <- list.files("~organisms/DEM/asterGdem",
|
|
37 |
pattern="^ASTGTM.*_dem.tif$")
|
|
38 |
tilecheck <- sapply(aster.tiles, check) |
|
36 |
aster.dir <- "~organisms/DEM/asterGdem"
|
|
37 |
aster.tiles <- list.files(aster.dir, pattern="^ASTGTM.*_dem.tif$")
|
|
38 |
tilecheck <- sapply(aster.tiles, check, path=aster.dir)
|
|
39 | 39 |
|
40 | 40 |
# report mismatches |
41 | 41 |
data.frame(expected=tilecheck[tilecheck!="TRUE"]) |
Also available in: Unified diff
tweaked aster-check script to work from anywhere