[R-sig-Geo] Question on hierarchical data format 5 .h5 file format

Michael Sumner md@umner @end|ng |rom gm@||@com
Sat Nov 13 11:14:08 CET 2021


try terra::rast() or stars::read_stars() on the file, both use gdal to
interrogate and read. What you get depends on the structure of the files,
variables interpreted as subdatasets. stars is more general but sees
variables as 2D arrays with bands, terra calls these bands layers.

Alternatively try raster::raster() or RNetCDF or tidync which might be more
straightforward than rhdf5 but all are quite different to each other and to
the gdal view.

hth

On Sat, 13 Nov 2021, 18:56 Gabriel Cotlier, <gabiklm01 using gmail.com> wrote:

> Hello,
>
> I would like to be able to visualize / plot a specific data layer within
> the structure a hierarchical data file format .h5  in R. I could observe
> the structure as follows :
>
> library(rhdf5)
> r= h5ls(file.choose())
> r
>
> and also in this way identify the Group and Name of the data to be plotted,
> however I've tried I could not access the data itself, nor plot it as a
> raster layer with its corresponding geographic coordinates.
> I would like to be able to select such data, plot it as a raster layer and
> if possible save it as GeoTIFF file format to be further processed with the
> raster package as a common raster layer.
>
> If any small guidance example, reprex, of this procedure is possible
> it would be appreciated.
>
> Thanks a lot in advance
> Kind regards,
> Gabriel Cotlier
> --
> Gabriel Cotlier, PhD
> Haifa Research Center for Theoretical Physics and Astrophysics (HCTPA)
> University of Haifa
> Israel
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list