[GRASS-user] TRMM (3B43) handling

Hey list,

I'm battling to import the 43b3 Product (TRMM perspiration + other
sources) for more than 5 hours into grass without any success.

gdalinfo doesnt list any list any subsets :frowning:

I only had some minor victories with `ncdump-hdf` (dumbing the actual
data and then r.in.ascii) but I had problems truncating the actual data
from the metadata.
Im sure there must be a way, any suggestions if you had any work
experience is more than welcome

ps

here's a 4b43 product to play with if you feel like it

Best regards

Ves Nikos

On Sun, Nov 14, 2010 at 4:01 PM, nikos <vesnikos@gmail.com> wrote:

Hey list,

I'm battling to import the 43b3 Product (TRMM perspiration + other

(http://disc.sci.gsfc.nasa.gov/precipitation/documentation/TRMM_README/TRMM_3B42_readme.shtml)

sources) for more than 5 hours into grass without any success.

gdalinfo doesnt list any list any subsets :frowning:

Does
gdalinfo --formats
list the HDF driver?

For
ftp://pps.gsfc.nasa.gov/trmmdata/ByDate/V06/2006/10/01/3B43.061001.6.HDF.gz
I get this:

gdalinfo 3B43.061001.6.HDF
Driver: HDF4/Hierarchical Data Format Release 4
Files: 3B43.061001.6.HDF
Size is 512, 512
Coordinate System is `'
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 512.0)
Upper Right ( 512.0, 0.0)
Lower Right ( 512.0, 512.0)
Center ( 256.0, 256.0)

gdalwarp 3B43.061001.6.HDF test.tif
Input file 3B43.061001.6.HDF has no raster bands.

This indicates that GDAL 1.7 does not support this HDF subformat of TRMM.

I see right now this:
http://trac.osgeo.org/gdal/ticket/3597

Apparently fixed in GDAL 1.8? Can you update and report here?

Markus

Interesting results, read on

On Sun, 2010-11-14 at 16:35 +0100, Markus Neteler wrote:

On Sun, Nov 14, 2010 at 4:01 PM, nikos <vesnikos@gmail.com> wrote:
> Hey list,
>
>
> I'm battling to import the 43b3 Product (TRMM perspiration + other

(http://disc.sci.gsfc.nasa.gov/precipitation/documentation/TRMM_README/TRMM_3B42_readme.shtml)

> sources) for more than 5 hours into grass without any success.
>
> gdalinfo doesnt list any list any subsets :frowning:

Does
gdalinfo --formats
list the HDF driver?

$ gdalinfo --version
GDAL 1.7.2, released 2010/04/23

$ gdalinfo --formats | grep HDF
  HDF4 (ro): Hierarchical Data Format Release 4
  HDF4Image (rw+): HDF4 Dataset
  HDF5 (ro): Hierarchical Data Format Release 5
  HDF5Image (ro): HDF5 Datase

For
ftp://pps.gsfc.nasa.gov/trmmdata/ByDate/V06/2006/10/01/3B43.061001.6.HDF.gz
I get this:

gdalinfo 3B43.061001.6.HDF
Driver: HDF4/Hierarchical Data Format Release 4
Files: 3B43.061001.6.HDF
Size is 512, 512
Coordinate System is `'
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 512.0)
Upper Right ( 512.0, 0.0)
Lower Right ( 512.0, 512.0)
Center ( 256.0, 256.0)

gdalwarp 3B43.061001.6.HDF test.tif
Input file 3B43.061001.6.HDF has no raster bands.

This indicates that GDAL 1.7 does not support this HDF subformat of TRMM.

I see right now this:
http://trac.osgeo.org/gdal/ticket/3597

Apparently fixed in GDAL 1.8? Can you update and report here?

GDAL 1.8dev, released 2010/01/19

