[R-sig-Geo] readGDAL() and HDF5 files

Michael Sumner mdsumner at utas.edu.au
Fri Jan 23 22:11:15 CET 2009


Hi Sebastian,

When you say the geographic coordinates are not a regular grid - is it 
that the actual grid is Mercator but the NetCDF file stores an X and Y 
vector separately for each unique longitude and latitude? I've seen this 
many times, but never with enough metadata to determine that without 
guessing. I've seen some documents that refer to the source grid as 
being in Mercator, but never any that mention explicitly the method used 
to generate the NetCDF file from those.

If this is the case for your data, I've had success by figuring out an 
offset/scale value that work sufficiently by assuming a Mercator grid

Specifically this one but sometimes with an extra X offset to overcome 
hemisphere shift.

CRSargs(CRS("+proj=merc"))

I don't have the details available today, but I can dig them up if that 
sounds promising. Also, I'd be interested to hear any details you have 
about the grids you are using, whether they use this Mercator-kludge or 
not.

Cheers, Mike.


Sebastian P. Luque wrote:
> On Fri, 23 Jan 2009 11:01:21 +0100 (CET),
> Roger Bivand <Roger.Bivand at nhh.no> wrote:
>
>   
>> On Fri, 16 Jan 2009, Sebastian P. Luque wrote:
>>     
>>> Hi,
>>>       
>
>   
>>> I'm trying to use HDF5 files with this structure:
>>>       
>
>   
>> Sorry for the delay. Having now set up a reprodicable route (OSGeo4W
>> GDAL and drivers, rgdal built against OSGeo4W as in a posting a couple
>> of days ago), I can see the problem, but have no resolution.
>>     
>
>   
>> Doing gdalinfo on the data itself, I see geographical coordinates, not
>> projected. GDAL does not retrieve the grid metadata correctly, and
>> assigns default 1x1 grid cells starting at c(0.5, 0.5). Using
>> gdal_translate to convert it to a GTiff, I see that I have to set p4s
>> to NA to read at all, and the problems remain. I would be interested
>> in knowing who or what wrote the HDF5 file, because it doesn't seem to
>> be what it says it is (no grid metadata, different CRS from your
>> assumption), and so the data may actually be in the wrong order too.
>>     
>
> Thanks for looking into this Roger.  The data are distributed by the
> OSI-SAF group (http://www.osi-saf.org).  I was able to work with the
> data using the NetCDF files they distribute (for a subset of their data
> for now), using NetCDF tools outside R.  However, I'd like to do it more
> directly from R.
>
> In the NetCDF files, longitude, latitude, and the data, are stored in
> separate data subsets.  The grid is produced using the CRS specification
> I provided (from OSI-SAF's documentation), however I cannot see where
> the actual coordinates in that projection are in the files.  The
> geographical coordinates are the inverse-projected coordinates of the
> grid, hence not a regular grid.
>
> I might ask in the GDAL list for more help.
>
>
> Cheers,
>
>   
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.176 / Virus Database: 270.10.12/1910 - Release Date: 22/01/2009 6:28 PM
>
>




More information about the R-sig-Geo mailing list