[GRASS-SVN] r48122 - in grass/trunk/scripts: . d.correlate d.polar
db.in.ogr db.out.ogr r.colors.stddev r.out.xyz r.rgb
v.db.renamecolumn v.db.update v.in.geonames
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Sep 5 02:15:16 EDT 2011
Author: mmetz
Date: 2011-09-04 23:15:16 -0700 (Sun, 04 Sep 2011)
New Revision: 48122
Modified:
grass/trunk/scripts/Makefile
grass/trunk/scripts/d.correlate/d.correlate.py
grass/trunk/scripts/d.polar/d.polar.py
grass/trunk/scripts/db.in.ogr/db.in.ogr.py
grass/trunk/scripts/db.out.ogr/db.out.ogr.py
grass/trunk/scripts/r.colors.stddev/r.colors.stddev.py
grass/trunk/scripts/r.out.xyz/r.out.xyz.py
grass/trunk/scripts/r.rgb/r.rgb.py
grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py
grass/trunk/scripts/v.db.update/v.db.update.py
grass/trunk/scripts/v.in.geonames/v.in.geonames.py
Log:
GRASS 7 scripts overhaul cont'd
Modified: grass/trunk/scripts/Makefile
===================================================================
--- grass/trunk/scripts/Makefile 2011-09-05 01:59:39 UTC (rev 48121)
+++ grass/trunk/scripts/Makefile 2011-09-05 06:15:16 UTC (rev 48122)
@@ -69,6 +69,7 @@
# d.out.gpsdrive \
# r.mapcalculator \
+# r.rgb \
# r3.mapcalculator \
# v.in.gps \
Modified: grass/trunk/scripts/d.correlate/d.correlate.py
===================================================================
--- grass/trunk/scripts/d.correlate/d.correlate.py 2011-09-05 01:59:39 UTC (rev 48121)
+++ grass/trunk/scripts/d.correlate/d.correlate.py 2011-09-05 06:15:16 UTC (rev 48122)
@@ -33,7 +33,7 @@
layers = options['map'].split(',')
if len(layers) < 2:
- grass.error("At least 2 layers are required")
+ grass.error("At least 2 maps are required")
tmpfile = grass.tempfile()
Modified: grass/trunk/scripts/d.polar/d.polar.py
===================================================================
--- grass/trunk/scripts/d.polar/d.polar.py 2011-09-05 01:59:39 UTC (rev 48121)
+++ grass/trunk/scripts/d.polar/d.polar.py 2011-09-05 06:15:16 UTC (rev 48122)
@@ -138,7 +138,7 @@
# draw compass text
"color black",
"width 2",
- "size 3 3",
+ "size 10 10",
"move 51 97",
"text N",
"move 51 1",
@@ -150,15 +150,15 @@
# draw legend text
"width 0",
- "size 2",
+ "size 10",
"color 0:180:0",
- "move 1.5 96.5",
+ "move 0.5 96.5",
"text All data (incl. NULLs)",
"color red",
- "move 1.5 93.5",
+ "move 0.5 93.5",
"text Real data angles",
"color blue",
- "move 1.5 90.5",
+ "move 0.5 90.5",
"text Avg. direction"
]
Modified: grass/trunk/scripts/db.in.ogr/db.in.ogr.py
===================================================================
--- grass/trunk/scripts/db.in.ogr/db.in.ogr.py 2011-09-05 01:59:39 UTC (rev 48121)
+++ grass/trunk/scripts/db.in.ogr/db.in.ogr.py 2011-09-05 06:15:16 UTC (rev 48122)
@@ -114,7 +114,7 @@
# get rid of superfluous auto-added cat column (and cat_ if present)
grass.run_command('db.dropcolumn', quiet = True, flags = 'f', table = output,
- colum = 'cat', stdout = nuldev, stderr = nuldev)
+ column = 'cat', stdout = nuldev, stderr = nuldev)
records = grass.db_describe(output)['nrows']
grass.message(_("Imported table <%s> with %d rows") % (output, records))
Modified: grass/trunk/scripts/db.out.ogr/db.out.ogr.py
===================================================================
--- grass/trunk/scripts/db.out.ogr/db.out.ogr.py 2011-09-05 01:59:39 UTC (rev 48121)
+++ grass/trunk/scripts/db.out.ogr/db.out.ogr.py 2011-09-05 06:15:16 UTC (rev 48122)
@@ -74,9 +74,14 @@
if os.path.exists(dbffile) and not grass.overwrite():
grass.fatal(_("File <%s> already exists") % dbffile)
- if grass.run_command('v.out.ogr', quiet = True, input = input, dsn = dsn,
- format = format, type = 'point', olayer = olayer) != 0:
- sys.exit(1)
+ if olayer:
+ if grass.run_command('v.out.ogr', quiet = True, input = input, dsn = dsn,
+ format = format, type = 'point', olayer = olayer) != 0:
+ sys.exit(1)
+ else:
+ if grass.run_command('v.out.ogr', quiet = True, input = input, dsn = dsn,
+ format = format, type = 'point') != 0:
+ sys.exit(1)
if format == "ESRI_Shapefile":
exts = ['shp', 'shx', 'prj']
Modified: grass/trunk/scripts/r.colors.stddev/r.colors.stddev.py
===================================================================
--- grass/trunk/scripts/r.colors.stddev/r.colors.stddev.py 2011-09-05 01:59:39 UTC (rev 48121)
+++ grass/trunk/scripts/r.colors.stddev/r.colors.stddev.py 2011-09-05 06:15:16 UTC (rev 48122)
@@ -99,9 +99,9 @@
s = grass.read_command('r.univar', flags = 'eg', map = map, percentile = [95.45,68.2689,99.7300])
kv = grass.parse_key_val(s)
- stddev1 = float(kv['percentile_68'])
- stddev2 = float(kv['percentile_95'])
- stddev3 = float(kv['percentile_99'])
+ stddev1 = float(kv['percentile_68_2689'])
+ stddev2 = float(kv['percentile_95_45'])
+ stddev3 = float(kv['percentile_99_73'])
if not bands:
# zero centered smooth blue/white/red
Modified: grass/trunk/scripts/r.out.xyz/r.out.xyz.py
===================================================================
--- grass/trunk/scripts/r.out.xyz/r.out.xyz.py 2011-09-05 01:59:39 UTC (rev 48121)
+++ grass/trunk/scripts/r.out.xyz/r.out.xyz.py 2011-09-05 06:15:16 UTC (rev 48122)
@@ -36,11 +36,8 @@
def main():
# if no output filename, output to stdout
output = options['output']
- if output == "" or output == "-":
- outf = sys.stdout
- else:
- outf = file(output)
- ret = grass.run_command("r.stats", flags = "1gn", input = options['input'], fs = options['fs'], stdout = outf)
+
+ ret = grass.run_command("r.stats", flags = "1gn", input = options['input'], fs = options['fs'], output = output)
sys.exit(ret)
if __name__ == "__main__":
Modified: grass/trunk/scripts/r.rgb/r.rgb.py
===================================================================
--- grass/trunk/scripts/r.rgb/r.rgb.py 2011-09-05 01:59:39 UTC (rev 48121)
+++ grass/trunk/scripts/r.rgb/r.rgb.py 2011-09-05 06:15:16 UTC (rev 48122)
@@ -34,7 +34,7 @@
def main():
input = options['input']
- output = options['output']
+ output = options['output_prefix']
if not grass.find_file(input)['file']:
grass.fatal(_("Raster map <%s> not found") % input)
Modified: grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py
===================================================================
--- grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py 2011-09-05 01:59:39 UTC (rev 48121)
+++ grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py 2011-09-05 06:15:16 UTC (rev 48122)
@@ -83,8 +83,8 @@
oldcollength = f[2]
# old col there?
- if not oldcol:
- grass.fatal(_("Column <%s> not found in table <%s>") % (coldcol, table))
+ if not oldcoltype:
+ grass.fatal(_("Column <%s> not found in table <%s>") % (oldcol, table))
# some tricks
if driver in ['sqlite', 'dbf']:
Modified: grass/trunk/scripts/v.db.update/v.db.update.py
===================================================================
--- grass/trunk/scripts/v.db.update/v.db.update.py 2011-09-05 01:59:39 UTC (rev 48121)
+++ grass/trunk/scripts/v.db.update/v.db.update.py 2011-09-05 06:15:16 UTC (rev 48122)
@@ -38,7 +38,7 @@
#%end
#%option G_OPT_DB_COLUMN
#% key: qcolumn
-#% description: Name of attrubute column to query
+#% description: Name of attribute column to query
#%end
#%option G_OPT_DB_WHERE
#%end
Modified: grass/trunk/scripts/v.in.geonames/v.in.geonames.py
===================================================================
--- grass/trunk/scripts/v.in.geonames/v.in.geonames.py 2011-09-05 01:59:39 UTC (rev 48121)
+++ grass/trunk/scripts/v.in.geonames/v.in.geonames.py 2011-09-05 06:15:16 UTC (rev 48122)
@@ -108,25 +108,47 @@
# debug:
# head -n 3 ${TMPFILE}.csv
- columns = ['geonameid integer',
- 'name varchar(200)',
- 'asciiname varchar(200)',
- 'alternatename varchar(4000)',
- 'latitude double precision',
- 'longitude double precision',
- 'featureclass varchar(1)',
- 'featurecode varchar(10)',
- 'countrycode varchar(2)',
- 'cc2 varchar(60)',
- 'admin1code varchar(20)',
- 'admin2code varchar(20)',
- 'admin3code varchar(20)',
- 'admin4code varchar(20)',
- 'population integer',
- 'elevation varchar(5)',
- 'gtopo30 integer',
- 'timezone varchar(50)',
- 'modification date']
+ # use different column names limited to 10 chars for dbf
+ if dbfdriver:
+ columns = ['geonameid integer',
+ 'name varchar(200)',
+ 'asciiname varchar(200)',
+ 'altname varchar(4000)',
+ 'latitude double precision',
+ 'longitude double precision',
+ 'featrclass varchar(1)',
+ 'featrcode varchar(10)',
+ 'cntrycode varchar(2)',
+ 'cc2 varchar(60)',
+ 'admin1code varchar(20)',
+ 'admin2code varchar(20)',
+ 'admin3code varchar(20)',
+ 'admin4code varchar(20)',
+ 'population integer',
+ 'elevation varchar(5)',
+ 'gtopo30 integer',
+ 'timezone varchar(50)',
+ 'mod_date date']
+ else:
+ columns = ['geonameid integer',
+ 'name varchar(200)',
+ 'asciiname varchar(200)',
+ 'alternatename varchar(4000)',
+ 'latitude double precision',
+ 'longitude double precision',
+ 'featureclass varchar(1)',
+ 'featurecode varchar(10)',
+ 'countrycode varchar(2)',
+ 'cc2 varchar(60)',
+ 'admin1code varchar(20)',
+ 'admin2code varchar(20)',
+ 'admin3code varchar(20)',
+ 'admin4code varchar(20)',
+ 'population integer',
+ 'elevation varchar(5)',
+ 'gtopo30 integer',
+ 'timezone varchar(50)',
+ 'modification date']
grass.run_command('v.in.ascii', cat = 0, x = 6, y = 5, fs = '|',
input = tmpfile, output = outfile,
More information about the grass-commit
mailing list