Simon Cox writes:
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 r.support to
make the rest. This worked fine except
(i) the negative values (bathymetry) have 65536 added to them
(ie -1m shows as 65535m elevation!)
(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? 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!It is now 10:30 pm and my brain is beginning to hurt with all this.
Can anyone offer clarification or suggestions?
These are interesting issues. With regard to Mr Cox's first problem I
would take a guess that perhaps the data on the CD-ROM are fromatted
with the most significant bit at the other end (as seen from Grass's
point of view). This should be easy to find out and convert. Otherwise
if it is a question of Grass being unable to contain the total range of
elevation values, one could mapcalc all obviously altered elevations
into their correct value, ie:
1) possible values range from -11000m (Marian trough) to +9000m (Mt
Everest
2) Any map value exceeding +10000m is therefore the result of the
value changes Mr Cox describes
3) All values over 10000m can therefore be mapcalced back to their
correct value by `new_value=old_value - 65536'
With regard to the second problem, Grass does indeed `align' cell
centers to the region boundaries current during data import. So a
5' cell with its center at 89:55:00s needs region boundaries of
89:52:30 and 89:57:30s, and the North Pole indeed poses a problem.
I'm appending a recent letter by Jim Aanstoos for good measure:
*******
There are 2 different aspects to the issue of NN resampling error--
errors due to misalignment of regions, and errors due to differing
resolutions of regions. If your resolutions are the same, but the
regions in question are not aligned the same (ie grid cell centers
don't fall at the same locations; note this does not require regions
to be IDENTICAL, just related by an integer multiple of the cell
size), then you will get location errors of up to 1/2 a cell size
worst case, and these errors will accumulate with each combination
of misaligned grids. If the RESOLUTIONS are different, this does
not necessarily cause any location errors because the grids can
still be aligned if the larger cells are integer multiples of the
smaller cell size. When this is not the case, you are subject to
the same type of sampling location errors mentioned above.
To minimize problems due to resampling, try to keep your regions
aligned with each other when possible. When not possible, try
using higher resolutions (ie, smaller cell sizes) for
intermediate layers and then resample the output to the desired
final resolution. Of course, this increases computational costs.
/\
jim /--\
/ \
______________________________________________________________________
Jim Aanstoos Internet: aanstoos%louie@rcc.rti.org
or aanstoos%louie@rti.rti.org
Research Triangle Institute
PO Box 12194 Phone: 919-541-6890
Research Triangle Park, NC 27709-2194 Fax: 919-541-6515
----------------------------------------------------------------------
BTW, does anyone know if the Grass SG3d module can display Mr Cox's
map as a 3d sphere? This would really astonish the brass at our
Faculty and perhaps make for some extra funding.....
----\_\_\_--\_----\_------\_-------------------- P. Martijn van Leusen --------
\_ \_ \_\_\_\_ \_ Dept of Pre- and Protohistoric Archaeology
\_\_\_ \_ \_ \_ \_ University of Amsterdam, The Netherlands
\_ \_ \_ \_\_ \_ martijn@scanner.frw.uva.nl
--------\_------\_----\_--\_--\_\_\_\_-----------------------------------------