Re: [GRASS-dev] Difficulty compiling GRASS on Mac

2018-05-11 Thread Michael Barton
Eric Hutton at the Community Surface Dynamics Modeling System has created a 
recipe for compiling GRASS using Anaconda. You can find it at: 

https://github.com/csdms-stack/grass-recipe

I'm using a variant of this to create the stand-alone binaries for the Mac. 

Michael
__
C. Michael Barton 
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University
Tempe, AZ  85287-2402
USA
 
voice:480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax:  480-965-7671(SHESC), 480-727-0709 (CSDC)
www:  http://csdc.asu.edu, http://shesc.asu.edu
http://www.public.asu.edu/~cmbarton
 
On 5/11/18, 2:55 AM, "grass-dev on behalf of 
grass-dev-requ...@lists.osgeo.org"  wrote:

Date: Thu, 10 May 2018 12:09:43 -0700
From: Seth Price 
To: grass-dev@lists.osgeo.org
Subject: [GRASS-dev] Difficulty compiling GRASS on Mac
Message-ID:

Re: [GRASS-dev] remove raster map in C code

2018-05-11 Thread Markus Metz
On Fri, May 11, 2018 at 11:54 AM, Luca Delucchi 
wrote:
>
> On 11 May 2018 at 10:54, Markus Metz 
wrote:
> > Hi Luca,
> >
>
> Hi Markus,
>
> > On Fri, May 11, 2018 at 10:26 AM, Luca Delucchi 
> > wrote:
> >>
> >> Hi devs,
> >>
> >> I would like to remove a raster map inside a C module, looking aroung
> >> I found the M_do_remove function used in g.remove and r.reclass. So I
> >> tried to use it but I get error in compilation
> >>
> >> OBJ.x86_64-pc-linux-gnu/main.o: In function `main':
> >> main.c:(.text.startup+0x9eb): undefined reference to `M_get_element'
> >> main.c:(.text.startup+0x9f5): undefined reference to `M_do_remove'
> >> collect2: error: ld returned 1 exit status
> >
> > this is a problem of the linker: you need to link against the manage
lib,
> > see e.g. the Makefile for g.remove. Try
> >
> > LIBES = $(MANAGELIB) $(RASTERLIB) $(GISLIB)
> > DEPENDENCIES = $(MANAGEDEP) $(RASTERDEP) $(GISDEP)
> >
> > in the Makefile of your module.
> >
>
> thanks, now it compile but I get "Segmentation fault", the module is
> r.tile, I attached the diff, could someone have a look to it please?

I think you need to call M_read_list() first, before you loop over the
tiles.

Markus M

>
> > HTH,
> >
> > Markus M
> >
>
>
>
> --
> ciao
> Luca
>
> www.lucadelu.org
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] [GRASS GIS] #3561: quiet option for garray.write()

2018-05-11 Thread GRASS GIS
#3561: quiet option for garray.write()
--+--
  Reporter:  pesekon2 |  Owner:  grass-dev@…
  Type:  enhancement  | Status:  new
  Priority:  normal   |  Milestone:
 Component:  Python   |Version:  svn-trunk
Resolution:   |   Keywords:  python, script.array
   CPU:  Unspecified  |   Platform:  All
--+--
Changes (by pesekon2):

 * Attachment "array_diff" added.

 quiet option for script.array.write()

-- 
Ticket URL: 
GRASS GIS 

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] [GRASS GIS] #3561: quiet option for garray.write()

2018-05-11 Thread GRASS GIS
#3561: quiet option for garray.write()
--+-
 Reporter:  pesekon2  |  Owner:  grass-dev@…
 Type:  enhancement   | Status:  new
 Priority:  normal|  Milestone:
Component:  Python|Version:  svn-trunk
 Keywords:  python, script.array  |CPU:  Unspecified
 Platform:  All   |
--+-
 Hi,

 it would be very useful to have a quiet option for r.in.bin used in
 write() method of objects in grass.script.array.

 Yes, it is only logging percents, but due to this behaviour, it cannot be
 used in a loop with its own percentage log (it will contain a 100 % log
 for each loop).

-- 
Ticket URL: 
GRASS GIS 

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] remove raster map in C code

2018-05-11 Thread Luca Delucchi
On 11 May 2018 at 10:54, Markus Metz  wrote:
> Hi Luca,
>

Hi Markus,

> On Fri, May 11, 2018 at 10:26 AM, Luca Delucchi 
> wrote:
>>
>> Hi devs,
>>
>> I would like to remove a raster map inside a C module, looking aroung
>> I found the M_do_remove function used in g.remove and r.reclass. So I
>> tried to use it but I get error in compilation
>>
>> OBJ.x86_64-pc-linux-gnu/main.o: In function `main':
>> main.c:(.text.startup+0x9eb): undefined reference to `M_get_element'
>> main.c:(.text.startup+0x9f5): undefined reference to `M_do_remove'
>> collect2: error: ld returned 1 exit status
>
> this is a problem of the linker: you need to link against the manage lib,
> see e.g. the Makefile for g.remove. Try
>
> LIBES = $(MANAGELIB) $(RASTERLIB) $(GISLIB)
> DEPENDENCIES = $(MANAGEDEP) $(RASTERDEP) $(GISDEP)
>
> in the Makefile of your module.
>

