Dear Michael, Following your advice I have tired :
library(terra) library(raster) library(dplyr) r = terra::rast(file.choose()) plot(r$LST) r_lst = r$LST r_lst %>% raster() plot(r_lst) Then I effectively get a raster layer format from the raster package as I wanted, but looking at the plot and the raster layer information--see bellow-- the scene appears to need both latitude and longitude for correct geolocation, how can I do this procedure? > r_lst %>% raster() class : RasterLayer dimensions : 5632, 5400, 30412800 (nrow, ncol, ncell) resolution : 1, 1 (x, y) extent : 0, 5400, 0, 5632 (xmin, xmax, ymin, ymax) crs : NA source : LST names : LST values : 0, 65535 (min, max) The extent and the resolution are not the correct ones. Maybe in the same .h5 is all the data for georeferencing it although I could not see how to get to it and apply it to the layer. There is also another file with complementary data related to geolocation but how can I query it, and get the data for geolocation and apply it to the raster layer?. The objective is to save it as a GeoTIFF file to be opened in QGIS with correct geolocation. What do you suggest for converting the .h5 file to a georeferenced Raster Layer in GeoTIFF format ? Thanks a lot. Kind regards, Gabriel On Sat, Nov 13, 2021 at 12:22 PM Gabriel Cotlier <gabikl...@gmail.com> wrote: > Dear Michael Summer, > Thanks a lot for your swift reply. > I will give a try to the procedure you mentioned. > Kind regards, > Gabriel > > > On Sat, Nov 13, 2021 at 12:14 PM Michael Sumner <mdsum...@gmail.com> > wrote: > >> 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