[GRASS-SVN] r71263 - grass-addons/grass7/raster/r.modis/r.modis.download
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 14 02:09:00 PDT 2017
Author: lucadelu
Date: 2017-07-14 02:09:00 -0700 (Fri, 14 Jul 2017)
New Revision: 71263
Modified:
grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.html
grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py
Log:
r.modis.download: fixed user and password parameters
Modified: grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.html
===================================================================
--- grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.html 2017-07-13 14:08:32 UTC (rev 71262)
+++ grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.html 2017-07-14 09:09:00 UTC (rev 71263)
@@ -25,13 +25,28 @@
</ul>
<p>
In order to download the desired MODIS product(s), the username and password must be
-provided through the <em>settings</em> option. There are two ways: either pass a file
-in which the first row is the username, and the second row is the password, as showed below:
+provided through the <em>settings</em> option. There are three ways:
+<ul>
+<li>
+using the <a href="https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html" target="_blank">.netrc</a>
+file as showed below:
<div class="code"><pre>
+machine e4ftl01.cr.usgs.gov
+login your_NASA_username
+password your_NASA_password
+</pre></div>
+</li>
+<li>
+pass a file in which the first row is the username, and the second row is the password, as showed below:
+<div class="code"><pre>
your_NASA_username
your_NASA_password
</pre></div>
-or, the user can pass the values from the standard input when prompted.
+</li>
+<li>
+the user can pass the values from the standard input when prompted.
+</li>
+</ul>
<p>
<b>Warning</b>: As per NASA policy no more than ten simultaneous connections
Modified: grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py
===================================================================
--- grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py 2017-07-13 14:08:32 UTC (rev 71262)
+++ grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py 2017-07-14 09:09:00 UTC (rev 71263)
@@ -40,8 +40,8 @@
#%end
#%option G_OPT_F_INPUT
#% key: settings
-#% label: Full path to settings file or '-' for standard input
-#% required: yes
+#% label: Full path to settings file or '-' for standard input, empty for .netrc file
+#% required: no
#% guisection: Define
#%end
#%option
@@ -172,7 +172,15 @@
prod.print_prods()
return 0
# set username, password and folder if settings are insert by stdin
- if options['settings'] == '-':
+ if not options['settings']:
+ user = None
+ passwd = None
+ if check(options['folder']):
+ fold = options['folder']
+ else:
+ grass.fatal(_("Set folder parameter when using stdin for passing "
+ "the username and password"))
+ elif options['settings'] == '-':
if options['folder'] != '':
import getpass
if check(options['folder']):
@@ -182,7 +190,6 @@
else:
grass.fatal(_("Set folder parameter when using stdin for passing "
"the username and password"))
- return 0
# set username, password and folder by file
else:
# open the file and read the the user and password:
@@ -191,8 +198,8 @@
if check(options['settings']):
filesett = open(options['settings'], 'r')
fileread = filesett.readlines()
- user = 'anonymous'
- passwd = fileread[0].strip()
+ user = fileread[0].strip()
+ passwd = fileread[1].strip()
filesett.close()
else:
grass.fatal(_("File <%s> not found") % options['settings'])
More information about the grass-commit
mailing list