How does one specify direction of scans in r.in.ascii?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How does one specify direction of scans in r.in.ascii?

Richard Wagener
I am trying to do the following data import:

I have a global surface albedo file which starts at -180 lon , -90 lat
and ends at 180 lon, 90 lat, in 1 degree increments.

In grass, I have defined a region North 90, South -90, East 360, West
0, and Resolution 1.125 deg by 1.125 deg.  When I do the r.in.ascii,
and display the data, I get a rasterfile with East and West and North
and South reversed (a mirror image of an upside down world).

Question: Is there a way to specify in the ASCII file which way the
data is stored in it?  E.g.: as positive or negative
latitude/longitude increments?
Or do I have to always prepare the ASCII data to run from North-East
to South-West?  Which to me is counter intuitive.

--
Tschuess ...rick...
_______________________________________________________________________________
Richard Wagener |
Bldg. 426, rm. 43 | IP: [hidden email]
Environmental Chemistry Division | DEC: 44048::rwagener
Brookhaven National Laboratory | phone: 1-516-282-5886
Upton, New York 11973, U.S.A. | fax:   1-516-282-2887
_______________________________________________________________________________

Reply | Threaded
Open this post in threaded view
|

Re: How does one specify direction of scans in r.in.ascii?

Michael Shapiro-3
(1) If the raster file is displaying upside down, then the data must be
stored liked that. GRASS doesn't flip data based on the header
coordinates. It just uses them to figure out how many rows and columns
are in the datafile. So this means you either must rotate (m.rot90) or
flip (m.flip) your datafile. Since you have an ascii file, import it
using r.in.ascii as you did, then uncompress the raster file. Then run
either m.rot90 and/or m.flip directly on the cell file (under cell/).

(2) There is some confusion in your description of the data. If the
data is really 90N to 90s in 1 degree increments, then there should be
180 rows of data. 1.125 implies:
        160 rows: (90 - -90)/1.125 = 180/1.125 = 160
and
     320 columns: (180 - -180)/1.125 = 360/1.125 = 320.

Can you specify how many rows and columns there are in the data?  Are
the coordinates you give for the "edges" true edges or do they go thru
the center of the edge rows and columns, or are they some other logic
(eg, upper left hand corner of the NW and SE corner cells).

|
|I am trying to do the following data import:
|
|I have a global surface albedo file which starts at -180 lon , -90 lat
|and ends at 180 lon, 90 lat, in 1 degree increments.
|
|In grass, I have defined a region North 90, South -90, East 360, West
|0, and Resolution 1.125 deg by 1.125 deg.  When I do the r.in.ascii,
|and display the data, I get a rasterfile with East and West and North
|and South reversed (a mirror image of an upside down world).
|
|Question: Is there a way to specify in the ASCII file which way the
|data is stored in it?  E.g.: as positive or negative
|latitude/longitude increments?
|Or do I have to always prepare the ASCII data to run from North-East
|to South-West?  Which to me is counter intuitive.
|
|--
|Tschuess ...rick...
|_______________________________________________________________________________
|Richard Wagener |
|Bldg. 426, rm. 43 | IP: [hidden email]
|Environmental Chemistry Division | DEC: 44048::rwagener
|Brookhaven National Laboratory | phone: 1-516-282-5886
|Upton, New York 11973, U.S.A. | fax:   1-516-282-2887
|_______________________________________________________________________________
|
|

Reply | Threaded
Open this post in threaded view
|

followup question on r.in.ascii

Richard Wagener
I have one more question concerning r.in.ascii:  When
you specify a region with a different grid than the r.in.ascii ASCII
input file, what algorithm does r.in.ascii use to fill the new grid?
Is it nearest neighbor or some kind of bilinear interpolation or
averaging?

In my case the input file is a 1 deg by 1 deg lat/lon grid but I want the
GRASS grid to be 1.125 by 1.125 to match the other raster files that I
already have in that data-base.

--
Tschuess ...rick...
_______________________________________________________________________________
Richard Wagener |
Bldg. 426, rm. 43 | IP: [hidden email]
Environmental Chemistry Division | DEC: 44048::rwagener
Brookhaven National Laboratory | phone: 1-516-282-5886
Upton, New York 11973, U.S.A. | fax:   1-516-282-2887
_______________________________________________________________________________