[GRASS-SVN] r64262 - grass-addons/grass7/raster/r.in.srtm.region

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 20 11:52:27 PST 2015


Author: mmetz
Date: 2015-01-20 11:52:27 -0800 (Tue, 20 Jan 2015)
New Revision: 64262

Modified:
   grass-addons/grass7/raster/r.in.srtm.region/r.in.srtm.region.html
   grass-addons/grass7/raster/r.in.srtm.region/r.in.srtm.region.py
Log:
r.in.srtm.region: +import global SRTM v3 1 arcsec

Modified: grass-addons/grass7/raster/r.in.srtm.region/r.in.srtm.region.html
===================================================================
--- grass-addons/grass7/raster/r.in.srtm.region/r.in.srtm.region.html	2015-01-20 19:46:28 UTC (rev 64261)
+++ grass-addons/grass7/raster/r.in.srtm.region/r.in.srtm.region.html	2015-01-20 19:52:27 UTC (rev 64262)
@@ -5,27 +5,31 @@
 patches the tiles together and optionally interpolates holes for 
 SRTM V2.1.
 <p>
-<em>r.in.srtm.region</em> downloads SRTM V3 tiles from:<br>
-<a href="http://e4ftl01.cr.usgs.gov/SRTM/SRTMGL3.003/2000.02.11/">http://e4ftl01.cr.usgs.gov/SRTM/SRTMGL3.003/2000.02.11/</a>
+<em>r.in.srtm.region</em> downloads SRTM V3 tiles at 3 arc seconds 
+resolution from:<br> <a 
+href="http://e4ftl01.cr.usgs.gov/SRTM/SRTMGL3.003/2000.02.11/">http://e4ftl01.cr.usgs.gov/SRTM/SRTMGL3.003/2000.02.11/</a> 
 <br>
+SRTM V3 tiles at 1 arc second 
+resolution from:<br> <a 
+href="http://e4ftl01.cr.usgs.gov/SRTM/SRTMGL1.003/2000.02.11/">http://e4ftl01.cr.usgs.gov/SRTM/SRTMGL3.003/2000.02.11/</a> 
+<br>
 and SRTM V2.1 tiles from:
 <a href="http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/">http://dds.cr.usgs.gov/srtm/</a>
 <br>
 or optionally uses a local folder with previously downloaded files if 
 the <b>local</b> option is given.
 
-<h2>NOTES</h2>
-
-<em>r.in.srtm.region</em> imports only SRTM tiles with 3 arcsec resolution.
-
 <h2>SEE ALSO</h2>
 
 <em>
 <a href="r.in.srtm.html">r.in.srtm</a>
 </em>
-<p>The <a href="http://www2.jpl.nasa.gov/srtm/">Shuttle Radar Topography Mission</a>
+<p>
+The <a href="http://www2.jpl.nasa.gov/srtm/">Shuttle Radar Topography Mission</a>
 homepage at NASA's JPL.
-<br>
+<p>
+The <a href="https://lpdaac.usgs.gov/sites/default/files/public/measures/docs/NASA_SRTM_V3.pdf/">SRTM v3 documentation</a>.
+<p>
 The <a href="http://pub7.bravenet.com/forum/537683448/">SRTM Web Forum</a>
 
 <h2>REFERENCES</h2>

Modified: grass-addons/grass7/raster/r.in.srtm.region/r.in.srtm.region.py
===================================================================
--- grass-addons/grass7/raster/r.in.srtm.region/r.in.srtm.region.py	2015-01-20 19:46:28 UTC (rev 64261)
+++ grass-addons/grass7/raster/r.in.srtm.region/r.in.srtm.region.py	2015-01-20 19:52:27 UTC (rev 64262)
@@ -61,6 +61,10 @@
 #%  label: Import SRTM v2 tiles
 #%  description: Default: Import SRTM v3 tiles
 #%end
