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, <gabikl...@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@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to