./gdalinfo ~/TRMM-3B43/3B43.060801.6.HDF
Driver: HDF4/Hierarchical Data Format Release 4
Files: /home/nikos/greece-hdf/TRMM-3B43/3B43.060801.6.HDF
Size is 512, 512
Coordinate System is `'
Subdatasets:

SUBDATASET_1_NAME=HDF4_SDS:UNKNOWN:"/home/nikos/greece-hdf/TRMM-3B43/3B43.060801.6.HDF":0
  SUBDATASET_1_DESC=[1x1440x400] precipitation (32-bit floating-point)

SUBDATASET_2_NAME=HDF4_SDS:UNKNOWN:"/home/nikos/greece-hdf/TRMM-3B43/3B43.060801.6.HDF":1
  SUBDATASET_2_DESC=[1x1440x400] relativeError (32-bit floating-point)
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 512.0)
Upper Right ( 512.0, 0.0)
Lower Right ( 512.0, 512.0)
Center ( 256.0, 256.0)

----
works

gdal version 1.7.3 doesn't incorporate the fix (based on the release
log) so if anyones reading this should go for 1.8.0+

Markus

Now that I ID the sbs,

I tried

./gdal_translate -a_ullr -180 50 -50 180
HDF4_SDS:UNKNOWN:"/DIR/OF/TRMM_IMAGE/3B43.060801.6.HDF":1 test.tif

which makes an interesting tif, that is not empty, but when I load it
with qgis (use psedocolor) its square(?). The image should have a
1440/400 ratio.

Best regards,

Nikos Ves

On Sun, Nov 14, 2010 at 7:42 PM, nikos <vesnikos@gmail.com> wrote:

On Sun, 2010-11-14 at 16:35 +0100, Markus Neteler wrote:

On Sun, Nov 14, 2010 at 4:01 PM, nikos <vesnikos@gmail.com> wrote:
> Hey list,
>
>
> I'm battling to import the 43b3 Product (TRMM perspiration + other

(http://disc.sci.gsfc.nasa.gov/precipitation/documentation/TRMM_README/TRMM_3B42_readme.shtml)

...

This indicates that GDAL 1.7 does not support this HDF subformat of TRMM.

I see right now this:
http://trac.osgeo.org/gdal/ticket/3597

Apparently fixed in GDAL 1.8? Can you update and report here?

GDAL 1.8dev, released 2010/01/19

./gdalinfo ~/TRMM-3B43/3B43.060801.6.HDF
Driver: HDF4/Hierarchical Data Format Release 4
Files: /home/nikos/greece-hdf/TRMM-3B43/3B43.060801.6.HDF
Size is 512, 512
Coordinate System is `'
Subdatasets:

SUBDATASET_1_NAME=HDF4_SDS:UNKNOWN:"/home/nikos/greece-hdf/TRMM-3B43/3B43.060801.6.HDF":0
SUBDATASET_1_DESC=[1x1440x400] precipitation (32-bit floating-point)

SUBDATASET_2_NAME=HDF4_SDS:UNKNOWN:"/home/nikos/greece-hdf/TRMM-3B43/3B43.060801.6.HDF":1
SUBDATASET_2_DESC=[1x1440x400] relativeError (32-bit floating-point)
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 512.0)
Upper Right ( 512.0, 0.0)
Lower Right ( 512.0, 512.0)
Center ( 256.0, 256.0)

----
works

...excellent!

gdal version 1.7.3 doesn't incorporate the fix (based on the release
log) so if anyones reading this should go for 1.8.0+

(we could ask backport to 1.7)

Markus

Now that I ID the sbs,

I tried

./gdal_translate -a_ullr -180 50 -50 180
HDF4_SDS:UNKNOWN:"/DIR/OF/TRMM_IMAGE/3B43.060801.6.HDF":1 test.tif

which makes an interesting tif, that is not empty, but when I load it
with qgis (use psedocolor) its square(?). The image should have a
1440/400 ratio.

Wait - AFAIK you need to use "gdalwarp" on it, not gdal_translate.

cheers
Markus

On Sun, Nov 14, 2010 at 8:41 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Sun, Nov 14, 2010 at 7:42 PM, nikos <vesnikos@gmail.com> wrote:

On Sun, 2010-11-14 at 16:35 +0100, Markus Neteler wrote:

On Sun, Nov 14, 2010 at 4:01 PM, nikos <vesnikos@gmail.com> wrote:
>
>
> I'm battling to import the 43b3 Product (TRMM perspiration + other

