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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Nov 26 07:34:56 PST 2016


Author: neteler
Date: 2016-11-26 07:34:56 -0800 (Sat, 26 Nov 2016)
New Revision: 69925

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 addon: add single tile support; explain new USGS user authentication

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	2016-11-26 15:14:16 UTC (rev 69924)
+++ grass-addons/grass7/raster/r.in.srtm.region/r.in.srtm.region.html	2016-11-26 15:34:56 UTC (rev 69925)
@@ -17,6 +17,15 @@
   the <b>local</b> option is given.</li>
 </ul>
 
+Importantly, for the SRTM tiles download a user registration is needed at
+<a href="https://urs.earthdata.nasa.gov/users/new">https://urs.earthdata.nasa.gov/users/new</a>
+<p>
+In the user profile, two specific applications must be approved in the "My application" tab:
+<ul>
+<li>LP DAAC Data Pool, and</li>
+<li>Earthdata Search</li>
+</ul>
+
 <h2>NOTES</h2>
 
 This module only operates in LatLong locations.

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	2016-11-26 15:14:16 UTC (rev 69924)
+++ grass-addons/grass7/raster/r.in.srtm.region/r.in.srtm.region.py	2016-11-26 15:34:56 UTC (rev 69925)
@@ -215,6 +215,8 @@
     srtmv3 = (flags['2'] == 0)
     one = flags['1']
 
+    overwrite = grass.overwrite()
+
     res = '00:00:03'
     if srtmv3:
         fillnulls = 0
@@ -262,7 +264,7 @@
     # get extents
     reg = grass.region()
     tmpregionname = 'r_in_srtm_tmp_region'
-    grass.run_command('g.region', save = tmpregionname)
+    grass.run_command('g.region', save = tmpregionname, overwrite=overwrite)
     if options['region'] is None or options['region'] == '':
 	north = reg['n']
 	south = reg['s']
@@ -387,9 +389,12 @@
     grass.run_command('g.region', raster = str(srtmtiles));
     
     if fillnulls == 0:
-	grass.run_command('r.patch', input = srtmtiles, output = output)
+        if valid_tiles > 1:
+            grass.run_command('r.patch', input = srtmtiles, output = output)
+        else:
+            grass.run_command('g.rename', raster = '%s,%s' % (srtmtiles, output ), quiet = True)
     else:
-	ncells = grass.region()['cells'] 
+        ncells = grass.region()['cells'] 
 	if long(ncells) > 1000000000:
 	    grass.message(_("%s cells to interpolate, this will take some time") % str(ncells), flag = 'i')
 	grass.run_command('r.patch', input = srtmtiles, output = output + '.holes')



More information about the grass-commit mailing list