+#%flag
+#% key: 1
+#% description: Import 1-arcsec tiles (default: 3-arcsec)
+#%end
 
 
 proj = ''.join([
@@ -81,17 +85,23 @@
 
 import grass.script as grass
 
-def import_local_tile(tile, local, pid, srtmv3):
+def import_local_tile(tile, local, pid, srtmv3, one):
     output = tile + '.r.in.srtm.tmp.' + str(pid)
     if srtmv3:
-        local_tile = str(tile) + '.SRTMGL3.hgt.zip'
+	if one:
+	    local_tile = str(tile) + '.SRTMGL1.hgt.zip'
+	else:
+	    local_tile = str(tile) + '.SRTMGL3.hgt.zip'
     else:
         local_tile = str(tile) + '.hgt.zip'
     
     path = os.path.join(local, local_tile)
     if os.path.exists(path):
 	path = os.path.join(local, local_tile)
-	grass.run_command('r.in.srtm', input = path, output = output, quiet = True)
+	if one:
+	    grass.run_command('r.in.srtm', input = path, output = output, flags = '1', quiet = True)
+	else:
+	    grass.run_command('r.in.srtm', input = path, output = output, quiet = True)
 	return 1
 
     # SRTM subdirs: Africa, Australia, Eurasia, Islands, North_America, South_America
@@ -100,15 +110,21 @@
 
 	if os.path.exists(path):
 	    path = os.path.join(local, srtmdir, local_tile)
-	    grass.run_command('r.in.srtm', input = path, output = output, quiet = True)
+	    if one:
+		grass.run_command('r.in.srtm', input = path, output = output, flags = '1', quiet = True)
+	    else:
+		grass.run_command('r.in.srtm', input = path, output = output, quiet = True)
 	    return 1
 
     return 0
 
-def download_tile(tile, url, pid, srtmv3):
+def download_tile(tile, url, pid, srtmv3, one):
     output = tile + '.r.in.srtm.tmp.' + str(pid)
     if srtmv3:
-        local_tile = str(tile) + '.SRTMGL3.hgt.zip'
+	if one:
+	    local_tile = str(tile) + '.SRTMGL1.hgt.zip'
+	else:
+	    local_tile = str(tile) + '.SRTMGL3.hgt.zip'
     else:
         local_tile = str(tile) + '.hgt.zip'
 
@@ -175,14 +191,23 @@
     memory = options['memory']
     fillnulls = flags['n']
     srtmv3 = (flags['2'] == 0)
+    one = flags['1']
 
+    res = '00:00:03'
     if srtmv3:
         fillnulls = 0
+	if one:
+	    res = '00:00:01'
+    else:
+	one = None
         
     if len(local) == 0:
     	if len(url) == 0:
     	    if srtmv3:
-		url = 'http://e4ftl01.cr.usgs.gov/SRTM/SRTMGL3.003/2000.02.11/'
+		if one:
+		    url = 'http://e4ftl01.cr.usgs.gov/SRTM/SRTMGL1.003/2000.02.11/'
+		else:
+		    url = 'http://e4ftl01.cr.usgs.gov/SRTM/SRTMGL3.003/2000.02.11/'
 	    else:
 		url = 'http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/'
 
@@ -283,11 +308,11 @@
 	    grass.debug("Tile: %s" % tile, debug = 1)
 	    
 	    if local != tmpdir:
-		gotit = import_local_tile(tile, local, pid, srtmv3)
+		gotit = import_local_tile(tile, local, pid, srtmv3, one)
 	    else:
-		gotit = download_tile(tile, url, pid, srtmv3)
+		gotit = download_tile(tile, url, pid, srtmv3, one)
 		if gotit == 1:
-		    gotit = import_local_tile(tile, tmpdir, pid, srtmv3)
+		    gotit = import_local_tile(tile, tmpdir, pid, srtmv3, one)
 	    if gotit == 1:
 		grass.verbose(_("Tile %s successfully imported") % tile)
 		valid_tiles += 1
@@ -314,7 +339,7 @@
 		else:
 		    tmpw = '%03d:59:58.5E' % (edeg - 1)
 
-		grass.run_command('g.region', n = tmpn, s = tmps, e = tmpe, w = tmpw, res = '00:00:03')
+		grass.run_command('g.region', n = tmpn, s = tmps, e = tmpe, w = tmpw, res = res)
 		grass.run_command('r.mapcalc', expression = "%s = 0" % (tile + '.r.in.srtm.tmp.' + str(pid)), quiet = True)
 		grass.run_command('g.region', region = tmpregionname)
 



More information about the grass-commit mailing list