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

Hi all.

I’m analyzing some global-scale DEMs, like ETOPO1/2, SRTM30_PLUS, etc.

I’m getting the statistics for the whole dataset with r.univar, but today I noticed that the results differ if I use different projections. (GRASS 7.1)

For example, ETOPO2:

Using a latlong pseudo-projection (plate carré)

min: -10791
max: 8440
mean: -1888.6480792
median: -2457
stddev: 2650.01922839
p25: -4273
p75: 216

And using equal-area cylindrical:

min: -10791
max: 8440
mean: -2379.78247747
median: -3291
stddev: 2507.89668617
p25: -4541
p75: 94

Are these differences expected? I would think that they should be the same, regardless of projection (I’m thinking on the elevation values as an array of values).

thanks

Carlos

···

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://orcid.org/0000-0001-5073-5572


Can’t stop the signal.

Hello Carlos,

Maybe it has something to do with the pixel resolution? I would certainly expect the same results, but with a very similar region (i.e. same number of rows and columns, or at least very close and a similar number of pixels)

Maybe when projecting the raster, the length of the array is varying but I wouldn’t expect to vary very much, are you getting the same results in a previous version of GRASS? (7.0 or even 6.4?)

Greetings

El nov. 16, 2015 11:35 AM, “Carlos Grohmann” <carlos.grohmann@gmail.com> escribió:

Hi all.

I’m analyzing some global-scale DEMs, like ETOPO1/2, SRTM30_PLUS, etc.

I’m getting the statistics for the whole dataset with r.univar, but today I noticed that the results differ if I use different projections. (GRASS 7.1)

For example, ETOPO2:

Using a latlong pseudo-projection (plate carré)

min: -10791
max: 8440
mean: -1888.6480792
median: -2457
stddev: 2650.01922839
p25: -4273
p75: 216

And using equal-area cylindrical:

min: -10791
max: 8440
mean: -2379.78247747
median: -3291
stddev: 2507.89668617
p25: -4541
p75: 94

Are these differences expected? I would think that they should be the same, regardless of projection (I’m thinking on the elevation values as an array of values).

thanks

Carlos

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://orcid.org/0000-0001-5073-5572


Can’t stop the signal.


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

Hello Cesar

I wouldn’t expect pixel resolution to play a role here. The statistics must be carried out over the values.
The raster(s) I’m testing are rectangular, without null values. So reprojecting will change the pixel size (from a square to a rectangle), but it will (should) not change the number of pixels.

I’ll try in another GRASS version and post the results.

best

Carlos

···

On Mon, Nov 16, 2015 at 4:48 PM, César Augusto Ramírez Franco <caesarivs@gmail.com> wrote:

Hello Carlos,

Maybe it has something to do with the pixel resolution? I would certainly expect the same results, but with a very similar region (i.e. same number of rows and columns, or at least very close and a similar number of pixels)

Maybe when projecting the raster, the length of the array is varying but I wouldn’t expect to vary very much, are you getting the same results in a previous version of GRASS? (7.0 or even 6.4?)

Greetings

El nov. 16, 2015 11:35 AM, “Carlos Grohmann” <carlos.grohmann@gmail.com> escribió:

Hi all.

I’m analyzing some global-scale DEMs, like ETOPO1/2, SRTM30_PLUS, etc.

I’m getting the statistics for the whole dataset with r.univar, but today I noticed that the results differ if I use different projections. (GRASS 7.1)

For example, ETOPO2:

Using a latlong pseudo-projection (plate carré)

min: -10791
max: 8440
mean: -1888.6480792
median: -2457
stddev: 2650.01922839
p25: -4273
p75: 216

And using equal-area cylindrical:

min: -10791
max: 8440
mean: -2379.78247747
median: -3291
stddev: 2507.89668617
p25: -4541
p75: 94

Are these differences expected? I would think that they should be the same, regardless of projection (I’m thinking on the elevation values as an array of values).

thanks

Carlos

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://orcid.org/0000-0001-5073-5572


Can’t stop the signal.


grass-user mailing list
grass-user@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://orcid.org/0000-0001-5073-5572


Can’t stop the signal.

On Mon, Nov 16, 2015 at 5:34 PM, Carlos Grohmann
<carlos.grohmann@gmail.com> wrote:

Hi all.

I'm analyzing some global-scale DEMs, like ETOPO1/2, SRTM30_PLUS, etc.

I'm getting the statistics for the whole dataset with r.univar, but today I
noticed that the results differ if I use different projections. (GRASS 7.1)

Please post also *how* you reprojected (resampling method etc)

Markus

Ok, sorry about the incomplete post.

I reprojected from a latlong location to a cylindrical equal area projection, using the default nearest neighbor resampling method.

original location:

GRASS 7.1.svn (base_maps):~ > g.region -p raster=gdem_etopo1_ice
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

Equal area projection:

