GRASS GIS | 19 Dec 23:09 2014

[GRASS GIS] #2512: r.out.gdal wrongly messes with SetColorInterpretation

#2512: r.out.gdal wrongly messes with SetColorInterpretation
------------------------+---------------------------------------------------
 Reporter:  rouault     |       Owner:  grass-dev <at> …              
     Type:  defect      |      Status:  new                      
 Priority:  normal      |   Milestone:  6.4.5                    
Component:  Raster      |     Version:  svn-trunk                
 Keywords:  r.out.gdal  |    Platform:  All                      
      Cpu:  All         |  
------------------------+---------------------------------------------------
 r.out.gdal export_band.c currently contains

 {{{
     CPLPushErrorHandler(CPLQuietErrorHandler);
     GDALSetRasterColorInterpretation(hBand, GPI_RGB);
     CPLPopErrorHandler();
 }}}

 This is a wrong usage of the GDAL API. GDALSetRasterColorInterpretation()
 expects an enumerated value from the GDALColorInterp enumeration, whereas
 GPI_RGB is a value from the GDALPaletteInterp enumeration. Consequently,
 due to the fact that GPI_RGB = 1 and GCI_GrayIndex=1, the above snippet
 will effectively force the color interpreation to be Gray level.

 On GeoTIFF this was without effect before GDAL 1.11, since in those
 versions, SetColorInterpration() in the GeoTIFF driver has no effect. But
 in GDAL 1.11, the SetColorInterpration() in the GeoTIFF driver can modify
 the default PHOTOMETRIC TIFF tag. For example, for a 3 band GeoTIFF file,
 at creation time, the GeoTIFF driver defaults to PHOTOMETRIC=RGB, but if
 later, SetRasterColorInterpretation(GCI_GrayIndex) is called, it will undo
 that setting to fallback to PHOTOMETRIC=MINISBLACK.
(Continue reading)

Yann Chemin | 18 Dec 08:12 2014
Picon

Invitation to submit an abstract to EGU 2015 session on FOSS for GeoInformatics and Geosciences

Hi all,

Anybody interested to submit some new development,
please submit an abstract there:
http://www.egu2015.eu/abstract_management/how_to_submit_an_abstract.html

The Session is:
----------------------
ESSI2.13/SSS1.8
Free and Open Source Software (FOSS) for Geoinformatics and Geosciences (co-organized)

Hope we can meet around some excellent fresh beer...
Cheers,
Yann

--
----
_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
Vaclav Petras | 18 Dec 04:38 2014
Picon

Re: [GRASS-SVN] r63549 - grass-addons/grass7/raster/r.basin


On Mon, Dec 15, 2014 at 3:40 AM, <svn_grass <at> osgeo.org> wrote:
     grass.read_command('g.region', flags = 'p', region = 'original')
+    grass.run_command('g.remove', flags = 'f', type = 'region', name = 'original')

I think it would be better to use use_temp_region() and del_temp_region() functions from grass.script. grep source code for usage; please extend their doc if you have something.

Vaclav
_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
Nikos Alexandris | 17 Dec 16:33 2014
Picon

i.pansharpen fails to compile