(http://disc.sci.gsfc.nasa.gov/precipitation/documentation/TRMM_README/TRMM_3B42_readme.shtml)

You could also use the TRMM tools [1] to dump the data to a raw binary
file. Last time I did that I noted that the binary file is rotated by
90°, i.e. north is right and west is up (or north is left and west is
down, forgot the rotation direction).

I tried

./gdal_translate -a_ullr -180 50 -50 180
HDF4_SDS:UNKNOWN:"/DIR/OF/TRMM_IMAGE/3B43.060801.6.HDF":1 test.tif

which makes an interesting tif, that is not empty, but when I load it
with qgis (use psedocolor) its square(?). The image should have a
1440/400 ratio.

What does
gdalinfo HDF4_SDS:UNKNOWN:"/DIR/OF/TRMM_IMAGE/3B43.060801.6.HDF":1
say? There should be 400 rows and 1440 columns, and not vice versa,
1440 rows and 400 columns (suspected 90° rotation mentioned above).

Wait - AFAIK you need to use "gdalwarp" on it, not gdal_translate.

Hm, there is no coordinate system specified in the hdf, so gdalwarp
would only work with -s_srs wgs84 -t_srs <something else than wgs84>.
Or translate first, add gcps during translation, then warp?

Markus M

[1] ftp://disc2.nascom.nasa.gov/software/trmm_software/Read_HDF/READTRMM_V2.tar

hey list,

Sorry that I took so much to respond,

I'm orientating in a different direction right now, and I'd like an
opinion (on TRMM 3B43 ofc).

Here are my thoughts:

a) the hdf that delivers the product only wraps a table 1400 long x 440
tall. Each tile is represented by known cords. eg the upper left tile
( [0][0] ) have the coords of -180deg, 50deg. This is a fact. And also
it is a fact the dArc from each tile to another tile (horizontally and
vertically) its 0.25arcs.
b) So we can controllably somehow "dump" the data into a csv of x,y z
where z are mm/hr (3b43 specification). x,y in a φ,λ coordinate system
(reprojections and projections are not my strong point).

   results are 1440 x 400 points with known known coords and values.

c) interpolate for the area you're interested for.

d) You got yourself a raster to have fun with.

Taken into account the reprojection from φ,λ is possible and a viable
solution, the hard part seems to be getting the data. Here's my solution
on that: Giovanni Interface so kindly provided by nasa.gov . You get the
data in ascii format for the area you're researching for and free to
work with htem.

Here's an example on data dump:

http://disc2.nascom.nasa.gov/daac-bin/Giovanni/tovas/Giovanni_cgi.pl?west=16.0&north=43.0&east=30.0&south=31.0&params=1|3B43\_V6&amp;plot\_type=Area\+Plot&amp;byr=2006&amp;bmo=05&amp;eyr=2006&amp;emo=05&amp;begin\_date=1998/01&amp;end\_date=2010/10&amp;cbar=cdyn&amp;cmin=&amp;cmax=&amp;yaxis=ydyn&amp;ymin=&amp;ymax=&amp;yint=&amp;ascres=0\.25x0\.25&amp;global\_cfg=tovas\.global\.cfg\.pl&amp;instance\_id=TRMM\_V6&amp;prod\_id=3B43&amp;action=ASCII\+Output

My thoughts are that a python script that utilities the above method is
possible.

Any thoughts on my comments would be really appreciated.

Best Regards,
Nick Ves

On Mon, 2010-11-15 at 11:03 +0100, Markus Metz wrote:

