Re: [GRASS-user] Problem with g.region in lat-lon projection

2011-11-30 Thread Markus Metz
John A Stevenson wrote:
 Hi,

 I am trying to set up a grid with a specified resolution using g.region.
  The information about the grid that came with the data that I want to plot
 is:
  X grid origin:                0.2812500
  Y grid origin:                -89.81250
  X grid size:                         640
  Y grid size:                         480
  X grid resolution:            0.5625000
  Y grid resolution:            0.375

 I set up the grid with the following command:

 GRASS 6.4.1 (global_ll_wgs84):~/NAME/G2011  g.region w=0.2812500
 s=-89.81250 cols=640 rows=480 ewres=0.562500 nsres=0.375

 I would expect this grid to cover the whole globe (e.g. 640*0.5625=360), but
 instead it just generates a thin strip, and the ewres is too small.

 GRASS 6.4.1 (global_ll_wgs84):~/NAME/G2011  g.region -p
 projection: 3 (Latitude-Longitude)
 zone:       0
 datum:      wgs84
 ellipsoid:  wgs84
 north:      74N
 south:      89:48:45S
 west:       0:16:52.5E
 east:       24E
 nsres:      0:20:28.59375
 ewres:      0:02:13.417969
 rows:       480
 cols:       640
 cells:      307200

 Where am I going wrong?

I think GRASS prefers to have all the extents n,s,e,w and either
rows/cols or resolution to calculate a region.

With the information available,
North =  -89.81250 + 480 * 0.375 = 90.1875
Interestingly, the North deviation from 90N and the South deviation
from 90S is 0.1875 = 0.375 / 2, half a cell

East = 0.2812500 + 640 * 0.5625 = 360.28125
Interestingly, the East deviation from 360E and the West deviation
from 0 is 0.28125 = 0.5625 / 2, half a cell

It is therefore possible that the true region extents are n=90 s=-90
w=0 e=360 and that X and Y grid origin refer to the center, not the
corner of the lower left cell.

This should work:
g.region n=90 s=-90 w=0 e=360 rows=480 cols=640 -p
and
r.region map=my_map n=90 s=-90 w=0 e=360

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


[GRASS-user] Problem with g.region in lat-lon projection

2011-11-28 Thread John A Stevenson

Hi,

I am trying to set up a grid with a specified resolution using 
g.region.  The information about the grid that came with the data that I 
want to plot is:

 X grid origin:0.2812500
 Y grid origin:-89.81250
 X grid size: 640
 Y grid size: 480
 X grid resolution:0.5625000
 Y grid resolution:0.375

I set up the grid with the following command:

GRASS 6.4.1 (global_ll_wgs84):~/NAME/G2011  g.region w=0.2812500 
s=-89.81250 cols=640 rows=480 ewres=0.562500 nsres=0.375


I would expect this grid to cover the whole globe (e.g. 640*0.5625=360), 
but instead it just generates a thin strip, and the ewres is too small.


GRASS 6.4.1 (global_ll_wgs84):~/NAME/G2011  g.region -p
projection: 3 (Latitude-Longitude)
zone:   0
datum:  wgs84
ellipsoid:  wgs84
north:  74N
south:  89:48:45S
west:   0:16:52.5E
east:   24E
nsres:  0:20:28.59375
ewres:  0:02:13.417969
rows:   480
cols:   640
cells:  307200

Where am I going wrong?

John

--
Dr John A Stevenson
RSE/Scottish Government Personal Research Fellow
(co-funded by Marie Curie Actions)
School of GeoSciences
The University of Edinburgh
Grant Institute
West Mains Road
Edinburgh EH9 3JW
Scotland
PHONE: (+44) 131 650 7526
FAX:   (+44) 131 668 3184
email: john.steven...@ed.ac.uk
web: http://www.geos.ed.ac.uk/homes/jsteven5
blog: http://all-geo.org/volcan01010


The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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


Re: [GRASS-user] Problem with g.region in lat-lon projection

2011-11-28 Thread Moritz Lennert

On 28/11/11 13:23, John A Stevenson wrote:

Hi,

I am trying to set up a grid with a specified resolution using
g.region. The information about the grid that came with the data that
I want to plot is: X grid origin: 0.2812500 Y grid origin: -89.81250
X grid size: 640 Y grid size: 480 X grid resolution: 0.5625000 Y grid
resolution: 0.375

I set up the grid with the following command:

GRASS 6.4.1 (global_ll_wgs84):~/NAME/G2011  g.region w=0.2812500
s=-89.81250 cols=640 rows=480 ewres=0.562500 nsres=0.375

I would expect this grid to cover the whole globe (e.g.
640*0.5625=360), but instead it just generates a thin strip, and the
ewres is too small.



If you have existing settings for e and n, it will keep those. You have
to use g.region -d to reset to default values (assuming your default 
values are -180 - 180  -90 - 90).


However, I think that g.region maxes out at 180E and 90N. When I use
your settings, I get the following:

GRASS 6.4.1 (LLWGS84):~  g.region -d w=0.2812500 s=-89.81250 cols=640
rows=480 ewres=0.562500 nsres=0.375 -p
projection: 3 (Latitude-Longitude)
zone:   0
datum:  wgs84
ellipsoid:  wgs84
north:  90N
south:  89:48:45S
west:   0:16:52.5E
east:   180E
nsres:  0:22:28.59375
ewres:  0:16:50.917969
rows:   480
cols:   640
cells:  307200

or by aligning to resolution:

GRASS 6.4.1 (LLWGS84):~  g.region -d w=0.2812500 s=-89.81250 cols=640
rows=480 ewres=0.562500 nsres=0.375 -pa
projection: 3 (Latitude-Longitude)
zone:   0
datum:  wgs84
ellipsoid:  wgs84
north:  90N
south:  90S
west:   0
east:   180E
nsres:  0:22:30
ewres:  0:16:52.5
rows:   480
cols:   640
cells:  307200

i.e. it adapts the resolution in order to get 640 columns between 0W and 
180E.


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


Re: [GRASS-user] Problem with g.region in lat-lon projection

2011-11-28 Thread Hamish
John wrote:
 I am trying to set up a grid with a specified
 resolution using g.region.  The information about
 the grid that came with the data that I want to
 plot is:
  X grid origin:           
     0.2812500
  Y grid origin:           
     -89.81250
  X grid size:           
              640
  Y grid size:           
              480
  X grid resolution:         
   0.5625000
  Y grid resolution:         
   0.375
 
 I set up the grid with the following command:
...


dumb question: does this work?

r.info your_imported_map
g.region rast=your_imported_map

do you know if the original data used the cell-
center registered or grid line-confluence registered
convention?


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