thanks, now it compile but I get "Segmentation fault", the module is
r.tile, I attached the diff, could someone have a look to it please?

> HTH,
>
> Markus M
>



-- 
ciao
Luca

www.lucadelu.org
Index: raster/r.tile/Makefile
===
--- raster/r.tile/Makefile	(revision 72704)
+++ raster/r.tile/Makefile	(working copy)
@@ -2,8 +2,8 @@
 
 PGM = r.tile
 
-LIBES = $(RASTERLIB) $(GISLIB)
-DEPENDENCIES = $(RASTERDEP) $(GISDEP)
+LIBES = $(MANAGELIB) $(RASTERLIB) $(GISLIB)
+DEPENDENCIES = $(MANAGEDEP) $(RASTERDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make
 
Index: raster/r.tile/main.c
===
--- raster/r.tile/main.c	(revision 72704)
+++ raster/r.tile/main.c	(working copy)
@@ -15,12 +15,15 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 static struct
 {
 struct Option *rastin, *rastout, *width, *height, *overlap;
 } parm;
+
 static struct Cell_head dst_w, src_w, ovl_w;
 static int xtiles, ytiles;
 static RASTER_MAP_TYPE map_type;
@@ -30,6 +33,9 @@
 int main(int argc, char *argv[])
 {
 struct GModule *module;
+struct Range int_range;
+struct FPRange fp_range;
+struct Flag *flag;
 int infile;
 const char *mapset;
 size_t cell_size;
@@ -75,6 +81,10 @@
 parm.overlap->multiple = NO;
 parm.overlap->description = _("Overlap of tiles");
 
+flag = G_define_flag();
+flag->key = 'n';
+flag->description = _("Does not create tiles having only NULL values");
+
 if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -149,8 +159,31 @@
 	}
 
 	for (xtile = 0; xtile < xtiles; xtile++) {
-	Rast_close(outfiles[xtile]);
-	write_support_files(xtile, ytile, overlap);
+Rast_close(outfiles[xtile]);
+write_support_files(xtile, ytile, overlap);
+if (flag->answer){
+char name[GNAME_MAX];
+sprintf(name, "%s-%03d-%03d", parm.rastout->answer, ytile, xtile);
+if (map_type == CELL_TYPE) {
+CELL min, max;
+Rast_read_range(name, G_mapset(), _range);
+min = int_range.min;
+max = int_range.max;
+if (IS_NULL_C() && IS_NULL_C()){
+M_do_remove(M_get_element("raster"), name);
+G_debug(0, "Removed empty tile %s", name);
+}
+} else {
+DCELL min, max;
+Rast_read_fp_range(name, mapset, _range);
+min = fp_range.min;
+max = fp_range.max;
+if (IS_NULL_D() && IS_NULL_D()){
+M_do_remove(M_get_element("raster"), name);
+G_debug(0, "Removed empty tile %s", name);
+}
+}
+}
 	}
 }
 
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] remove raster map in C code

2018-05-11 Thread Markus Metz
Hi Luca,

On Fri, May 11, 2018 at 10:26 AM, Luca Delucchi 
wrote:
>
> Hi devs,
>
> I would like to remove a raster map inside a C module, looking aroung
> I found the M_do_remove function used in g.remove and r.reclass. So I
> tried to use it but I get error in compilation
>
> OBJ.x86_64-pc-linux-gnu/main.o: In function `main':
> main.c:(.text.startup+0x9eb): undefined reference to `M_get_element'
> main.c:(.text.startup+0x9f5): undefined reference to `M_do_remove'
> collect2: error: ld returned 1 exit status

this is a problem of the linker: you need to link against the manage lib,
see e.g. the Makefile for g.remove. Try

LIBES = $(MANAGELIB) $(RASTERLIB) $(GISLIB)
DEPENDENCIES = $(MANAGEDEP) $(RASTERDEP) $(GISDEP)

in the Makefile of your module.

HTH,

Markus M

>
> In the source code of the module I added #include 
> that it seems the header containing the definition of M_do_remove.
>
> Any idea?
>
> Thanks in advance
>
> --
> ciao
> Luca
>
> www.lucadelu.org
> ___
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] remove raster map in C code

2018-05-11 Thread Luca Delucchi
Hi devs,

I would like to remove a raster map inside a C module, looking aroung
I found the M_do_remove function used in g.remove and r.reclass. So I
tried to use it but I get error in compilation

OBJ.x86_64-pc-linux-gnu/main.o: In function `main':
main.c:(.text.startup+0x9eb): undefined reference to `M_get_element'
main.c:(.text.startup+0x9f5): undefined reference to `M_do_remove'
collect2: error: ld returned 1 exit status

In the source code of the module I added #include 
that it seems the header containing the definition of M_do_remove.

Any idea?

Thanks in advance

-- 
ciao
Luca

www.lucadelu.org
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev