Dear list,
I am trying to convert a data matrix corresponding to a geostationary satellite
data to raster format or a format supported by GDAL. I have tried using HDF5
library with the following code:
n.col <- 1701
n.row <- 651
n.rec <- n.col*n.row
zz <- bzfile("file_to_convert.bz2","rb")
DSSF <- readBin(zz,numeric(),n=n.rec,size=4,endian="big")/86400
nDSSF <- readBin(zz,integer(),n=n.rec,size=4,endian="big")
ET0 <- readBin(zz,numeric(),n=n.rec,size=4,endian="big")
T2 <- readBin(zz,numeric(),n=n.rec,size=4,endian="big")
Rs <- array(DSSF, dim=c(n.col,n.row))
library(hdf5)
hdf5save("ET0","ET0")
I am trying to convert it to HDF5 so that I can extract the raster info with
gdalingo and gdaltranslate, but the output generated by hdf5save is not
recognize by gdalinfo as a supported format. I don't know if the problem is the
structure of the data (I have tried with all the fields available in the input
binary) I use to generate it but it is just a matrix of data, so it should be
able to store it in a HDF5 file.
I have tried also with rgdal library and the following code:
library(rgdal)
writeGDAL(ET0,"file.tif",drivername = "GTiff",type="Float32")
But I am newby with R and I am not familiar with rgdal library so I am sure I
am missing a step before trying to write the matrix data to the file. I think
it would be easier to pass the data to HDF5 due to the matrix not having
spatial reference on it.
If anyone could help me so that I could open HDF5 output files with gdalinfo it
would be great.
Thanks.
Best regards,
Juan Manuel Moreno Rivera
Remote Sensing and G.I.S. Group
Regional Development Institute
University of Castilla-La Mancha
02071 Campus of Albacete, Spain
Tlf. 967599200+2623
P Before printing this mail make sure it is completely necessary. The
environment is everyone's business
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo