Project

General

Profile

« Previous | Next » 

Revision a87c0b1d

Added by Jim Regetz almost 13 years ago

  • ID a87c0b1d76577effb571e223a271fdf6d5f8e4c2

added old R script to assess our SRTM holdings

View differences:

terrain/dem/srtm-check.R
1
# Quick exploration and file listing-based comparison of the CGIAR SRTM
2
# tiles available in the following places:
3
#
4
#   - those downloaded by Ming
5
#       jupiter.nceas.ucsb.edu:~organisms/SRTM_90m_ASCII_v4.1/
6
#
7
#   - those downloaded by Rick
8
#       jupiter.nceas.ucsb.edu:~organisms/CgiarSrtmAll/5_5x5_ascii/
9
#
10
#   - those currently available at CGIAR (ASCII format)
11
#       ftp://srtm.csi.cgiar.org/SRTM_v41/SRTM_Data_ArcASCII/
12
#
13
# Note that in addition to the comparisons made below, I also noticed
14
# that a few timestamps on zips Ming downloaded are newer than the
15
# timestamps on the CGIAR ftp site. It appears that these are bad zips
16
# on the CGIAR site; in subsequent email exchange with Ming, he said he
17
# believes he replaced them by downloading the corresponding GeoTIFFs
18
# from CGIAR and converting them to ASCII.
19
#
20
# Jim Regetz
21
# NCEAS
22
# Created on 21-May-2011
23

  
24
# list of tiles Ming downloaded onto jupiter
25
cmd <- "cd ~organisms/SRTM_90m_ASCII_v4.1 && ls -l srtm_*zip"
26
files <- system(cmd, intern=TRUE)
27
jup.v4.1 <- with(read.table(textConnection(files)), data.frame(tile=V8,
28
    size=V5, date=as.Date(V6, format="%Y-%m-%d"), time=V7))
29

  
30
# list of tiles Rick downloaded onto jupiter
31
cmd <- "cd ~organisms/CgiarSrtmAll/5_5x5_ascii && ls -l srtm_*zip"
32
files <- system(cmd, intern=TRUE)
33
jup.5_5x5 <- with(read.table(textConnection(files)), data.frame(tile=V8,
34
    size=V5, date=as.Date(V6, format="%Y-%m-%d"), time=V7))
35

  
36
# current list of tiles at CGIAR ftp site
37
cmd <- "curl ftp://srtm.csi.cgiar.org/SRTM_v41/SRTM_Data_ArcASCII/"
38
files <- system(cmd, intern=TRUE)
39
cgiar <- with(read.table(textConnection(files)), data.frame(tile=V4,
40
    size=V3, date=as.Date(V1, format="%m-%d-%y"), time=V2))
41

  
42
# list CGIAR tiles not found in jup.5_5x5
43
setdiff(cgiar$tile, jup.5_5x5$tile)
44
##  "srtm_32_05.zip" "srtm_68_03.zip"
45

  
46
# list jup.5_5x5 tiles not found in CGIAR (none!)
47
setdiff(jup.5_5x5$tile, cgiar$tile)
48
##  character(0)
49

  
50
# list CGIAR tiles not found in jup.v4.1
51
setdiff(cgiar$tile, jup.v4.1$tile)
52
##  "srtm_65_01.zip" "srtm_65_05.zip" "srtm_65_06.zip" "srtm_65_07.zip"
53
##  "srtm_65_08.zip" "srtm_65_10.zip" "srtm_65_11.zip" "srtm_65_13.zip"
54
##  "srtm_65_15.zip" "srtm_65_16.zip"
55

  
56
# list jup.v4.1 tiles not found in CGIAR (none!)
57
setdiff(jup.v4.1$tile, cgiar$tile)
58
##  character(0)
59

  
60
# show that all common tiles between CGIAR and jup.v4.1 have the same file
61
# size
62
common <- merge(cgiar, jup.v4.1, by="tile")
63
identical(common$size.x, common$size.y)
64
##  [1] TRUE
65

  
66
# but note that three files in jup.v4.1 have different (newer, as it
67
# turns out) timestamps
68
identical(common$date.x, common$date.y)
69
##  [1] FALSE
70
common$tile[common$date.x!=common$date.y]
71
##  "srtm_19_06.zip" "srtm_21_14.zip" "srtm_42_14.zip"
72

  

Also available in: Unified diff