On Sun, Nov 14, 2010 at 8:41 PM, Markus Neteler <neteler@osgeo.org> wrote:
> On Sun, Nov 14, 2010 at 7:42 PM, nikos <vesnikos@gmail.com> wrote:
>> On Sun, 2010-11-14 at 16:35 +0100, Markus Neteler wrote:
>>> On Sun, Nov 14, 2010 at 4:01 PM, nikos <vesnikos@gmail.com> wrote:
>>> >
>>> >
>>> > I'm battling to import the 43b3 Product (TRMM perspiration + other
>>>
>>> (http://disc.sci.gsfc.nasa.gov/precipitation/documentation/TRMM_README/TRMM_3B42_readme.shtml)

You could also use the TRMM tools [1] to dump the data to a raw binary
file. Last time I did that I noted that the binary file is rotated by
90°, i.e. north is right and west is up (or north is left and west is
down, forgot the rotation direction).

>>
>> I tried
>>
>> ./gdal_translate -a_ullr -180 50 -50 180
>> HDF4_SDS:UNKNOWN:"/DIR/OF/TRMM_IMAGE/3B43.060801.6.HDF":1 test.tif
>>
>> which makes an interesting tif, that is not empty, but when I load it
>> with qgis (use psedocolor) its square(?). The image should have a
>> 1440/400 ratio.

What does
gdalinfo HDF4_SDS:UNKNOWN:"/DIR/OF/TRMM_IMAGE/3B43.060801.6.HDF":1
say? There should be 400 rows and 1440 columns, and not vice versa,
1440 rows and 400 columns (suspected 90° rotation mentioned above).

>
> Wait - AFAIK you need to use "gdalwarp" on it, not gdal_translate.
>

Hm, there is no coordinate system specified in the hdf, so gdalwarp
would only work with -s_srs wgs84 -t_srs <something else than wgs84>.
Or translate first, add gcps during translation, then warp?

Markus M

[1] ftp://disc2.nascom.nasa.gov/software/trmm_software/Read_HDF/READTRMM_V2.tar

nikos wrote:

hey list,

Sorry that I took so much to respond,

I'm orientating in a different direction right now, and I'd like an
opinion (on TRMM 3B43 ofc).

Another option:
get binary grids from here
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/
read
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/3B43.ctl

import into a latlon location with r.in.bin -f -b north=50 south=-50
east=180 west=-180 rows=400 cols=1440, e.g.
r.in.bin -f -b input=3B43.100101.6.precipitation.bin
output=3B43.100101.6.precipitation north=50 south=-50 east=180
west=-180 rows=400 cols=1440

optionally convert mm/hr to some other time unit

This can be easily scripted to automatically get and process the
complete TRMM 3B43_V6 dataset.

my0.2c

Markus M

Here are my thoughts:

a) the hdf that delivers the product only wraps a table 1400 long x 440
tall. Each tile is represented by known cords. eg the upper left tile
( [0][0] ) have the coords of -180deg, 50deg. This is a fact. And also
it is a fact the dArc from each tile to another tile (horizontally and
vertically) its 0.25arcs.
b) So we can controllably somehow "dump" the data into a csv of x,y z
where z are mm/hr (3b43 specification). x,y in a φ,λ coordinate system
(reprojections and projections are not my strong point).

results are 1440 x 400 points with known known coords and values.

c) interpolate for the area you're interested for.

d) You got yourself a raster to have fun with.

Taken into account the reprojection from φ,λ is possible and a viable
solution, the hard part seems to be getting the data. Here's my solution
on that: Giovanni Interface so kindly provided by nasa.gov . You get the
data in ascii format for the area you're researching for and free to
work with htem.

Here's an example on data dump:

http://disc2.nascom.nasa.gov/daac-bin/Giovanni/tovas/Giovanni_cgi.pl?west=16.0&north=43.0&east=30.0&south=31.0&params=1|3B43\_V6&amp;plot\_type=Area\+Plot&amp;byr=2006&amp;bmo=05&amp;eyr=2006&amp;emo=05&amp;begin\_date=1998/01&amp;end\_date=2010/10&amp;cbar=cdyn&amp;cmin=&amp;cmax=&amp;yaxis=ydyn&amp;ymin=&amp;ymax=&amp;yint=&amp;ascres=0\.25x0\.25&amp;global\_cfg=tovas\.global\.cfg\.pl&amp;instance\_id=TRMM\_V6&amp;prod\_id=3B43&amp;action=ASCII\+Output

My thoughts are that a python script that utilities the above method is
possible.

Any thoughts on my comments would be really appreciated.

Best Regards,
Nick Ves

On Mon, 2010-11-15 at 11:03 +0100, Markus Metz wrote:

