[R-sig-Geo] Problem reading a HDF5 file with readGDAL in Windows

Robert J. Hijmans r.hijmans at gmail.com
Wed May 6 08:06:02 CEST 2015


It works for me. I get:


> library(raster)
Loading required package: sp
> library(ncdf4)

> raster("E:/downloads/201407291200", ncdf=T, varname='DSSF')
class       : RasterLayer
dimensions  : 651, 1701, 1107351  (nrow, ncol, ncell)
resolution  : 1, 1  (x, y)
extent      : 0.5, 1701.5, 0.5, 651.5  (xmin, xmax, ymin, ymax)
coord. ref. : NA
data source : E:\downloads\201407291200
names       : DSSF
zvar        : DSSF


> sessionInfo()
R version 3.2.0 RC (2015-04-08 r68161)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United
States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] ncdf4_1.12    raster_2.3-41 sp_1.0-17

loaded via a namespace (and not attached):
[1] grid_3.2.0      lattice_0.20-31
>


On Tue, May 5, 2015 at 10:53 PM, Oscar Perpiñan
<oscar.perpinan at gmail.com> wrote:
>> Even better (renaming not necessary):
>>
>> x <-
>> raster("E:/downloads/OMI.L2.CloudOMCLDO2Strip200kmAlongCloudSat.2015.05.05.020752Z.v003.he5",
>> var='Data Fields/ChiSquaredOfFit', ncdf=TRUE)
>> >> Not a remedy, but the following might be a workable alternative...
>> >>
>> >>
>> >> ncdf4::nc_open("OMI.L2.CloudOMCLDO2Strip200kmAlongCloudSat.2015.05.05.020752Z.v003.he5")$var$`Data
>> >> Fields/ChiSquaredOfFit`
>
>
> Thanks. It works with the file of the example. But it fails with this one
> (even on a Linux machine):
> https://www.dropbox.com/s/3zmhbtcpf7ly4nw/201407291200
>
>> x <- raster('201407291200', var = 'DSSF', ncdf = TRUE)
> Error in R_nc4_open: NetCDF: Can't open HDF5 attribute
> ....
>> x <- raster('201407291200', var = '//DSSF', ncdf = TRUE)
> Error in R_nc4_open: NetCDF: Can't open HDF5 attribute
> ....
>
> However, I can open this file in Linux with:
>
> x <- readGDAL('HDF5:201407291200://DSSF')
>
> Best,
>
> Oscar.



More information about the R-sig-Geo mailing list