r.proj location=latlong mapset=base_maps input=gdem_etopo1_ice -g
Input map <gdem_etopo1_ice@base_maps> in location :
n=6363885.33192604 s=-6363885.33192604 w=-20037508.34278924 e=20037508.34278924 rows=10800 cols=21600
GRASS 7.1.svn (eqarea):~ > g.region -p n=6363885.33192604 s=-6363885.33192604 w=-20037508.34278924 e=20037508.34278924 rows=10800 cols=21600
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.proj location=latlong mapset=base_maps input=gdem_etopo1_ice

Here are the outputs of r.univar, for both locations:

Latlong

GRASS 7.1.svn (base_maps):~ > r.univar map=gdem_etopo1_ice -ge percentile=100
n=58320000
null_cells=0
cells=58320000
min=-10753
max=8333
range=19086
mean=-1892.08140334362
mean_of_abs=2644.85220128601
stddev=2650.12442373911
variance=7023159.46129855
coeff_var=-140.063974998956
sum=-110346187443
first_quartile=-4286
median=-2456
third_quartile=214
percentile_100=8333

Equal-area

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

I also tested in python, flattening the raster to an array. The results are the same as r.univar (in both cases).

best

Carlos

···

On Mon, Nov 16, 2015 at 5:32 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Mon, Nov 16, 2015 at 5:34 PM, Carlos Grohmann
<carlos.grohmann@gmail.com> wrote:

Hi all.

I’m analyzing some global-scale DEMs, like ETOPO1/2, SRTM30_PLUS, etc.

I’m getting the statistics for the whole dataset with r.univar, but today I
noticed that the results differ if I use different projections. (GRASS 7.1)

Please post also how you reprojected (resampling method etc)

Markus

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://orcid.org/0000-0001-5073-5572


Can’t stop the signal.

On Mon, Nov 16, 2015 at 8:47 PM, Carlos Grohmann
<carlos.grohmann@gmail.com> wrote:

Ok, sorry about the incomplete post.

I reprojected from a latlong location to a cylindrical equal area
projection, using the default nearest neighbor resampling method.

For continuous surfaces such as DEM I would use bilinear resampling method.

Best
Markus

Carlos,

···

2015-11-16 14:47 GMT-05:00 Carlos Grohmann <carlos.grohmann@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/

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@gmail.com> wrote:

Carlos,

2015-11-16 14:47 GMT-05:00 Carlos Grohmann <carlos.grohmann@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://orcid.org/0000-0001-5073-5572


Can’t stop the signal.

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

···

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@gmail.com> wrote:

Carlos,

2015-11-16 14:47 GMT-05:00 Carlos Grohmann <carlos.grohmann@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://orcid.org/0000-0001-5073-5572


Can’t stop the signal.

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.

regards

Carlos

···

On Tue, Nov 17, 2015 at 5:15 AM, Robl Jörg Christian <Joerg.Robl@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@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@gmail.com> wrote:

Carlos,

2015-11-16 14:47 GMT-05:00 Carlos Grohmann <carlos.grohmann@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://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://orcid.org/0000-0001-5073-5572


Can’t stop the signal.

On Tue, Nov 17, 2015 at 7:56 AM, Carlos Grohmann <carlos.grohmann@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@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@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@gmail.com> wrote:

Carlos,

2015-11-16 14:47 GMT-05:00 Carlos Grohmann <carlos.grohmann@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://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://orcid.org/0000-0001-5073-5572
________________
Can’t stop the signal.

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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?

···

On Tue, Nov 17, 2015 at 12:50 PM, Anna Petrášová <kratochanna@gmail.com> wrote:

On Tue, Nov 17, 2015 at 7:56 AM, Carlos Grohmann <carlos.grohmann@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


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

On Tue, Nov 17, 2015 at 5:15 AM, Robl Jörg Christian <Joerg.Robl@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@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@gmail.com> wrote:

Carlos,

2015-11-16 14:47 GMT-05:00 Carlos Grohmann <carlos.grohmann@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://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://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://orcid.org/0000-0001-5073-5572


Can’t stop the signal.

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. :wink:

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@gmail.com
<mailto:kratochanna@gmail.com>> wrote:

    On Tue, Nov 17, 2015 at 7:56 AM, Carlos Grohmann
    <carlos.grohmann@gmail.com <mailto:carlos.grohmann@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@sbg.ac.at <mailto:Joerg.Robl@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@lists.osgeo.org
            <mailto:grass-user-bounces@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@gmail.com <mailto:caesarivs@gmail.com>>
            wrote:____

            Carlos,____

            __ __

            2015-11-16 14:47 GMT-05:00 Carlos Grohmann
            <carlos.grohmann@gmail.com
            <mailto:carlos.grohmann@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/&gt;\_\_\_\_

            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/&gt;
        http://orcid.org/0000-0001-5073-5572
        ________________
        Can’t stop the signal.

        _______________________________________________
        grass-user mailing list
        grass-user@lists.osgeo.org <mailto:grass-user@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/&gt;
http://orcid.org/0000-0001-5073-5572
________________
Can’t stop the signal.

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

(attachments)

projected_pixels.png