On Sun, Nov 14, 2010 at 8:41 PM, Markus Neteler <neteler@osgeo.org> wrote:
> On Sun, Nov 14, 2010 at 7:42 PM, nikos <vesnikos@gmail.com> wrote:
>> On Sun, 2010-11-14 at 16:35 +0100, Markus Neteler wrote:
>>> On Sun, Nov 14, 2010 at 4:01 PM, nikos <vesnikos@gmail.com> wrote:
>>> >
>>> >
>>> > I'm battling to import the 43b3 Product (TRMM perspiration + other
>>>
>>> (http://disc.sci.gsfc.nasa.gov/precipitation/documentation/TRMM_README/TRMM_3B42_readme.shtml)

You could also use the TRMM tools [1] to dump the data to a raw binary
file. Last time I did that I noted that the binary file is rotated by
90°, i.e. north is right and west is up (or north is left and west is
down, forgot the rotation direction).

>>
>> I tried
>>
>> ./gdal_translate -a_ullr -180 50 -50 180
>> HDF4_SDS:UNKNOWN:"/DIR/OF/TRMM_IMAGE/3B43.060801.6.HDF":1 test.tif
>>
>> which makes an interesting tif, that is not empty, but when I load it
>> with qgis (use psedocolor) its square(?). The image should have a
>> 1440/400 ratio.

What does
gdalinfo HDF4_SDS:UNKNOWN:"/DIR/OF/TRMM_IMAGE/3B43.060801.6.HDF":1
say? There should be 400 rows and 1440 columns, and not vice versa,
1440 rows and 400 columns (suspected 90° rotation mentioned above).

>
> Wait - AFAIK you need to use "gdalwarp" on it, not gdal_translate.
>

Hm, there is no coordinate system specified in the hdf, so gdalwarp
would only work with -s_srs wgs84 -t_srs <something else than wgs84>.
Or translate first, add gcps during translation, then warp?

Markus M

[1] ftp://disc2.nascom.nasa.gov/software/trmm_software/Read_HDF/READTRMM_V2.tar

On Wed, Nov 17, 2010 at 10:08 AM, Markus Metz
<markus.metz.giswork@googlemail.com> wrote:

nikos wrote:

hey list,

Sorry that I took so much to respond,

I'm orientating in a different direction right now, and I'd like an
opinion (on TRMM 3B43 ofc).

Another option:
get binary grids from here
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/
read
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/3B43.ctl

import into a latlon location with r.in.bin -f -b north=50 south=-50
east=180 west=-180 rows=400 cols=1440, e.g.
r.in.bin -f -b input=3B43.100101.6.precipitation.bin
output=3B43.100101.6.precipitation north=50 south=-50 east=180
west=-180 rows=400 cols=1440

optionally convert mm/hr to some other time unit

This can be easily scripted to automatically get and process the
complete TRMM 3B43_V6 dataset.

Nice, written up as FAQ:
http://grass.osgeo.org/wiki/Import_TRMM

Markus

Markus Neteler wrote:

Markus Metz wrote:

nikos wrote:

hey list,

Sorry that I took so much to respond,

I'm orientating in a different direction right now, and I'd like an
opinion (on TRMM 3B43 ofc).

Another option:
get binary grids from here
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/
read
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/3B43.ctl

import into a latlon location with r.in.bin -f -b north=50 south=-50
east=180 west=-180 rows=400 cols=1440, e.g.
r.in.bin -f -b input=3B43.100101.6.precipitation.bin
output=3B43.100101.6.precipitation north=50 south=-50 east=180
west=-180 rows=400 cols=1440

optionally convert mm/hr to some other time unit

This can be easily scripted to automatically get and process the
complete TRMM 3B43_V6 dataset.

Nice, written up as FAQ:
http://grass.osgeo.org/wiki/Import_TRMM

BTW, the TRMM 3B43 hdf files are really rotated 90° clockwise, north
is right and west is up.
The included datasets precipitation and error can be dumped from the
hdf files to a binary or ascii file with
the hdp tool which should be on any system that has the HDF4 library installed.
precipitation with
hdp dumpsds -r 4 -d -o <outfile> -b <TRMM 3B43 hdf file>
and error with
hdp dumpsds -r 5 -d -o <outfile> -b <TRMM 3B43 hdf file>

These are rotated and need to be rotated back. The (properly oriented)
binary grids are much easier to handle than the hdf files.

Markus M

On Wed, 2010-11-17 at 10:08 +0100, Markus Metz wrote:

Another option:
get binary grids from here
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/
read
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/3B43.ctl

import into a latlon location with r.in.bin -f -b north=50 south=-50
east=180 west=-180 rows=400 cols=1440, e.g.
r.in.bin -f -b input=3B43.100101.6.precipitation.bin
output=3B43.100101.6.precipitation north=50 south=-50 east=180
west=-180 rows=400 cols=1440

i was comparing the output rasters with a png [1] a same period.
eg Jul_2006. it seems that in the bin [2] file N is S and vise versa.
The phenomenon can be seen clearly by comparing the western coast of
India between [1] and [2]

I don't think I'm doing something wrong, but can anyone cross check just
to be sure I didn't anything stupid on my side?

Best regards

Ves Nikos

[1] http://tinyurl.com/382rmhe (tinyurl not to spam)
[2] http://tinyurl.com/3xxpzfw (3B43.060801.6.precipitation.bin)

nikos ves wrote:

On Wed, 2010-11-17 at 10:08 +0100, Markus Metz wrote:

Another option:
get binary grids from here
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/
read
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/3B43.ctl

import into a latlon location with r.in.bin -f -b north=50 south=-50
east=180 west=-180 rows=400 cols=1440, e.g.
r.in.bin -f -b input=3B43.100101.6.precipitation.bin
output=3B43.100101.6.precipitation north=50 south=-50 east=180
west=-180 rows=400 cols=1440

i was comparing the output rasters with a png [1] a same period.
eg Jul_2006. it seems that in the bin [2] file N is S and vise versa.
The phenomenon can be seen clearly by comparing the western coast of
India between [1] and [2]

I don't think I'm doing something wrong, but can anyone cross check just
to be sure I didn't anything stupid on my side?

Confirmed, that's maybe the reason why these binary grids are well hidden.

Looks like there is no way around setting GCPs and using i.rectify,
either with these binary grids or with the hdf dumps.

Markus M

On Fri, Nov 19, 2010 at 8:40 AM, Markus Metz
<markus.metz.giswork@googlemail.com> wrote:

nikos ves wrote:

On Wed, 2010-11-17 at 10:08 +0100, Markus Metz wrote:

Another option:
get binary grids from here
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/
read
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/3B43.ctl

import into a latlon location with r.in.bin -f -b north=50 south=-50
east=180 west=-180 rows=400 cols=1440, e.g.
r.in.bin -f -b input=3B43.100101.6.precipitation.bin
output=3B43.100101.6.precipitation north=50 south=-50 east=180
west=-180 rows=400 cols=1440

i was comparing the output rasters with a png [1] a same period.
eg Jul_2006. it seems that in the bin [2] file N is S and vise versa.
The phenomenon can be seen clearly by comparing the western coast of
India between [1] and [2]

I don't think I'm doing something wrong, but can anyone cross check just
to be sure I didn't anything stupid on my side?

Confirmed, that's maybe the reason why these binary grids are well hidden.

Looks like there is no way around setting GCPs and using i.rectify,
either with these binary grids or with the hdf dumps.

how about flipping it with GDAL VRT and gdalwarp? Below I cite an older
email from the GDAL list with a similar problem + solution.

Markus

PS: From gdal mailing list:

On Fri, Jan 16, 2009 at 9:52 PM, Frank Warmerdam wrote:

Greg Ederer wrote:

Hi,

I'm running gdal_translate against a VRT file:

<VRTDataset rasterXSize="751" rasterYSize="801">
<GeoTransform>-20.05, 0.1, 0.0, 40.05, 0.0, -0.1</GeoTransform>
<SRS>
       GEOGCS[&quot;WGS 84&quot;,
           DATUM[&quot;WGS_1984&quot;,
                   SPHEROID[&quot;WGS 84&quot;,6378137,298.2572235630016,
                           AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]],
                   AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]],
           PRIMEM[&quot;Greenwich&quot;,0],
           UNIT[&quot;degree&quot;,0.0174532925199433],
           AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]
