[GRASS-SVN] r72933 - in grass-addons/grass7/raster/r.green: libgreen r.green.biomassfor/libforest r.green.biomassfor/r.green.biomassfor.co2 r.green.biomassfor/r.green.biomassfor.financial r.green.biomassfor/r.green.biomassfor.impact r.green.biomassfor/r.green.biomassfor.legal r.green.biomassfor/r.green.biomassfor.recommended r.green.biomassfor/r.green.biomassfor.technical r.green.biomassfor/r.green.biomassfor.theoretical r.green.gshp/libgshp r.green.gshp/libgshp/testsuite r.green.gshp/r.green.gshp.technical r.green.gshp/r.green.gshp.theoretical r.green.hydro/libhydro r.green.hydro/r.green.hydro.closest r.green.hydro/r.green.hydro.delplants r.green.hydro/r.green.hydro.discharge r.green.hydro/r.green.hydro.financial r.green.hydro/r.green.hydro.optimal r.green.hydro/r.green.hydro.planning r.green.hydro/r.green.hydro.recommended r.green.hydro/r.green.hydro.structure r.green.hydro/r.green.hydro.technical r.green.hydro/r.green.hydro.theoretical r.green.install
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jun 29 08:24:12 PDT 2018
Author: zarch
Date: 2018-06-29 08:24:12 -0700 (Fri, 29 Jun 2018)
New Revision: 72933
Modified:
grass-addons/grass7/raster/r.green/libgreen/checkparameter.py
grass-addons/grass7/raster/r.green/libgreen/utils.py
grass-addons/grass7/raster/r.green/r.green.biomassfor/libforest/financial.py
grass-addons/grass7/raster/r.green/r.green.biomassfor/libforest/harvesting.py
grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.co2/r.green.biomassfor.co2.py
grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.financial/r.green.biomassfor.financial.py
grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.impact/r.green.biomassfor.impact.py
grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.legal/r.green.biomassfor.legal.py
grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.recommended/r.green.biomassfor.recommended.py
grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.technical/biomasfor.technical.py
grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.technical/r.green.biomassfor.technical.py
grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.theoretical/r.green.biomassfor.theoretical.py
grass-addons/grass7/raster/r.green/r.green.gshp/libgshp/ashrae.py
grass-addons/grass7/raster/r.green/r.green.gshp/libgshp/testsuite/test_gpot.py
grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.technical/r.green.gshp.technical.py
grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.theoretical/r.green.gshp.theoretical.py
grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/basin.py
grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/optimal.py
grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/plant.py
grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.closest/r.green.hydro.closest.py
grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.delplants/r.green.hydro.delplants.py
grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.discharge/r.green.hydro.discharge.py
grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py
grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.optimal/r.green.hydro.optimal.py
grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.planning/r.green.hydro.planning.py
grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.recommended/r.green.hydro.recommended.py
grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.structure/r.green.hydro.structure.py
grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.technical/r.green.hydro.technical.py
grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py
grass-addons/grass7/raster/r.green/r.green.install/r.green.install.py
Log:
Sort python imports
Modified: grass-addons/grass7/raster/r.green/libgreen/checkparameter.py
===================================================================
--- grass-addons/grass7/raster/r.green/libgreen/checkparameter.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/libgreen/checkparameter.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from grass.exceptions import ParameterError
+from grass.pygrass.messages import get_msgr
+from grass.pygrass.raster import RasterRow
from grass.pygrass.vector import VectorTopo
-from grass.pygrass.raster import RasterRow
-from grass.pygrass.messages import get_msgr
def check_required_columns(vname, layer, reqcols, pname):
Modified: grass-addons/grass7/raster/r.green/libgreen/utils.py
===================================================================
--- grass-addons/grass7/raster/r.green/libgreen/utils.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/libgreen/utils.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -1,15 +1,18 @@
# -*- coding: utf-8 -*-
-import numpy as np
import os
-#import pdb
+import numpy as np
+
+from grass.pygrass.gis.region import Region
+from grass.pygrass.raster import RasterRow
+from grass.pygrass.raster.buffer import Buffer
+from grass.script import core as gcore
# import grass libraries
from grass.script import mapcalc
-from grass.script import core as gcore
-from grass.pygrass.raster import RasterRow
-from grass.pygrass.raster.buffer import Buffer
-from grass.pygrass.gis.region import Region
+#import pdb
+
+
try:
from scipy.sparse import csr_matrix
except ImportError:
Modified: grass-addons/grass7/raster/r.green/r.green.biomassfor/libforest/financial.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.biomassfor/libforest/financial.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.biomassfor/libforest/financial.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -13,9 +13,9 @@
#############################################################################
#
import os
-from grass.script.core import find_file
-from grass.script.core import run_command
+
from grass.pygrass.modules.shortcuts import raster as r
+from grass.script.core import find_file, run_command
def revenues(opts, yield_surface, m1t1, m1t2, m1, m2,
Modified: grass-addons/grass7/raster/r.green/r.green.biomassfor/libforest/harvesting.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.biomassfor/libforest/harvesting.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.biomassfor/libforest/harvesting.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -14,11 +14,12 @@
#
import os
+
import numpy as np
+from grass.pygrass.modules.shortcuts import raster as r
from grass.pygrass.raster import RasterRow
from grass.script.core import run_command
-from grass.pygrass.modules.shortcuts import raster as r
def combination(management, treatment):
Modified: grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.co2/r.green.biomassfor.co2.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.co2/r.green.biomassfor.co2.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.co2/r.green.biomassfor.co2.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -251,14 +251,15 @@
#% description: Remove all operational maps
#%end
+import pdb
+
+import numpy as np
+
import grass.script as grass
-from grass.script.core import run_command, parser,overwrite, read_command
from grass.pygrass.messages import get_msgr
-import numpy as np
from grass.pygrass.raster import RasterRow
-import pdb
+from grass.script.core import overwrite, parser, read_command, run_command
-
ow = overwrite()
Modified: grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.financial/r.green.biomassfor.financial.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.financial/r.green.biomassfor.financial.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.financial/r.green.biomassfor.financial.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -344,13 +344,13 @@
#% guisection: Output maps
#%end
-from grass.script.core import run_command, parser, warning
+import atexit
+import os
+
from grass.pygrass.modules.shortcuts import raster as r
-from grass.pygrass.utils import set_path
+from grass.script.core import parser, run_command, warning
+from grass.script.utils import set_path
-import os
-import atexit
-
try:
# set python path to the shared r.green libraries
set_path('r.green', 'libforest', '..')
Modified: grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.impact/r.green.biomassfor.impact.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.impact/r.green.biomassfor.impact.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.impact/r.green.biomassfor.impact.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -375,14 +375,15 @@
#% description: Remove all operational maps
#%end
+import pdb
+
+import numpy as np
+
import grass.script as grass
-from grass.script.core import run_command, parser,overwrite, read_command
from grass.pygrass.messages import get_msgr
-import numpy as np
from grass.pygrass.raster import RasterRow
-import pdb
+from grass.script.core import overwrite, parser, read_command, run_command
-
ow = overwrite()
Modified: grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.legal/r.green.biomassfor.legal.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.legal/r.green.biomassfor.legal.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.legal/r.green.biomassfor.legal.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -93,13 +93,12 @@
#% guisection: Energy
#%end
-from grass.script.core import run_command, parser, overwrite
-from grass.pygrass.raster import RasterRow
import numpy as np
+from grass.pygrass.raster import RasterRow
+from grass.script.core import overwrite, parser, run_command
-
def main(opts, flgs):
ow = overwrite()
Modified: grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.recommended/r.green.biomassfor.recommended.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.recommended/r.green.biomassfor.recommended.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.recommended/r.green.biomassfor.recommended.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -100,12 +100,14 @@
#% guisection: Energy
#%end
-from grass.script.core import run_command, parser,overwrite
-from grass.pygrass.raster import RasterRow
-import numpy as np
+import pdb
import string
-import pdb
+import numpy as np
+
+from grass.pygrass.raster import RasterRow
+from grass.script.core import overwrite, parser, run_command
+
#check_var checks the presence/absence of the input maps
check_var=0
Modified: grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.technical/biomasfor.technical.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.technical/biomasfor.technical.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.technical/biomasfor.technical.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -110,10 +110,8 @@
#% key: u
#% description: technical bioenergy can be considered to be spread uniformly over the entire surface or to be concentrated in accessible areas.
#%end
-from grass.script.core import run_command, parser, overwrite
+from grass.script.core import overwrite, parser, run_command
-
-
#CCEXTR = 'cable_crane_extraction = if(yield>0 && slope>%f && slope<=%f && extr_dist<%f, 1)'
#FWEXTR = 'forwarder_extraction = if(yield>0 && slope<=%f && management==1 && (roughness==0 || roughness==1 || roughness==99999) && extr_dist<%f, 1)'
#OEXTR = 'other_extraction = if(yield>0 && slope<=%f && management==2 && (roughness==0 || roughness==1 || roughness==99999) && extr_dist<%f, 1)'
Modified: grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.technical/r.green.biomassfor.technical.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.technical/r.green.biomassfor.technical.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.technical/r.green.biomassfor.technical.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -185,12 +185,12 @@
#%end
+import numpy as np
+
import grass.script as grass
-from grass.script.core import run_command, parser, overwrite, parse_command
from grass.pygrass.raster import RasterRow
-import numpy as np
+from grass.script.core import overwrite, parse_command, parser, run_command
-
YPIX = 'yield_pix = yield_pix1*%d + yield_pix2*%d'
Modified: grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.theoretical/r.green.biomassfor.theoretical.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.theoretical/r.green.biomassfor.theoretical.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.biomassfor/r.green.biomassfor.theoretical/r.green.biomassfor.theoretical.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -93,13 +93,12 @@
#% guisection: Energy
#%end
-from grass.script.core import run_command, parser, overwrite
-from grass.pygrass.raster import RasterRow
import numpy as np
+from grass.pygrass.raster import RasterRow
+from grass.script.core import overwrite, parser, run_command
-
def main(opts, flgs):
ow = overwrite()
Modified: grass-addons/grass7/raster/r.green/r.green.gshp/libgshp/ashrae.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.gshp/libgshp/ashrae.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.gshp/libgshp/ashrae.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -10,13 +10,10 @@
from numpy import log, pi
-# import grass libraries
+from grass.pygrass.utils import get_mapset_raster
+from grass.script import core as gcore
from grass.script import raster as grast
-from grass.script import core as gcore
-from grass.pygrass.utils import get_mapset_raster
-
-
BASENAME = 'tmprgreen{pid:05d}_'.format(pid=getpid())
# Coefficients for Tp correlation
Modified: grass-addons/grass7/raster/r.green/r.green.gshp/libgshp/testsuite/test_gpot.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.gshp/libgshp/testsuite/test_gpot.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.gshp/libgshp/testsuite/test_gpot.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -5,18 +5,19 @@
"""
from __future__ import (absolute_import, division, generators, nested_scopes,
print_function, unicode_literals, with_statement)
+
import os
from numpy.testing import assert_almost_equal
+import gpot as gpot
from grass.gunittest.case import TestCase
+from grass.gunittest.gmodules import call_module
from grass.gunittest.main import test
-from grass.gunittest.gmodules import call_module
+# ==================================================================
+# Start testing the library
+from grass.pygrass.raster import RasterRow
-
-import gpot as gpot
-
-
# ==================================================================
# Define value and results to be tested as scalar and as raster
GRND_CONDUCTIVITY = [2.17, 2.48, 2.66, 3.39, 4.13, 4.87]
@@ -45,9 +46,6 @@
GROUT_CONDUCTIVITY = 2.
-# ==================================================================
-# Start testing the library
-from grass.pygrass.raster import RasterRow
def assert_raster_no_difference(reference, actual, precision):
Modified: grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.technical/r.green.gshp.technical.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.technical/r.green.gshp.technical.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.technical/r.green.gshp.technical.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
############################################################################
@@ -289,13 +289,12 @@
from __future__ import print_function
+import atexit
import os
import sys
-import atexit
-# import grass libraries
from grass.script import core as gcore
-from grass.pygrass.utils import set_path
+from grass.script.utils import set_path
try:
# set python path to the shared r.green libraries
Modified: grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.theoretical/r.green.gshp.theoretical.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.theoretical/r.green.gshp.theoretical.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.theoretical/r.green.gshp.theoretical.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
############################################################################
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/basin.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/basin.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/basin.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -14,21 +14,26 @@
#############################################################################
#
+import itertools
+import math
# import system libraries
import os
import numpy as np
-import itertools
-import math
-#import pdb
-
+from grass.pygrass.messages import get_msgr
from grass.pygrass.vector import VectorTopo
from grass.script import core as gcore
-from grass.pygrass.messages import get_msgr
from grass.script import mapcalc
-from grass.pygrass.utils import set_path
+from grass.script.utils import set_path
+# finally import the module in the library
+from libgreen.utils import (dissolve_lines, get_coo, raster2compressM,
+ raster2numpy)
+#import pdb
+
+
+
try:
from scipy import integrate
except ImportError:
@@ -37,11 +42,6 @@
set_path('r.green', 'libhydro', '..')
set_path('r.green', 'libgreen', os.path.join('..', '..'))
-# finally import the module in the library
-from libgreen.utils import dissolve_lines
-from libgreen.utils import raster2numpy
-from libgreen.utils import raster2compressM
-from libgreen.utils import get_coo
def discharge_sum(list_basin, list_ID):
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/optimal.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/optimal.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/optimal.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -6,18 +6,26 @@
"""
# import system libraries
from __future__ import print_function
+
+import math
import os
import sys
import numpy as np
-import math
+#from grass.pygrass.raster.buffer import Buffer
+from grass.pygrass.gis.region import Region
+from grass.pygrass.messages import get_msgr
+from grass.pygrass.raster import RasterRow
+from grass.pygrass.vector import VectorTopo
+from grass.script import core as gcore
+#from grass.pygrass.raster.buffer import Buffer
+from grass.script.utils import set_path
+from libhydro.plant import COLS, COLS_points, Intake, Plant, Restitution
+
#from grass.script import mapcalc
version = 70 # 71
-from grass.script import core as gcore
-from grass.pygrass.messages import get_msgr
-from grass.pygrass.raster import RasterRow
# import scientific libraries
try:
@@ -28,21 +36,11 @@
gcore.warning('You should install scipy to use this module: '
'pip install scipy')
-#from grass.pygrass.raster.buffer import Buffer
-from grass.pygrass.gis.region import Region
-from grass.pygrass.vector import VectorTopo
-#from grass.pygrass.raster.buffer import Buffer
-from grass.pygrass.utils import set_path
set_path('r.green', 'libhydro', '..')
set_path('r.green', 'libgreen', os.path.join('..', '..'))
-from libhydro.plant import Plant
-from libhydro.plant import Intake
-from libhydro.plant import Restitution
-from libhydro.plant import COLS
-from libhydro.plant import COLS_points
def f(x, *params):
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/plant.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/plant.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/plant.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -1,19 +1,18 @@
# -*- coding: utf-8 -*-
+import os
import random
-import os
from collections import namedtuple
import numpy as np
+from grass.pygrass import utils
+from grass.pygrass.gis.region import Region
from grass.pygrass.modules.shortcuts import raster as r
-from grass.pygrass.gis.region import Region
from grass.pygrass.vector import VectorTopo
from grass.pygrass.vector.geometry import Line
from grass.pygrass.vector.table import Link
-from grass.pygrass import utils
from grass.script import core as gcore
-
COLS = [(u'cat', 'INTEGER PRIMARY KEY'),
(u'plant_id', 'VARCHAR(10)'),
(u'stream_id', 'INTEGER'),
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.closest/r.green.hydro.closest.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.closest/r.green.hydro.closest.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.closest/r.green.hydro.closest.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -44,12 +44,10 @@
import os
import sys
-# import grass libraries
-from grass.script import core as gcore
from grass.pygrass.messages import get_msgr
from grass.pygrass.vector import VectorTopo
+from grass.script import core as gcore
-
if "GISBASE" not in os.environ:
print("You must be in GRASS GIS to run this program.")
sys.exit(1)
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.delplants/r.green.hydro.delplants.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.delplants/r.green.hydro.delplants.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.delplants/r.green.hydro.delplants.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -94,19 +94,18 @@
#%end
from __future__ import print_function
+import atexit
# import stadard libraries
import os
-import atexit
# import GRASS libraries
from grass.exceptions import ParameterError
-from grass.script.core import parser, overwrite, warning
+from grass.pygrass.modules.shortcuts import vector as v
+from grass.pygrass.raster import RasterRow
from grass.pygrass.vector import VectorTopo
-from grass.pygrass.raster import RasterRow
-from grass.pygrass.modules.shortcuts import vector as v
-from grass.pygrass.utils import set_path
+from grass.script.core import overwrite, parser, warning
+from grass.script.utils import set_path
-
try:
# set python path to the shared r.green libraries
set_path('r.green', 'libhydro', '..')
@@ -136,7 +135,7 @@
rother = ['kind_label', 'discharge', 'id_point', 'id_plant']
ovwr = overwrite()
- try:
+ try:
hydro = check_required_columns(opts['hydro'], int(opts['hydro_layer']),
rhydro, 'hydro')
if opts['other']:
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.discharge/r.green.hydro.discharge.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.discharge/r.green.hydro.discharge.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.discharge/r.green.hydro.discharge.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -160,18 +160,20 @@
#% answer: 100000
#%END
+import atexit
# import system libraries
import os
import sys
-import atexit
-#import pdb
+from grass.pygrass.messages import get_msgr
+from grass.script import core as gcore
# import grass libraries
-from grass.script import core as gcore
-from grass.pygrass.messages import get_msgr
-from grass.pygrass.utils import set_path
from grass.script import mapcalc
+from grass.script.utils import set_path
+#import pdb
+
+
try:
# set python path to the shared r.green libraries
set_path('r.green', 'libhydro', '..')
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -485,7 +485,7 @@
## VALUES
#%option G_OPT_R_OUTPUT
#% key: upper
-#% label: Output raster map with the value upper part of the soil
+#% label: Output raster map with the value upper part of the soil
#% required: no
#%end
@@ -492,23 +492,23 @@
#############################################################################
from __future__ import print_function
+import atexit
import os
import sys
-import atexit
+
import numpy as np
+
from grass.exceptions import ParameterError
-from grass.script.core import parser, overwrite, warning, run_command
+from grass.pygrass.gis.region import Region
+from grass.pygrass.messages import get_msgr
from grass.pygrass.modules.shortcuts import raster as r
from grass.pygrass.modules.shortcuts import vector as v
-
-from grass.pygrass.utils import set_path
+from grass.pygrass.vector import geometry as geo
from grass.pygrass.vector import VectorTopo, sql
from grass.pygrass.vector.basic import Cats
-from grass.pygrass.vector import geometry as geo
-from grass.pygrass.gis.region import Region
+from grass.script.core import overwrite, parser, run_command, warning
+from grass.script.utils import set_path
-from grass.pygrass.messages import get_msgr
-
#from grass.script import mapcalc
version = 70 # 71
@@ -601,7 +601,7 @@
def get_cnames(expr,
_names_cache=ne.utils.CacheDict(256) if ne else ne,
- _numexpr_cache=ne.utils.CacheDict(256) if ne else ne,
+ _numexpr_cache=ne.utils.CacheDict(256) if ne else ne,
**kwargs):
if not isinstance(expr, (str, unicode)):
raise ValueError("must specify expression as a string")
@@ -811,7 +811,7 @@
category.reset()
category.set(ncat, loutput)
# write geometry
- vout.write(line)
+ vout.write(line, set_cats=False)
ncat += 1
vout.table.conn.commit()
@@ -921,9 +921,9 @@
comp = opts['compensation'] if opts['compensation'] else ('tmprgreen_%i_compensation' % pid)
exc = opts['excavation'] if opts['excavation'] else ('tmprgreen_%i_excavation' % pid)
vlayer = int(opts['struct_layer'])
-
+
plant, mset = (opts['plant'].split('@') if '@' in opts['plant'] else (opts['plant'], ''))
-
+
struct, mset = (opts['struct'].split('@') if '@' in opts['struct'] else (opts['struct'], ''))
# read common scalar parameters
@@ -1089,18 +1089,18 @@
eco_layer=1, seg_layer=int(opts['plant_layer']),
eco_pid=opts['struct_column_id'],
seg_pid=opts['plant_column_id'],
- function=max_NPV,
- exclude=['intake_id', 'side', 'power',
+ function=max_NPV,
+ exclude=['intake_id', 'side', 'power',
'gross_head', 'discharge'])
- vec = VectorTopo(opts['output_struct'])
+ vec = VectorTopo(opts['output_struct'])
vec.open('rw')
vec.table.columns.add('max_NPV','VARCHAR(3)')
-
- list_intakeid=list(set(vec.table.execute('SELECT intake_id FROM %s' %vec.table.name).fetchall()))
-
- for i in range(0,len(list_intakeid)):
- vec.rewind()
+
+ list_intakeid=list(set(vec.table.execute('SELECT intake_id FROM %s' %vec.table.name).fetchall()))
+
+ for i in range(0,len(list_intakeid)):
+ vec.rewind()
list_npv=list(vec.table.execute('SELECT NPV FROM %s WHERE intake_id=%i;' % (vec.table.name, list_intakeid[i][0])).fetchall())
npvmax=max(list_npv)[0]
for line in vec:
@@ -1110,7 +1110,7 @@
else:
line.attrs['max_NPV']='no'
- vec.table.conn.commit()
+ vec.table.conn.commit()
vec.close()
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.optimal/r.green.hydro.optimal.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.optimal/r.green.hydro.optimal.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.optimal/r.green.hydro.optimal.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -99,13 +99,11 @@
import os
import sys
-# import grass libraries
-from grass.script import core as gcore
#from grass.script import mapcalc
from grass.pygrass.messages import get_msgr
-
+from grass.script import core as gcore
#from grass.pygrass.raster.buffer import Buffer
-from grass.pygrass.utils import set_path
+from grass.script.utils import set_path
try:
# set python path to the shared r.green libraries
@@ -166,7 +164,7 @@
c = flags['c']
msgr = get_msgr()
#import ipdb; ipdb.set_trace()
-
+
if c:
msgr.message("\Clean rivers\n")
TMPVECT = [("tmprgreen_%i_cleanb" % os.getpid())]
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.planning/r.green.hydro.planning.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.planning/r.green.hydro.planning.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.planning/r.green.hydro.planning.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -186,25 +186,25 @@
#%end
#%rules
-#%exclusive: mfd, discharge_natural
-#%exclusive: mfd, percentage
-#%requires: discharge_natural, percentage
+#%exclusive: mfd, discharge_natural
+#%exclusive: mfd, percentage
+#%requires: discharge_natural, percentage
#%end
# import system libraries
from __future__ import print_function
+
+import atexit
import os
import sys
-import atexit
-# import grass libraries
-from grass.script import core as gcore
-from grass.pygrass.utils import set_path
from grass.pygrass.messages import get_msgr
from grass.pygrass.vector import VectorTopo
+from grass.script import core as gcore
+# import grass libraries
from grass.script import mapcalc
+from grass.script.utils import set_path
-
try:
# set python path to the shared r.green libraries
set_path('r.green', 'libhydro', '..')
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.recommended/r.green.hydro.recommended.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.recommended/r.green.hydro.recommended.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.recommended/r.green.hydro.recommended.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -186,25 +186,25 @@
#%end
#%rules
-#%exclusive: mfd, discharge_natural
-#%exclusive: mfd, percentage
-#%requires: discharge_natural, percentage
+#%exclusive: mfd, discharge_natural
+#%exclusive: mfd, percentage
+#%requires: discharge_natural, percentage
#%end
# import system libraries
from __future__ import print_function
+
+import atexit
import os
import sys
-import atexit
-# import grass libraries
-from grass.script import core as gcore
-from grass.pygrass.utils import set_path
from grass.pygrass.messages import get_msgr
from grass.pygrass.vector import VectorTopo
+from grass.script import core as gcore
+# import grass libraries
from grass.script import mapcalc
+from grass.script.utils import set_path
-
try:
# set python path to the shared r.green libraries
set_path('r.green', 'libhydro', '..')
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.structure/r.green.hydro.structure.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.structure/r.green.hydro.structure.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.structure/r.green.hydro.structure.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -129,15 +129,17 @@
#%end
from __future__ import print_function
+import atexit
import os
-import atexit
from grass.exceptions import ParameterError
-from grass.script.core import parser, overwrite, warning
-from grass.pygrass.utils import set_path
from grass.pygrass.raster import RasterRow
+from grass.script.core import overwrite, parser, warning
+from grass.script.utils import set_path
+from libgreen.checkparameter import check_required_columns, exception2error
+from libhydro.optimal import conv_segpoints
+from libhydro.plant import read_plants, write_structures
-
try:
# set python path to the shared r.green libraries
set_path('r.green', 'libhydro', '..')
@@ -151,9 +153,6 @@
except ImportError:
warning('libgreen and libhydro not in the python path!')
-from libhydro.optimal import conv_segpoints
-from libgreen.checkparameter import check_required_columns, exception2error
-from libhydro.plant import read_plants, write_structures
def main(opts, flgs):
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.technical/r.green.hydro.technical.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.technical/r.green.hydro.technical.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.technical/r.green.hydro.technical.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -220,19 +220,19 @@
# import system libraries
from __future__ import print_function
+
+import atexit
import os
import sys
-import atexit
+from math import acos, asin, log10, pi, sin, sqrt
-# import grass libraries
-from grass.script import core as gcore
+import numpy as np
+from grass.pygrass.messages import get_msgr
from grass.pygrass.utils import set_path
-from grass.pygrass.messages import get_msgr
from grass.pygrass.vector import VectorTopo
+from grass.script import core as gcore
-from math import pi, log10, sin, acos, asin, sqrt
-
try:
from scipy.optimize import fsolve
except ImportError:
@@ -239,7 +239,6 @@
gcore.warning('You should install scipy to use this module: '
'pip install scipy')
-import numpy as np
try:
# set python path to the shared r.green libraries
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -90,15 +90,14 @@
from __future__ import print_function
+import atexit
# import system libraries
import os
import sys
-import atexit
-# import grass libraries
+from grass.pygrass.messages import get_msgr
from grass.script import core as gcore
-from grass.pygrass.messages import get_msgr
-from grass.pygrass.utils import set_path
+from grass.script.utils import set_path
try:
# set python path to the shared r.green libraries
@@ -151,7 +150,7 @@
lakes = options['lakes'] # vec
E = options['output']
threshold = options['threshold']
-
+
# existing plants
# segments = options['segments']
# output_segm = options['output_segm']
@@ -174,7 +173,7 @@
if rivers:
# cp the vector in the current mapset in order to clean it
- tmp_river = "tmprgreen_%i_river" % pid
+ tmp_river = "tmprgreen_%i_river" % pid
to_copy = '%s,%s' % (rivers, tmp_river)
gcore.run_command('g.copy', vector=to_copy)
rivers = tmp_river
Modified: grass-addons/grass7/raster/r.green/r.green.install/r.green.install.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.install/r.green.install.py 2018-06-29 15:23:06 UTC (rev 72932)
+++ grass-addons/grass7/raster/r.green/r.green.install/r.green.install.py 2018-06-29 15:24:12 UTC (rev 72933)
@@ -30,29 +30,25 @@
# import system libraries
from __future__ import print_function
+
+import imp
import os
-from os.path import join
-from urllib2 import build_opener
+import platform
+import shutil
+import subprocess
import sys
-import imp
-from tempfile import gettempdir
import time
-import subprocess
-import shutil
-
-from HTMLParser import HTMLParser
-from htmlentitydefs import name2codepoint
import urllib2
import xml.etree.ElementTree as ET
-
from collections import namedtuple
-import platform
+from htmlentitydefs import name2codepoint
+from HTMLParser import HTMLParser
+from os.path import join
+from tempfile import gettempdir
+from urllib2 import build_opener
-
-# import grass libraries
from grass.script import core as gcore
-
Pkg = namedtuple('Pkg', ['name', 'version', 'py', 'un', 'platform'])
More information about the grass-commit
mailing list