After the latest change in i.pansharpen, the opening triple double 
quote <"""> is missing and the comments (MODULE's description, AUTHOR, 
etc) are not a docstring as expected. Please update.

Thanks, Nikos
Pietro | 16 Dec 12:30 2014
Picon

v.buffer don't write metadata and v.info cut comments

Hi all,

I would like to add a comment in the metadata of a generated vector
map but the content is shortened. I'm in the NorthCarolina mapset,
from an ipython shell:

{{{
In [1]: !v.buffer --overwrite input=busroute6 <at> PERMANENT
output=buff__busroute6 distance=10

In [2]: !v.info buff__busroute6
 +----------------------------------------------------------------------------+
 | Name:            buff__busroute6                                           |
 | Mapset:          user1                                                     |
 | Location:        nc_spm_08_grass7                                          |
 | Database:        /home/pietro/docdat/gis/                                  |
 | Title:           NC State University bus service Wolfline route 6 (lines m |
 | Map scale:       1:1                                                       |
 | Name of creator: helena                                                    |
 | Organization:    NC OneMap                                                 |
 | Source date:     Thu Mar 15 23:35:50 2007                                  |
 | Timestamp (first layer): none                                              |
 |----------------------------------------------------------------------------|
 | Map format:      native                                                    |
 |----------------------------------------------------------------------------|
 |   Type of map: vector (level: 2)                                           |
 |                                                                            |
 |   Number of points:       0               Number of centroids:  1          |
 |   Number of lines:        0               Number of boundaries: 36         |
 |   Number of areas:        4               Number of islands:    4          |
 |                                                                            |
 |   Map is 3D:              No                                               |
 |   Number of dblinks:      0                                                |
 |                                                                            |
 |   Projection: Lambert Conformal Conic                                      |
 |                                                                            |
 |               N:   227741.05646361    S:   226151.51091547                 |
 |               E:   639360.09470206    W:   635143.56812813                 |
 |                                                                            |
 |   Digitization threshold: 0                                                |
 |   Comment:                                                                 |
 |                                                                            |
 +----------------------------------------------------------------------------+
}}}

The command that generate the map is missing!
Should I open a ticket on v.buffer?

Let's add the command manually:

{{{
In [3]: from grass.pygrass.vector import VectorTopo

In [4]: with VectorTopo('buff__busroute6') as buff:
   ....:    buff.comment = 'v.buffer --overwrite
input=busroute6 <at> PERMANENT output=buff__busroute6 distance=10'
   ....:    buff.write_header()
   ....:

In [5]: !v.info buff__busroute6
 +----------------------------------------------------------------------------+
 | Name:            buff__busroute6                                           |
 | Mapset:          user1                                                     |
 | Location:        nc_spm_08_grass7                                          |
 | Database:        /home/pietro/docdat/gis/                                  |
 | Title:           NC State University bus service Wolfline route 6 (lines m |
 | Map scale:       1:1                                                       |
 | Name of creator: helena                                                    |
 | Organization:    NC OneMap                                                 |
 | Source date:     Thu Mar 15 23:35:50 2007                                  |
 | Timestamp (first layer): none                                              |
 |----------------------------------------------------------------------------|
 | Map format:      native                                                    |
 |----------------------------------------------------------------------------|
 |   Type of map: vector (level: 2)                                           |
 |                                                                            |
 |   Number of points:       0               Number of centroids:  1          |
 |   Number of lines:        0               Number of boundaries: 36         |
 |   Number of areas:        4               Number of islands:    4          |
 |                                                                            |
 |   Map is 3D:              No                                               |
 |   Number of dblinks:      0                                                |
 |                                                                            |
 |   Projection: Lambert Conformal Conic                                      |
 |                                                                            |
 |               N:   227741.05646361    S:   226151.51091547                 |
 |               E:   639360.09470206    W:   635143.56812813                 |
 |                                                                            |
 |   Digitization threshold: 0                                                |
 |   Comment:                                                                 |
 |     v.buffer --overwrite input=busroute6 <at> PERMANENT output=buff__busroute6  |
 +----------------------------------------------------------------------------+
}}}

As you can see the Comment string is shortened...
but in the header file is written correctly:

{{{
In [6]: !cat /nc_spm_08_grass7/user1/vector/buff__busroute6/head
ORGANIZATION: NC OneMap
DIGIT DATE:   Mar 16 7
DIGIT NAME:   helena
MAP NAME:     NC State University bus service Wolfline route 6 (lines map)
MAP DATE:     Thu Mar 15 23:35:50 2007
MAP SCALE:    1
OTHER INFO:   v.buffer --overwrite input=busroute6 <at> PERMANENT
output=buff__busroute6 distance=10
PROJ:         99
ZONE:         0
MAP THRESH:   0.000000
}}}

Instead the raster equivalent: r.info it is able to handle a long line.

{{{
In [11]: !r.info elevation
 +----------------------------------------------------------------------------+
 | Map:      elevation                      Date: Tue Nov  7 01:09:51 2006    |
 | Mapset:   PERMANENT                      Login of Creator: helena          |
 | Location: nc_spm_08_grass7                                                 |
 | DataBase: /home/pietro/docdat/gis/                                         |
 | Title:    South-West Wake county: Elevation NED 10m ( elev_ned10m )        |
 | Timestamp: none                                                            |
 |----------------------------------------------------------------------------|
 |                                                                            |
 |   Type of Map:  raster               Number of Categories: 255             |
 |   Data Type:    FCELL                                                      |
 |   Rows:         1350                                                       |
 |   Columns:      1500                                                       |
 |   Total Cells:  2025000                                                    |
 |        Projection: Lambert Conformal Conic                                 |
 |            N:     228500    S:     215000   Res:    10                     |
 |            E:     645000    W:     630000   Res:    10                     |
 |   Range of data:    min = 55.57879  max = 156.3299                         |
 |                                                                            |
 |   Data Description:                                                        |
 |    generated by r.proj                                                     |
 |                                                                            |
 |   Comments:                                                                |
 |    r.proj input="ned03arcsec" location="northcarolina_latlong" mapset="\   |
 |    helena" output="elev_ned10m" method="cubic" resolution=10               |
 |                                                                            |
 +----------------------------------------------------------------------------+
}}}

should I open a bug on this?

Best regards

Pietro
Nikos Alexandris | 15 Dec 19:09 2014
Picon

Option snap for v.in.ogr via g.gui (GRASS 7)

Hi devs,

we are missing the "snap" option (v.in.ogr) in GRASS 7 (wxGUI).  
Actually, we miss the "Command dialog" button.  Is this a bug?

Thanks, Nikos
Pietro | 15 Dec 13:41 2014
Picon

remove RasterNumpy class from pygrass

Dear all,

If you are ok with that, I would like to remove the RasterNumpy class,
as far as I aware, nobody is using it.
So I would like to avoid to introduce a class in grass70 and remove
the class in grass71.
However the RasterNumpy class can be easily replaced by functions like:

{{{
def raster2numpy(rastname):
    """Return a numpy array from a raster map"""
    with RasterRow(rastname, mode='r') as rast:
        return np.array(rast)

def numpy2raster(array, mtype, rastname):
    """Save a numpy array to a raster map"""
    reg = Region()
    if (reg.rows, reg.cols) != array.shape:
        msg = "Region and array are different: %r != %r"
        raise TypeError(msg % ((reg.rows, reg.cols), array.shape))
    with RasterRow(rastname, mode='w', mtype=mtype) as new:
        newrow = Buffer((array.shape[1],), mtype=mtype)
        for row in array:
            newrow[:] = row[:]
            new.put_row(newrow)
}}}

Any concern on this?

Best regards

Pietro
Michel Wortmann | 15 Dec 11:33 2014
Picon

Re: Custom GRASS command line prompt

Hi Nikos, Hamish and list, you guys played around with your commandline prompts last year (see below), I was just implementing the same thing into my ~/.grass.bashrc (GRASS 7.0.0b3) but found that the location and mapset arent actually changed when changing them with g.mapset, i.e. .grass.bashrc isnt actually executed again. Whats the best way getting that to work with or without changing source or $GISBASE files? Best, Michel Nikos: > > Now it appears like: "G 7.0.svn (utm_37s/post):~ >". My understanding is > > that I probably need to edit the file: > > grass7_trunk/dist.x86_64-unknown-linux-gnu/grass70.tmp Hamish: > I'd suggest to put the change in ~/.grass.bashrc instead. Nikos: > Hamish, > > don't want to waist your time, but I have put soemthing like > > SHORT_VER=`echo "$GRASS_VERSION" | cut -f1,2 -d. | sed -e 's/\.//'` > GLOCATION=`echo "${LOCATION_NAME}"` > GMAPSET=`echo "${MAPSET}"` > export PS1='G$SHORT_VER ${GLOCATION}/${GMAPSET}:\w > ' > export PROMPT_DIRTRIM=2 > > which doesn't work! :-/ > > Where should $LOCATION_NAME, $MAPSET be fed from? I got it... GLOCATION=`g.gisenv get="LOCATION_NAME"` GMAPSET=`g.gisenv get="MAPSET"` Nikos
_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
Yann Chemin | 15 Dec 09:49 2014
Picon

group does not update REF file upon g.remove raster file

Hi,

did g.remove a raster, and the group REF file referencing the raster did not update accordingly.

Is this a known behaviour?
Yann

--
----
_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
Markus Neteler | 14 Dec 00:43 2014

v.proj: line densification added for reprojection error minimization

Hi,

Markus Metz kindly added line densification to  v.proj (r63307)

[neteler <at> oboe ~]$ grass70 ~/grassdata/latlong/grass7/

g.region n=60 s=40 w=0 e=30 res=10 -p
projection: 3 (Latitude-Longitude)
zone:       0
datum:      wgs84
ellipsoid:  wgs84
north:      60N
south:      40N
west:       0
east:       30E
nsres:      10
ewres:      10
rows:       2
cols:       3
cells:      6

v.in.region box_latlong_10deg
exit

# EPSG 3035, metric EU LAEA:
grass70 ~/grassdata/europe_laea/user1/
GRASS 7.0.0svn (europe_laea): >

# "traditional way"
v.proj box_latlong_10deg out=box_latlong_10deg_no_densification
location=latlong mapset=grass7 smax=0

# with new line densification
v.proj box_latlong_10deg out=box_latlong_10deg_yes_densification
location=latlong mapset=grass7

g.region vect=box_latlong_10deg_no_densification

# compare:
d.mon wx0
d.vect box_latlong_10deg_no_densification color=red
d.vect box_latlong_10deg_yes_densification color=green fill_color=none

The result (see screenshot, maybe an extreme example but yet helpful
to show the improvement) shows how nicely the projection is performed
now (green color is new output).
Please benchmark this with other GIS...

Thank to Markus Metz for this implementation. I took liberty to
backport it to relbranch70 in r63532.

markusN
_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
Vaclav Petras | 12 Dec 17:10 2014
Picon

Re: [GRASS-SVN] r63505 - grass/trunk/gui/wxpython/vdigit


On Fri, Dec 12, 2014 at 10:01 AM, <svn_grass <at> osgeo.org> wrote:
wxGUI: don't use tabs in the code (introduced in r63341)

For convenience, there is a PEP8 configuration file with settings which will not give you too much errors for GRASS (default/standard PEP8 setting would give you an overwhelming amount of errors for gui/wxpython). You can use it in the following was before you commit. Tabs would be reported as error 101 (E101 indentation contains mixed spaces and tabs). In tools directory, there is also a file for pylint with an example of usage.

$ pep8 --config=tools/pep8config.txt gui/wxpython/vdigit/
gui/wxpython/vdigit/dialogs.py:195:68: E262 inline comment should start with '# '
gui/wxpython/vdigit/dialogs.py:196:57: E262 inline comment should start with '# '
gui/wxpython/vdigit/dialogs.py:595:92: E703 statement ends with a semicolon
gui/wxpython/vdigit/dialogs.py:605:57: E703 statement ends with a semicolon
gui/wxpython/vdigit/main.py:25:5: E301 expected 1 blank line, found 0
gui/wxpython/vdigit/mapwindow.py:99:62: E226 missing whitespace around arithmetic operator
gui/wxpython/vdigit/mapwindow.py:1102:68: E226 missing whitespace around arithmetic operator
gui/wxpython/vdigit/toolbars.py:93:54: E701 multiple statements on one line (colon)
gui/wxpython/vdigit/toolbars.py:94:54: E701 multiple statements on one line (colon)
gui/wxpython/vdigit/toolbars.py:95:50: E701 multiple statements on one line (colon)
gui/wxpython/vdigit/toolbars.py:1066:1: W391 blank line at end of file
gui/wxpython/vdigit/wxdigit.py:374:1: E101 indentation contains mixed spaces and tabs
gui/wxpython/vdigit/wxdigit.py:375:1: E101 indentation contains mixed spaces and tabs
gui/wxpython/vdigit/wxdigit.py:376:1: E101 indentation contains mixed spaces and tabs
gui/wxpython/vdigit/wxdigit.py:377:1: E101 indentation contains mixed spaces and tabs
gui/wxpython/vdigit/wxdigit.py:408:1: E101 indentation contains mixed spaces and tabs
gui/wxpython/vdigit/wxdigit.py:611:78: E703 statement ends with a semicolon
gui/wxpython/vdigit/wxdigit.py:669:66: E703 statement ends with a semicolon
gui/wxpython/vdigit/wxdigit.py:678:44: E703 statement ends with a semicolon
gui/wxpython/vdigit/wxdigit.py:683:37: E703 statement ends with a semicolon
gui/wxpython/vdigit/wxdigit.py:742:20: W601 .has_key() is deprecated, use 'in'
gui/wxpython/vdigit/wxdigit.py:778:24: W601 .has_key() is deprecated, use 'in'
gui/wxpython/vdigit/wxdigit.py:1202:42: E703 statement ends with a semicolon
gui/wxpython/vdigit/wxdigit.py:1707:20: E711 comparison to None should be 'if cond is None:'
gui/wxpython/vdigit/wxdigit.py:1785:1: E101 indentation contains mixed spaces and tabs
gui/wxpython/vdigit/wxdigit.py:1849:30: E226 missing whitespace around arithmetic operator
gui/wxpython/vdigit/wxdigit.py:2040:1: W391 blank line at end of file
gui/wxpython/vdigit/wxdisplay.py:309:54: E226 missing whitespace around arithmetic operator
gui/wxpython/vdigit/wxdisplay.py:309:73: E226 missing whitespace around arithmetic operator
gui/wxpython/vdigit/wxdisplay.py:611:59: E226 missing whitespace around arithmetic operator
gui/wxpython/vdigit/wxdisplay.py:1122:1: W391 blank line at end of file
_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Gmane