Re: [GRASS-user] Lack of documentation on adding custom symbols

2018-02-07 Thread Moritz Lennert

On 06/02/18 21:35, Mary Muir wrote:
I was wondering if anyone plans to update the wiki 
https://grasswiki.osgeo.org/wiki/IconSymbols ?


As far as I can tell, this is the only documentation that exists on 
adding custom symbols to grass however it fails to mention the need to 
add png images to their gui/image/symbols directory so that the users 
can select them from the gui.


Thanks for the hint. Would you be willing to provide an update ?

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

Re: [GRASS-user] LSMetrics - addon development

2018-02-07 Thread Moritz Lennert

Dear Bernardo,

On 07/02/18 14:55, Bernardo Santos wrote:

Dear list,

We have been developing a python application called LSMetrics to 
calculate landscape metrics for environmental management and ecological 
research. All functions/metrics use GRASS modules in the process of 
calculation. More information here:

https://github.com/LEEClab/LS_METRICS/wiki


Great, thanks !

Out of curiosity: could you maybe explain how this application compares 
to the existing r.li suite of modules in GRASS core 
(https://grass.osgeo.org/grass74/manuals/r.li.html) and the r.pi suite 
of modules in GRASS addons (there seems to be a problem with building 
the manual pages, but you can get an idea by looking at the 
description.html file here: 
https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.pi) ? 
I am no expert in the field of landscape metrics and am just wondering 
how this all fits into the picture.




Basically we have several python functions, each of which calculates a 
different metric. All of them are then called by a single function that 
can coordinate the calculation of several metrics for several maps in a row.
Currently the metrics can be calculated for input maps using a grafical 
interface (we call it from the GRASS shell using "python 
LS_metrics_v1_0_0.py") or by calling python shell from the GRASS shell 
and then using python scripting to call the functions (importing 
functions and then calling them directly). We wish to transform these 
function into one (or more than one) grass addon.


Then I have two questions:
- Do you think it would be better to build a single addon (e.g. called 
r.ls.metrics) so that each metrics is defined by a parameter (e.g. 
method = "patch_size", "fragment_size", "structural connectivity" ...), 
or rather a set of addons, each one corresponding to a single landscape 
metrics (e.g. r.ls.patch_size, r.ls.fragment_size, ...)?


The other two suites have gone for separate modules for each metric. I'm 
not sure what the rationale was behind that choice, but I guess we 
should try to be consistent across similar module suites.




- Also, I have looked on how to build the addon in GRASS help pages but 
I am not sure about some details. Can you send me some references to 
ease that process?


The basic idea for a module for addons is to create a directory with the 
source file(s), the html file for the manual page and a Makefile.


Please follow the general submitting rules as explained at 
https://trac.osgeo.org/grass/wiki/Submitting.


To get an idea of the structure of a suite of modules in Addons, you 
could look at the recently added r.sentinel tools: 
https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.sentinel


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

Re: [GRASS-user] r.los problem when installing in GRASS 7.0.2

2018-02-07 Thread Vaclav Petras
On Thu, Feb 1, 2018 at 3:26 PM, Miguel Carrero <
miguel.carrero.pa...@gmail.com> wrote:

>
> I am trying to install r.los from g.extension, but returns me this error:
>
> ...
>
Does anyone know what's happening? The same happens when I try to install
> r.viewshed.cva
>

Another thing is, if you just need viewshed, you can use r.viewshed [1]
which replaced r.los [2].

Vaclav

[1] https://grass.osgeo.org/grass74/manuals/r.viewshed.html
[2]
https://ncsu-geoforall-lab.github.io/grass-as-a-platform/ncgis2017.html#/20
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

[GRASS-user] LSMetrics - addon development

2018-02-07 Thread Bernardo Santos
Dear list,
We have been developing a python application called LSMetrics to calculate 
landscape metrics for environmental management and ecological research. All 
functions/metrics use GRASS modules in the process of calculation. More 
information here:https://github.com/LEEClab/LS_METRICS/wiki

Basically we have several python functions, each of which calculates a 
different metric. All of them are then called by a single function that can 
coordinate the calculation of several metrics for several maps in a 
row.Currently the metrics can be calculated for input maps using a grafical 
interface (we call it from the GRASS shell using "python LS_metrics_v1_0_0.py") 
or by calling python shell from the GRASS shell and then using python scripting 
to call the functions (importing functions and then calling them directly). We 
wish to transform these function into one (or more than one) grass addon.
Then I have two questions:- Do you think it would be better to build a single 
addon (e.g. called r.ls.metrics) so that each metrics is defined by a parameter 
(e.g. method = "patch_size", "fragment_size", "structural connectivity" ...), 
or rather a set of addons, each one corresponding to a single landscape metrics 
(e.g. r.ls.patch_size, r.ls.fragment_size, ...)?
- Also, I have looked on how to build the addon in GRASS help pages but I am 
not sure about some details. Can you send me some references to ease that 
process?
Thanks a lot. Below you can find more information regarding the 
metrics.BestBernardo Niebuhr
_
Metrics calculated:Metrics related to structural connectivity:- patch size- 
fragment size (excludes corridors with a given edge depth)- structural 
connectivity- proportion of habitat (within a window around each pixel)Metrics 
related to functional connectivity- functionally connected area (considering 
the capacity of organisms to cross gaps between habitat patches)- functional 
connectivityMetrics related to habitat edges- distance from edges- 
clasisfication edge/core/matrix (considering a given edge depth)- proportion of 
edge and core (within a window around each pixel)Metrics of landscape 
diversity(we are currently using the r.diversity add on to calculate that)

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

Re: [GRASS-user] multiprocessing in python

2018-02-07 Thread Moritz Lennert

[Please always keep the list in CC.]

On 06/02/18 22:57, Leonardo Hardtke wrote:

Hi, thanks Moritz.
I tried with your suggestion but I get the same error out...

As a side note, If the process does not read any data in it works as 
expected (ie commenting the for loop).


Can you identify which specific call in the loop ?

Have you tried launching with

pool.map(tile_process, [1, 2]) ?



I have a similar approach working OK with plain gdal 
(https://gist.github.com/leohardtke/b54e79ed93546c0db840c7b5e951a6ce).


There must be something with the grass raster python module, but I can't 
figure it out.


Not sure if it is raster, or rather temporal dataset handling. I don't 
have time to look at this in detail now, so I'm putting grass-dev in CC 
so you might get some answers from people more knowledgeable in temporal 
data processing than me.


A bit more info (e.g. more details of the code, such as the definition 
of your pool, but also OS, versions, etc) might be helpful.


Moritz






Cheers

On 7 February 2018 at 00:47, Moritz Lennert 
> wrote:


On 06/02/18 12:09, Leonardo Hardtke wrote:

Dear all,
I am working on a module to extract the phenological parameters
(like timesat) from a time series implemented in python/cython
and making use of gscript and other grass stuff.
It works great on a 256x256 and as the plan is applying it over
Australia at 250m over 17 years, I need to split the process in
small tiles. The idea is to run this processes in parallel and I
am having issues implementing it.

This would be the first part of the process that runs on each tile:

def tile_process(tile_index):
  '''
  Function for every worker:
  Applies any function to the sub_region corresponding to
the tile_index.
  '''
  global Rows
  global Cols
  global RowBlockSize
  global ColBlockSize
  global full_region
  global dates
  global years
  global indices
  global data_serie
  global yr_limits_extra
  global yr_limits
  global dbif

  sub_name='block'
  TileRow, TileCol, sr =
sub_region(tile_index,full_region,RowBlockSize,ColBlockSize)
  # # Define a temporary region based on the parameters
caluculated with the
  start_row = TileRow * RowBlockSize
  start_col = TileCol * ColBlockSize
  n_rows = sr['rows']
  n_cols = sr['cols']

  strds = tgis.SpaceTimeRasterDataset(data_serie)
  strds.select(dbif=dbif)
  maps = strds.get_registered_maps_as_objects(dbif=dbif)

  # Numer of time steps
  steps = len(maps)
  # Make an empty array
  #print(steps)
  EVI = np.empty([steps,n_rows,n_cols])
  # fill the array
  for step, map in enumerate(maps):
   map.select(dbif=dbif)
   image_name = map.get_name()+'@'+data_serie.split('@')[1]
   #print("reading: {}".format(image_name))
   EVI[step,:] =
raster2numpy_sub(image_name,start_row,n_rows,start_col,n_cols)
  mean = EVI.mean()
  print(mean)
  
  
  


and this is how I start the multiprocess pool.

  pool.map(tile_process, xrange(RowBlockN*ColBlockN))
  pool.close()
  pool.join()

and it gives me:

AssertionError: can only test a child process


of course if I do: tile_process(0) or tile_process(1) etc ,the
right result comes out.

Does any of you have experience with this? Any suggestion would
be welcome!
Sorry for the messy code. Is still in early stage.


Just a wild guess: have you tried with range (which returns a list)
instead of xrange (which returns an xrange object) ?

Moritz




--
Dr. Leonardo A. Hardtke
C3 UTS, Scientific Officer
CB04.06.315.06
Email:leonardoandres.hard...@uts.edu.au 
 orleohard...@gmail.com 




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