[GRASS-user] r.univar: different results with different projections?

Moritz Lennert mlennert at club.worldonline.be
Tue Nov 17 08:54:44 PST 2015


On 17/11/15 16:13, Carlos Grohmann wrote:
> Yes Anna you're right. New pixel will be created and some might be lost.
>
> But the changes in the statistics is what concerns me. If your
> statistical description of a raster changes significantly after
> reprojection, which one is right?

Depending on how much you trust the resampling methods, both are "right" 
in their projection system and using this resampling method. ;-)

Look at your resolution: in the projected systems your pixels are 
strongly rectangular:

nsres:      1178.49728369
ewres:      1855.32484655

This makes a difference as to which pixels are seen to be the nearest 
neighbors. By displaying the map in both systems side by side and by 
zooming very closely you can see this quite clearly. Pixels are not 
equal to pixels when moving from one projection system to another. The 
grid you lay over the earth is different and so the statistics 
calculated from that grid will be different as well.

Have a look at the attached screenshot. You can see the etopo data on 
the coast of greenland in EPSG 4326 and in a "World Mercator" system 
(+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +no_defs +a=6378137 
+rf=298.257223563 +towgs84=0.000,0.000,0.000 +to_meter=1).

The values I got was from the right-hand land pixel just above the 
central water area. As you see values are different, as these pixels are 
not equal.

Reprojection of raster maps is not the same as reprojection of vector 
maps in which you reproject the vertices of an object, but the 
attributes of that object remain the same. As explained in the r.proj 
manual:

"A raster may be considered o represent a sampling of a process at a 
regular, ordered set of locations. The set of locations that lie at the 
intersections of a cartesian grid in one projection will not, in 
general, coincide with the sample points in another projection. Thus, 
the conversion of raster maps involves an interpolation step in which 
the values of points at intermediate locations relative to the source 
grid are estimated."

Moritz



