[GRASS-user] Problem after import using r.in.ascii

Hanlie Pretorius hanlie.pretorius at gmail.com
Wed Apr 28 10:52:55 EDT 2010


Greetings Herbivores,

This is the first time that I've created a location and mapset fo my
own and I'm trying to import TRMM precipitation data into GRASS using
r.in.ascii.

I have an existing CSV file that has the headers lat, long and precip.
The precipitation is a floating point number to two decimal places.
The coordinates in the CSV file define the centre of a quarter degree
square. The first set of coordinates in the file is -19.625,15.875.

Becuase the TRMM data defines the centre of the square, I subtracted
0.125 from the first set of coordinates to get the north-west corner
of the raster. And I added 0.125 to the last coordinate in the CSV
file, which is -34.875,34.125, to get the south-east corner of the
raster.

In the CSV file, the latitude stays constant for 74 rows while the
longitude increments in quarter degree steps. The whole file contains
4588 rows, so a grid of the data should have 74 rows and 62 columns,
right?

So I reformatted the data to 74 rows and 62 columns and added the header:

north:	 -19.5
south:	 -35.0
east:	 15.75
west:	 34.25
rows:	 74
cols:	 62
null:	 -319.99


The output of g.region -p is:

projection: 3 (Latitude-Longitude)
zone:       0
datum:      wgs84
ellipsoid:  wgs84
north:      18S
south:      36S
west:       15E
east:       35E
nsres:      0:15
ewres:      0:15
rows:       72
cols:       80
cells:      5760


I then imported the reformatted file using the command:

r.in.ascii -f input="3B42RT.2010032409.6.bin.sa.grass"\
output="2010032409.6.precip" \
title="Precipitation 2010032409.6"\
mult=1.0 or read from header nv="* or read from header"


When imported, I get two thin strips of data on the sides of the
image. The raster shouldn't contain any nulls (the text file doesn't
contain the value -319.99), so something is wrong.

r.info gives a very strange resolutions:


 |   Type of Map:  raster               Number of Categories: 255
 |   Data Type:    FCELL
 |   Rows:         74
 |   Columns:      62
 |   Total Cells:  4588
 |        Projection: Latitude-Longitude
 |            N:     19:30S    S:        35S   Res: 0:12:34.054054
 |            E:     15:45E    W:     34:15E   Res: 5:30:29.032258
 |   Range of data:    min = 0.000000  max = 7.470000


Can someone perhaps help me to see what's happening here?

Thanks
Hanlie


More information about the grass-user mailing list