[gdal-dev] Convert precipitation accumulations from HDF5 to GeoTiff

Rutger kassies at gmail.com
Tue Dec 13 07:25:11 PST 2016


Yes, that looks good. Although instead of using the -1, i think its meant to
be the actual y-resolution as provided in the metadata, but i'm never 100%
sure on those things. Its tempting to ignore it in this case, since its so
close to 1, but imagine what will happen if they increase the resolution
after an upgrade. If you read the number of rows from the data, and use a
hard coded resolution, the geographical extent would change instead of the
# geographic_geo_pixel_size_x
yres = -1.0000052 # km
xres = 1.0000013

# geographic_geo_column_offset
xoffset = 0
yoffset = 3649.9802

# geographic_geo_number_columns
ncol = 700
nrow = 765

ulx = xoffset * xres
uly = yoffset * yres
lrx = ulx + ncol * xres
lry = uly + nrow * yres
Which gives: 
(0.0, -3649.9991798970395, 700.0009100000001, -4415.003157897039)

You can also calculate them by transforming the given lat/lon corner
coordinates to the proj4 projection string given in the metadata. If i do
that as well, i get:
(0.0, -3649.9991119177544, 700.000903671186, -4415.003881997636)

Since both should be similar (there could be some rounding in the provided
corner coordinates), its a good way to check if you did it right.

The last thing to think about it what the coordinates are refering to, the
outer edge of the corner pixel, or the center of the corner pixel. Given
"geographic_geo_pixel_def=LU" in the metadata, i would guess it the actual
outer edge (which is GDAL-style as well).

Here is a Jupyter Notebook which i used (but nbviewer is down right now,
check it later):

And i have to apologize to Even for not using OSR's coordinate conversion in
that example. ;)



View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-Convert-precipitation-accumulations-from-HDF5-to-GeoTiff-tp5299661p5299702.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.

More information about the gdal-dev mailing list