[GRASS-SVN] r41369 - in grass/branches/develbranch_6/scripts:
d.rast.leg db.droptable m.proj r.regression.line
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Mar 9 01:38:46 EST 2010
Author: hamish
Date: 2010-03-09 01:38:45 -0500 (Tue, 09 Mar 2010)
New Revision: 41369
Modified:
grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg
grass/branches/develbranch_6/scripts/db.droptable/db.droptable
grass/branches/develbranch_6/scripts/m.proj/m.proj
grass/branches/develbranch_6/scripts/r.regression.line/r.regression.line
Log:
OSX compatibility (trac #991)
Modified: grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg
===================================================================
--- grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg 2010-03-09 05:42:47 UTC (rev 41368)
+++ grass/branches/develbranch_6/scripts/d.rast.leg/d.rast.leg 2010-03-09 06:38:45 UTC (rev 41369)
@@ -112,10 +112,6 @@
g.message -e "Raster map '$GIS_OPT_MAP' not found in mapset search path"
exit 1
fi
-filemapset="${mapset}"
-# would it be better to search for cats/ file ??
-eval `g.gisenv`
-HISTFILEDIR=$GISDBASE/$LOCATION_NAME/$filemapset/cell_misc/
eval `r.info -t "$GIS_OPT_MAP"`
# for rast=
Modified: grass/branches/develbranch_6/scripts/db.droptable/db.droptable
===================================================================
--- grass/branches/develbranch_6/scripts/db.droptable/db.droptable 2010-03-09 05:42:47 UTC (rev 41368)
+++ grass/branches/develbranch_6/scripts/db.droptable/db.droptable 2010-03-09 06:38:45 UTC (rev 41369)
@@ -85,7 +85,7 @@
fi
# check if table is used somewhere (connected to vector map)
-USEDINMAPS=`grep "$table" "$GISDBASE/$LOCATION_NAME"/*/vector/*/dbln | sed -e 's+/dbln:.*$++g' -e 's+^.*/++'`
+USEDINMAPS=`grep -l "$table" "$GISDBASE/$LOCATION_NAME"/*/vector/*/dbln | sed -e 's+/dbln$++g' -e 's+^.*/++'`
if [ -n "$USEDINMAPS" ] ; then
g.message -w "Deleting <$table> table which is attached to following map(s):"
for i in $USEDINMAPS ; do
Modified: grass/branches/develbranch_6/scripts/m.proj/m.proj
===================================================================
--- grass/branches/develbranch_6/scripts/m.proj/m.proj 2010-03-09 05:42:47 UTC (rev 41368)
+++ grass/branches/develbranch_6/scripts/m.proj/m.proj 2010-03-09 06:38:45 UTC (rev 41369)
@@ -208,7 +208,7 @@
done
# make sure we have at least one line of data
- if [ "`wc -l "$TEMPFILE" | cut -f1 -d' '`" -eq 0 ] ; then
+ if [ `cat "$TEMPFILE" | wc -l` -eq 0 ] ; then
g.message -e "Problem reading data from stdin"
exit 1
fi
Modified: grass/branches/develbranch_6/scripts/r.regression.line/r.regression.line
===================================================================
--- grass/branches/develbranch_6/scripts/r.regression.line/r.regression.line 2010-03-09 05:42:47 UTC (rev 41368)
+++ grass/branches/develbranch_6/scripts/r.regression.line/r.regression.line 2010-03-09 06:38:45 UTC (rev 41369)
@@ -110,13 +110,21 @@
awk '{tot += $3;sumX +=$1 * $3; sumsqX +=$1*$1*$3;sumY +=$2 * $3; sumsqY +=$2*$2*$3;\
sumXY +=$1*$2*$3;\
}\
-END {B=(sumXY - sumX*sumY/tot)/(sumsqX - sumX*sumX/tot);\
-R= (sumXY - sumX*sumY/tot)/((sumsqX - sumX^2/tot)*(sumsqY - sumY^2/tot))^0.5;\
-mediaX=sumX/tot;sumsqX=sumsqX/tot;varX=sumsqX-(mediaX^2);sdX=varX^0.5;\
-mediaY=sumY/tot;sumsqY=sumsqY/tot;varY=sumsqY-(mediaY^2);sdY=varY^0.5;\
-A=mediaY - B*mediaX; F= R^2/(1-R^2/tot-2);\
+END {B = (sumXY - sumX*sumY/tot)/(sumsqX - sumX*sumX/tot); \
+R = (sumXY - sumX*sumY/tot)/((sumsqX - sumX^2/tot)*(sumsqY - sumY^2/tot))^0.5; \
+mediaX = sumX/tot; sumsqX=sumsqX/tot; varX=sumsqX-(mediaX^2); sdX=varX^0.5; \
+mediaY = sumY/tot; sumsqY=sumsqY/tot; varY=sumsqY-(mediaY^2); sdY=varY^0.5; \
+A = mediaY - B*mediaX; \
+F = R^2/(1-R^2/tot-2); \
print A, B, R, tot, F, mediaX, sdX, mediaY, sdY}' "$TEMPFILE" > "$TEMPFILE"b
+#if( sumsqX == sumX^2/tot ) { B = NaN; }
+#else { B = (sumXY - sumX*sumY/tot)/(sumsqX - sumX*sumX/tot); }
+#
+#if( sumsqY == sumY^2/tot ) { R = NaN; }
+#else { R = (sumXY - sumX*sumY/tot)/((sumsqX - sumX^2/tot)*(sumsqY - sumY^2/tot))^0.5; }
+
+
echo "a b R N F medX sdX medY sdY" | tr -s ' ' '\n' > "$TEMPFILE"d
cat "$TEMPFILE"b | tr -s ' ' '\n' > "$TEMPFILE"e
More information about the grass-commit
mailing list