>
> On Tue, Nov 17, 2015 at 12:50 PM, Anna Petrášová <kratochanna at gmail.com
> <mailto:kratochanna at gmail.com>> wrote:
>
>
>
>     On Tue, Nov 17, 2015 at 7:56 AM, Carlos Grohmann
>     <carlos.grohmann at gmail.com <mailto:carlos.grohmann at gmail.com>> wrote:
>
>         Hello Jörg
>
>         The area of cell shouldn't influence here. The statistics are
>         about the elevation values, regardless of the area represented
>         by pixel. If I think on the pixels as equally-spaced vector
>         points, after projection they won't be equally-spaced anymore,
>         but the number of points won't change. So the mean of their
>         values (and stddev, etc) shouldn't change as well.
>
>
>     I don't think you can treat pixels as vector points here, I agree
>     with what Jörg was saying. If some vector points would get further
>     away, you will get new pixels in between and if the points get close
>     enough, the information in all points but one is lost.  This is at
>     least my intuitive understanding of the NN reprojection which can be
>     wrong. I wouldn't be concerned that the results changed but how much
>     they changed.
>
>     Anna
>
>
>         regards
>
>         Carlos
>
>
>         On Tue, Nov 17, 2015 at 5:15 AM, Robl Jörg Christian
>         <Joerg.Robl at sbg.ac.at <mailto:Joerg.Robl at sbg.ac.at>> wrote:
>
>             Dear Carlos,____
>
>             __ __
>
>             I’m not an expert for projections. ____
>
>             However, on Lat/Long WGS84 the actual area of cells decline
>             from the equator towards the poles. ____
>
>             Thus, I would expect that cell values near the poles have
>             “more weight” using Lat/Long WGS84 than using an equal area
>             projection. ____
>
>             __ __
>
>             Near the poles I don’t understand how the values for extent
>             and resolution should be correct (equal area), except there
>             is a huge distortion (very likely for a cylindrical
>             projection)!____
>
>             Are there really 21600 cols with a nsres = 1178 m at the
>             north and south pole. I would call this a huge distortion.____
>
>             __ __
>
>             As a test, I would calculate the statistics for a smaller
>             area centered at the equator. I would expect that the
>             results are very similar comparing the lat/long and the
>             reprojected dataset.____
>
>             __ __
>
>             Regards Jörg____
>
>             __ __
>
>             __ __
>
>             __ __
>
>             *Von:*grass-user [mailto:grass-user-bounces at lists.osgeo.org
>             <mailto:grass-user-bounces at lists.osgeo.org>] *Im Auftrag von
>             *Carlos Grohmann
>             *Gesendet:* Montag, 16. November 2015 23:32
>             *Cc:* GRASS user list
>             *Betreff:* Re: [GRASS-user] r.univar: different results with
>             different projections?____
>
>             __ __
>
>             Hello Cesar____
>
>             __ __
>
>             That was weird, so I tested it again. The number of cells is
>             the same for both projections, but the values differ. This
>             must be related to reprojecting.____
>
>             __ __
>
>             To me, they shouldn't de different, since a nearest neighbor
>             should preserve the original values. I'm not really
>             comfortable with this, as I'm not sure I can trust the stats
>             after projecting. ____
>
>             __ __
>
>             best____
>
>             __ __
>
>             Carlos____
>
>             __ __
>
>             __ __
>
>             GRASS 7.1.svn (latlong):~ > g.region raster=gdem_etopo1_ice
>             -pa____
>
>             projection: 3 (Latitude-Longitude)____
>
>             zone:       0____
>
>             datum:      wgs84____
>
>             ellipsoid:  wgs84____
>
>             north:      90N____
>
>             south:      90S____
>
>             west:       180W____
>
>             east:       180E____
>
>             nsres:      0:01____
>
>             ewres:      0:01____
>
>             rows:       10800____
>
>             cols:       21600____
>
>             cells:      233280000____
>
>             GRASS 7.1.svn (latlong):~ > r.univar map=gdem_etopo1_ice -ge
>             percentile=100____
>
>             n=233280000____
>
>             null_cells=0____
>
>             cells=233280000____
>
>             min=-10803____
>
>             max=8333____
>
>             range=19136____
>
>             mean=-1892.40422534294____
>
>             mean_of_abs=2644.91906490912____
>
>             stddev=2649.98339302808____
>
>             variance=7022411.98332463____
>
>             coeff_var=-140.032629262802____
>
>             sum=-441460057688____
>
>             first_quartile=-4286____
>
>             median=-2457____
>
>             third_quartile=214____
>
>             percentile_100=8333____
>
>             __ __
>
>             __ __
>
>             __ __
>
>             __ __
>
>             GRASS 7.1.svn (eqarea):~ > g.region -p____
>
>             projection: 99 (Equal Area Cylindrical)____
>
>             zone:       0____
>
>             datum:      wgs84____
>
>             ellipsoid:  wgs84____
>
>             north:      6363885.33192604____
>
>             south:      -6363885.33192604____
>
>             west:       -20037508.34278924____
>
>             east:       20037508.34278924____
>
>             nsres:      1178.49728369____
>
>             ewres:      1855.32484655____
>
>             rows:       10800____
>
>             cols:       21600____
>
>             cells:      233280000____
>
>             GRASS 7.1.svn (eqarea):~ > r.univar map=gdem_etopo1_ice -ge
>             percentile=100 ____
>
>             n=233280000____
>
>             null_cells=0____
>
>             cells=233280000____
>
>             min=-10803____
>
>             max=8333____
>
>             range=19136____
>
>             mean=-2382.28934158093____
>
>             mean_of_abs=2845.10169015775____
>
>             stddev=2508.93105538271____
>
>             variance=6294735.0406638____
>
>             coeff_var=-105.315966939504____
>
>             sum=-555740457604____
>
>             first_quartile=-4544____
>
>             median=-3285____
>
>             third_quartile=93____
>
>             percentile_100=8333____
>
>             __ __
>
>             __ __
>
>             __ __
>
>             __ __
>
>             __ __
>
>             __ __
>
>             __ __
>
>             On Mon, Nov 16, 2015 at 7:43 PM, César Augusto Ramírez
>             Franco <caesarivs at gmail.com <mailto:caesarivs at gmail.com>>
>             wrote:____
>
>             Carlos,____
>
>             __ __
>
>             2015-11-16 14:47 GMT-05:00 Carlos Grohmann
>             <carlos.grohmann at gmail.com
>             <mailto:carlos.grohmann at gmail.com>>:____
>
>             GRASS 7.1.svn (base_maps):~ > g.region -p
>             raster=gdem_etopo1_ice____
>
>             cells:      233280000____
>
>             __ __
>
>             GRASS 7.1.svn (base_maps):~ > r.univar map=gdem_etopo1_ice
>             -ge percentile=100____
>
>             cells=58320000____
>
>             __ __
>
>             GRASS 7.1.svn (eqarea):~ > r.univar map=gdem_etopo1_ice -ge
>             percentile=100____
>
>             cells=233280000____
>
>             __ __
>
>             ​​Notice how the number of pixels differs, that's the reason
>             the statistics are not the same​, I don't get why the region
>             has a different number of pixels than the raster itself in
>             the original latlong projection...​ I think that's the root
>             of the issue____
>
>             __ __
>
>             -- ____
>
>             *César Augusto Ramírez Franco*
>             Laboratorio de Sistemas Complejos Naturales
>             Escuela de Geociencias - Facultad de Ciencias
>             Universidad Nacional de Colombia - Sede Medellín
>             Teléfono: (57-4) 430 9369 - 300 459 6085____
>
>             http://labscn-unalmed.github.io/____
>
>
>
>             ____
>
>             __ __
>
>             -- ____
>
>             Prof. Carlos Henrique Grohmann
>             Institute of Energy and Environment - Univ. of São Paulo,
>             Brazil____
>
>             - Digital Terrain Analysis | GIS | Remote Sensing - ____
>
>             __ __
>
>             http://carlosgrohmann.com <http://carlosgrohmann.com/>____
>
>             http://orcid.org/0000-0001-5073-5572____
>
>             ________________
>             Can’t stop the signal.____
>
>
>
>
>         --
>         Prof. Carlos Henrique Grohmann
>         Institute of Energy and Environment - Univ. of São Paulo, Brazil
>         - Digital Terrain Analysis | GIS | Remote Sensing -
>
>         http://carlosgrohmann.com <http://carlosgrohmann.com/>
>         http://orcid.org/0000-0001-5073-5572
>         ________________
>         Can’t stop the signal.
>
>         _______________________________________________
>         grass-user mailing list
>         grass-user at lists.osgeo.org <mailto:grass-user at lists.osgeo.org>
>         http://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>
>
>
> --
> Prof. Carlos Henrique Grohmann
> Institute of Energy and Environment - Univ. of São Paulo, Brazil
> - Digital Terrain Analysis | GIS | Remote Sensing -
>
> http://carlosgrohmann.com <http://carlosgrohmann.com/>
> http://orcid.org/0000-0001-5073-5572
> ________________
> Can’t stop the signal.
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: projected_pixels.png
Type: image/png
Size: 112568 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20151117/c0dba6f2/attachment-0001.png>


More information about the grass-user mailing list