[GRASS-user] Uniform random raster

Giuseppe Amatulli giuseppe.amatulli at gmail.com
Tue Feb 16 06:17:44 PST 2016


Thanks Paulo and Thomas,
perfect the r.surf.random
<https://grass.osgeo.org/grass70/manuals/r.surf.random.html> does what i
want!! I know how to implement the code!
Thanks!!
p.s. better to put the r.surf.random
<https://grass.osgeo.org/grass70/manuals/r.surf.random.html> link at the
bottom of r.random.surface
<https://grass.osgeo.org/grass70/manuals/r.random.surface.html>


On 16 February 2016 at 03:47, Paulo van Breugel <p.vanbreugel at gmail.com>
wrote:

>
>
> On 16-02-16 05:04, Thomas Adams wrote:
>
> Giuseppe,
>
> Unless I have misunderstood, in GRASS use r.mapcalc...
>
> First set you region for your area of interest, for example:
>
> g.region -dp e=2614612.5 w=1423987.5 n=-4624387.5 s=-5862637.5
>
> Then:
> r.mapcalc expression="outputMap=25.4"
>
> where 25.4 is your value of interest, and finally:
>
> r.out.gdal input=outputMap output=outputFileName format=GTiff
>
> Best,
> Tom
>
> On Mon, Feb 15, 2016 at 9:33 PM, Giuseppe Amatulli <
> <giuseppe.amatulli at gmail.com>giuseppe.amatulli at gmail.com> wrote:
>
>> Hi,
>> I would like to create an uniform random raster, similar to what i would
>> obtain in R with the following code
>>
>> raster=raster(matrix(runif(54210, max=50, min=-50, 139,390) , ...........)
>> writeRaster(raster,filename=random.tif",formats=GTiff,overwrite=TRUE)
>>
>> I read the explanation of
>> https://grass.osgeo.org/grass7/manuals/r.random.surface.html
>> and also r.mapcalc - random (a,b)
>> but I'm not sure if one of them produce the same concept/result.
>>
>
> That function creates random surface(s) with spatial dependence (there is
> a small typo in the link, it should be grass70). What you want, I think, is
> the r.surf.random function (
> <https://grass.osgeo.org/grass70/manuals/r.surf.random.html>
> https://grass.osgeo.org/grass70/manuals/r.surf.random.html). The
> r.mapcalc - random(a,b) should also do what you want, it also gives a
> uniform distribution.
>
> p.s. some of the brackets in your R code above are off, it should probably
> be something like raster=raster(matrix(runif(54210, max=50, min=-50),
> 139,390) , ...........). Like Thomas wrote, in GRASS you first need to
> define your region and set your resolution (check out g.region for all
> settings, including the option to set number of rows and columns). Than you
> can run r.surf.random or r.mapcalc to generate your new random surface
> layer.
>
>
>> Any input? or better explanation
>>
>> Thanks
>> Best
>> Giuseppe
>>
>> --
>> Giuseppe Amatulli, Ph.D.
>>
>> Department of Ecology and Evolutionary Biology, Yale University.
>> Jetz Lab, OML Room 405
>>
>> P.O. Box 208106
>> 165 PROSPECT ST
>> New Haven, CT 06520-8106
>> Teaching: spatial-ecology.net
>> Work:  http://sbsc.yale.edu/giuseppe-amatulli
>>
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>
>
>
>
> --
> Thomas E Adams, III
> 2330 Jack Warner PKWY, #334
> Tuscaloosa, AL 35401
>
> 1 (513) 739-9512 (cell)
>
>
>
> _______________________________________________
> grass-user mailing listgrass-user at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>


-- 
Giuseppe Amatulli, Ph.D.

Department of Ecology and Evolutionary Biology, Yale University.
Jetz Lab, OML Room 405

P.O. Box 208106
165 PROSPECT ST
New Haven, CT 06520-8106
Teaching: spatial-ecology.net
Work:  http://sbsc.yale.edu/giuseppe-amatulli
<http://www.spatial-ecology.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20160216/f0dc29a6/attachment-0001.html>


More information about the grass-user mailing list