Re: [GRASS-user] r.forestfrag AddOn
Dear Stefan, If i remember it right, the window size is an input to the r.neighbors command. In the script there is an option to slect a windows size: #%option #% key: window #% type: integer #% description: window size default is 5 #% answer : 5 #% required : yes #%END You can modify the r.neighbors section like this: r.neighbors input=A output=C method=sum size=$GIS_OPT_window --o r.neighbors input=B output=D method=sum size= $GIS_OPT_window --o On Sun, Feb 26, 2012 at 5:51 PM, Stefan Sylla wrote: > By now, the script can only calculate the forest fraction for a 3x3 window. > Any ideas on how to automatically generate different window-sizes would be > welcome. -- cheers, maning -- "Freedom is still the most radical idea of all" -N.Branden wiki: http://esambale.wikispaces.com/ blog: http://epsg4253.wordpress.com/ -- ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Replace 0 by NULL in categorial raster map
Hi, I'd like to replace all values/categories "0" by real NULL values. Furthermore I want to do that in a Python script. I tried to do it with mapcalc in the script but then I loose the category labels: grass.mapcalc("$out= if($in==0,null(),$in)", out = "in", in = "in") I am not sure if r.reclass or r.recode can be the right module here? Anyway if yes, how can they be used with a rule supplied in the python script (sstdin?). The desired approach should keep the other categories and their labels. grass.run_command("r.reclass", input="in", output="out", rules=??) Best regards, /Johannes -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Replace 0 by NULL in categorial raster map
On 02/03/12 15:09, Johannes Radinger wrote: Hi, I'd like to replace all values/categories "0" by real NULL values. Furthermore I want to do that in a Python script. I tried to do it with mapcalc in the script but then I loose the category labels: grass.mapcalc("$out= if($in==0,null(),$in)", out = "in", in = "in") I am not sure if r.reclass or r.recode can be the right module here? Anyway if yes, how can they be used with a rule supplied in the python script (sstdin?). The desired approach should keep the other categories and their labels. grass.run_command("r.reclass", input="in", output="out", rules=??) Any reason not to use r.null with parameter setnull= ? Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Replace 0 by NULL in categorial raster map
> On 02/03/12 15:09, Johannes Radinger wrote: > > Hi, > > > > I'd like to replace all values/categories "0" by real NULL values. > > Furthermore I want to do that in a Python script. I tried to do it > > with mapcalc in the script but then I loose the category labels: > > > > > > grass.mapcalc("$out= if($in==0,null(),$in)", > > out = "in", > > in = "in") > > > > I am not sure if r.reclass or r.recode can be the right module here? > > Anyway if yes, how can they be used with a rule supplied > > in the python script (sstdin?). The desired approach should keep the > other categories and their labels. > > > > grass.run_command("r.reclass", input="in", output="out", rules=??) > > Any reason not to use r.null with parameter setnull= ? Thank you, I wasn't aware of this module r.null, but thats what I was looking for as my values and my category is 0 (which I want to replace). Just for my personal interest two questions: 1) What if I want to replace the category "0" with NULL (not the values 0) 2) What would be the correct module if I want to assign another category than NULL to certain values? Is hat module r.category? And how can that be used in pyhton (how are the rules supplied)? Eg. assign all values greater than 0 to 1 all other values NULL. cheers Johannes > > Moritz > ___ > grass-user mailing list > grass-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/grass-user -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Get non-NULL cells over multiple rasters
Moritz Lennert wrote: > Any reason why the solution using splitlines() is not acceptable: > > maps=grass.read_command('g.mlist', > pattern='rast_*|crast_*|Treene_raster', type='rast').splitlines() No, but it shouldn't be necessary; such fundamental operations should have dedicated library functions. Ideally, any "query" module should have a corresponding Python function which returns the information using appropriate Python data types. In fact, grass.script.core used to have a function mlist() which would do this, but for some reason it was removed in r47427. In r50971 I've added mlist_pairs and mlist_strings (analogous to list_pairs and list_strings), and added a flag= option to all three; 'r' for basic regexps, 'e' for extended regexps, '' (the default) for glob patterns. -- Glynn Clements ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Replace 0 by NULL in categorial raster map
On 02/03/12 15:56, Johannes Radinger wrote: Just for my personal interest two questions: 1) What if I want to replace the category "0" with NULL (not the values 0) Category 0 = value 0. Raster values in GRASS are called categorie values. Or maybe I don't understand what you mean ? 2) What would be the correct module if I want to assign another category than NULL to certain values? Is hat module r.category? And how can that be used in pyhton (how are the rules supplied)? Eg. assign all values greater than 0 to 1 all other values NULL. If you have a integer values (CELL), then r.reclass. If you have floating point values, generally r.recode is more appropriate (or just multiply your floating point map by the appropriate number to make it integer). Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] How one can find the starting and end point of a line in a vector file or how one can connect two line end to end using C code
Hello, Any one can solve me the problem like-" How one can find the starting and end point of a line in a vector file or how one can connect two line end to end using C code". If there is any change needed in code like C or Python Script please suggest me. How I can do it. Regards, Swapan ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user