importing global data

Greg Koerper greg at
Wed Aug 4 19:22:50 EDT 1993

The problems referred to by Simon Cox require serious consideration for users
of GRASS who are importing lat/lon data representing the entire surface of the
world.  GRASS data are cell centered.  Try out d.what.rast on the NW most cell
of your raster, and you will find that it returns
Thus NORTH and WEST define the outer boundaries of a cell, but the data for 
the NW most cell are associated with the center coordinates.

Simon runs into a problem trying to import a data point at the North Pole.
GRASS does not allow for a region definition where north is greater than N90.
There is no way to store cell-centered data representative of N90, thus
unless the user invokes a convention to circumvent the coordinate system,
there is no way to represent a data point associated with N90 in GRASS.
Several possibilities occur.  Two obvious ones are:

1) throw away data associated with lat N90 and S90.
2) interpolate the data PRIOR to entry into GRASS so that the surface still
    represents the entire world

The nature of your objective in the use of the data will determine the best
approach.  I'm sure there are others, and would like to hear about them.

> > 
> > I bought a copy of the NGDC_RELIEF CDRom, and am trying to import
> > some of the datasets into Grass.  This has revealed a deficiency
> > in my understanding of Grass raster maps.
> > 
> > The data I am first trying to import is the Global 5 minute elevation grid.
> > This is supplied in binary format, standard SUN 2-byte signed ints,
> > in 2160 rows x 4320 cols.  The first row represents the North Pole.
> > The last row represents 89:55:00S.
> > 
> > I set up a new location with North at 90N, South at 90S, West at 0,
> > East at 0, and a resolution of 5 minutes.  This gave the right number
> > of cells.  I then copied the file straight into a Grass cell directory,
> > made a few other support files in cellhd etc, and ran to
> > make the rest.  This worked fine except
> > 
> > (i) the negative values (bathymetry) have 65536 added to them
> > (ie -1m shows as 65535m elevation!)
> > 
> We had a similar problem with our elevation data, except they had wrapped
> at 32768 (=2^15) rather than 2^16.  We did a g.mapcalc, ex:
> 	elevation=if(oldelevation>65500,oldelevation-65536,oldelevation)

These both appear to be problems in converting signed integer data when
it has been assumed at some point in the process to be stored as unsigned
> > (ii) d.what.rast shows that the cells are misregistered by 2.5 degrees
> > South and (?) East.  Does d.what.rast give coords of cell *centres* or
> > one of the corners? 
But if these are 5 minute data, WHY are you off by 2.5 degrees????
> Center of cell
> > if the former, then this suggests that the region
> > should be set 1/2 a pixel outside the data.  Is this true?  In which case
> > we are in trouble here at the North Pole at least, as grass wont accept
> > 90:02:03N as a valid region boundary!
> I'm not sure I understand what you tried to do here, but it sounds like
> rather than changing your region, you might want to fiddle with the cellhd 
> north, south, east and west. 

I don't think any amount of fiddling will work unless the data are in some
way adjusted first, as with examples described above.
> > It is now 10:30 pm and my brain is beginning to hurt with all this.
> > Can anyone offer clarification or suggestions?

Have a good beer and sleep on it!
> > 
> > Thanks
> > 
> > Simon Cox
> > 
> > 
> > ----
> > __________________________________________________________________
> > 				Dr Simon Cox
> >          __  L				
> >       ,~'  L_|\            	Department of Earth Sciences       
> >    ,-'         \         	Monash University    
> >    (            \		Clayton  Vic  3168  Australia
> >    \    ___     /	
> >     L,~'   "\_x/		Phone +61 3 565 5762
> >               u   		Fax   +61 3 565 5062
> > 				simon at
> > __________________________________________________________________


Greg Koerper                            Internet: greg at
ManTech Environmental Technology, Inc.  UUCP:     hplabs!hp-pcd!orstcs!koerper
US EPA Environmental Research Lab
200 SW 35th St., JSB                    
Corvallis, OR   97333     Rush Limbaugh plucks the heartstrings of America:  
(503) 754-4490                "I'm OK, because they're not!" 
 fax:  (503) 754-4338

More information about the grass-user mailing list