</SRS>
<VRTRasterBand dataType="Float32" band="1" subClass="VRTRawRasterBand">
   <SourceFilename relativetoVRT="1">10day_precip.bin.1999121</SourceFilename>
   <ImageOffset>0</ImageOffset>
   <PixelOffset>4</PixelOffset>
   <LineOffset>3004</LineOffset>
   <ByteOrder>MSB</ByteOrder>
   <NoDataValue>-999.0</NoDataValue>
</VRTRasterBand>
</VRTDataset>

I just noticed that the resulting GeoTIFF is upside down. Is this a
problem with my GeoTransform values? If so, what values would produce the
image right side up?

Greg,

I don't see any obvious problem with the geotransform values.

Perhaps the image really is upside on disk. If so, you could flip it as
it is read by changing your values to

<ImageOffset>2403200</ImageOffset>
<PixelOffset>4</PixelOffset>
<LineOffset>-3004</LineOffset>

Best regards,

Sorry for barging in, don't know much about 3b43 product but I'm
beginning to look at the daily 3b42 and I believe the data format
might be the same.

From their FAQ [1], the lat/long for the hdf and binary files are

different. The binary files are set up to be read in GrADS and that
software stores binary files from south to north. So, as the FAQ
states, the first coordinate in the bin file is (-49.875,-179.875),
the second is (-49.875,-179.625).

