[STATSGRASS] R: east() north()
Roger Bivand
Roger.Bivand at nhh.no
Tue Apr 29 04:04:20 EDT 2003
On Tue, 29 Apr 2003, javier garcia wrote:
> Hello;
> I'm learning to use R along with GRASS (Versions: R 1.6.2 GRASS 5.0.2
> R-GRASS 0.2.8)
> Trying to understand the use of
> east() and north(), I've done:
> -------------------------------------------
>
> > summary(east(G))
> Min. 1st Qu. Median Mean 3rd Qu. Max.
> 632200 647200 662100 662100 677000 692000
> > summary(north(G))
> Min. 1st Qu. Median Mean 3rd Qu. Max.
> 4164000 4172000 4181000 4181000 4190000 4199000
> > system("g.region -p")
> projection: 1 (UTM)
> zone: 30
> datum: ** unknown (default: WGS84) **
> ellipsoid: international
> north: 4198600
> south: 4163700
> west: 632200
> east: 692000
> nsres: 50
> ewres: 50
> rows: 698
> cols: 1196
> --------------------------------------------------------
> I can't see the meaning of north() and east().
> If east were the east of each cell in the grid, the result should be
> something like:
> > summary(east(G))
> Min. 1st Qu. Median Mean 3rd Qu. Max.
> 632250 ... 692000
And indeed it (almost) is!! summary.default(), the function you are
calling in summary(east(G)), has a digits= argument. Increase the digits,
and you see it (in fact east() and north() return raster cell midpoints):
> summary(G)
Data from GRASS 5.0 LOCATION maas with 259 columns and 232 rows;
UTM, zone: 32
The west-east range is: 269870, 272460, and the south-north: 5650610, 5652930;
West-east cell sizes are 10 units, and south-north 10 units.
> system("g.region -p")
projection: 1 (UTM)
zone: 32
datum: ** unknown (default: WGS84) **
ellipsoid: wgs84
north: 5652930
south: 5650610
west: 269870
east: 272460
nsres: 10
ewres: 10
rows: 232
cols: 259
> summary(north(G))
Min. 1st Qu. Median Mean 3rd Qu. Max.
5651000 5651000 5652000 5652000 5652000 5653000
> summary(north(G), digits=7)
Min. 1st Qu. Median Mean 3rd Qu. Max.
5650615 5651193 5651770 5651770 5652348 5652925
so north() runs from south + nsres/2 to north - nsres/2.
This is a numerical representation thing - statisticians are often
concerned with the "big picture", in which 5 meters in 5 million really do
not matter, so the default number of digits *printed to the screen* is at
least 3. For spatial position, cm can matter in millions of meters, so we
need to set the digits= argument. The values in the variables are correct,
its the values being displayed that are rounded.
Roger
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
More information about the grass-stats
mailing list