I've run into this problem before (Importing upside down GrADS binary
data into GRASS) and my solution was to flip the binary file prior to
running r.in.bin. So I wrote a quick python code to flip the bin file.
The attached python script (vira_mapa.py) should take care of the job.
All you need to do is edit the file and input the number of lines
(nlin) and columns (ncol). To run the program just do ./vira_mapa.py
binary_file_name. It will output the flipped map in a file named
mapa_virado.bin.

Hope it helps
Cheers
Daniel

-------------------------------------------------------------------------

[1] - http://disc.sci.gsfc.nasa.gov/additional/faq/precipitation_faq.shtml#lat_lon

For TRMM 3B43, 3B42, it seems there are two datasets (HDF and binary)
with different latitude, longitude arrangements. Is this true? Which
one should I use?

Yes and both are arranged differently. The HDF is the standard TRMM
archive format and data are written in the following order, (-49.875,
-179.875), (-49.625, -179.875), (-49.375, -179.875)...... The binary
are written for GrADS (a free popular software used in climate and
weather communities) and in (-49.875,-179.875), (-49.875,-179.625),
(-49.875,-179.375°W)...... Apparently if you are a GrADS user, you
should use the binary. Otherwise, there is a list of software in
http://disc.sci.gsfc.nasa.gov/precipitation/additional/tools

On Fri, Nov 19, 2010 at 10:49 AM, Markus Neteler <neteler@osgeo.org> wrote:

On Fri, Nov 19, 2010 at 8:40 AM, Markus Metz
<markus.metz.giswork@googlemail.com> wrote:

nikos ves wrote:

On Wed, 2010-11-17 at 10:08 +0100, Markus Metz wrote:

Another option:
get binary grids from here
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/
read
ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/3B43_V6/3B43.ctl

import into a latlon location with r.in.bin -f -b north=50 south=-50
east=180 west=-180 rows=400 cols=1440, e.g.
r.in.bin -f -b input=3B43.100101.6.precipitation.bin
output=3B43.100101.6.precipitation north=50 south=-50 east=180
west=-180 rows=400 cols=1440

i was comparing the output rasters with a png [1] a same period.
eg Jul_2006. it seems that in the bin [2] file N is S and vise versa.
The phenomenon can be seen clearly by comparing the western coast of
India between [1] and [2]

I don't think I'm doing something wrong, but can anyone cross check just
to be sure I didn't anything stupid on my side?

Confirmed, that's maybe the reason why these binary grids are well hidden.

Looks like there is no way around setting GCPs and using i.rectify,
either with these binary grids or with the hdf dumps.

how about flipping it with GDAL VRT and gdalwarp? Below I cite an older
email from the GDAL list with a similar problem + solution.

Markus

PS: From gdal mailing list:

On Fri, Jan 16, 2009 at 9:52 PM, Frank Warmerdam wrote:

Greg Ederer wrote:

Hi,

I'm running gdal_translate against a VRT file:

<VRTDataset rasterXSize="751" rasterYSize="801">
<GeoTransform>-20.05, 0.1, 0.0, 40.05, 0.0, -0.1</GeoTransform>
<SRS>
GEOGCS[&quot;WGS 84&quot;,
DATUM[&quot;WGS_1984&quot;,
SPHEROID[&quot;WGS 84&quot;,6378137,298.2572235630016,
AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]],
AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]],
PRIMEM[&quot;Greenwich&quot;,0],
UNIT[&quot;degree&quot;,0.0174532925199433],
AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]
</SRS>
<VRTRasterBand dataType="Float32" band="1" subClass="VRTRawRasterBand">
<SourceFilename relativetoVRT="1">10day_precip.bin.1999121</SourceFilename>
<ImageOffset>0</ImageOffset>
<PixelOffset>4</PixelOffset>
<LineOffset>3004</LineOffset>
<ByteOrder>MSB</ByteOrder>
<NoDataValue>-999.0</NoDataValue>
</VRTRasterBand>
</VRTDataset>

I just noticed that the resulting GeoTIFF is upside down. Is this a
problem with my GeoTransform values? If so, what values would produce the
image right side up?

Greg,

I don't see any obvious problem with the geotransform values.

Perhaps the image really is upside on disk. If so, you could flip it as
it is read by changing your values to

<ImageOffset>2403200</ImageOffset>
<PixelOffset>4</PixelOffset>
<LineOffset>-3004</LineOffset>

Best regards,

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

(attachments)

vira_mapa.py (474 Bytes)