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

2021-11-14 Thread Michael Sumner
see if gdal understands the coordinate arrays already, you can just churn it through the warper, otherwise construct a vrt that specifies them, which is a bit obscure how you do it admittedly - but this is a gdal not an R topic. Best On Mon, 15 Nov 2021, 00:22 Edzer Pebesma, wrote: > > On

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

2021-11-14 Thread Edzer Pebesma
On 14/11/2021 13:59, Edzer Pebesma wrote: Gabriel shared the data with me (off-list, 1Gb) and it contains two hdf5 datasets, one containing the raster of the longitude and latitude, the other rasters with the attributres (LST) but no coordinates. I could get a (rough: factor 50 downsampling)

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

2021-11-14 Thread Gabriel Cotlier
Hello Edzer, Thanks a lot. The scaling factor to convert to LST is 0.02 Regards, Gabriel On Sun, Nov 14, 2021 at 2:59 PM Edzer Pebesma wrote: > Gabriel shared the data with me (off-list, 1Gb) and it contains two hdf5 > datasets, one containing the raster of the longitude and latitude, the >

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

2021-11-14 Thread Edzer Pebesma
Gabriel shared the data with me (off-list, 1Gb) and it contains two hdf5 datasets, one containing the raster of the longitude and latitude, the other rasters with the attributres (LST) but no coordinates. I could get a (rough: factor 50 downsampling) plot with stars using: library(stars)

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

2021-11-14 Thread Edzer Pebesma
This might be because the grid is not regular but possibly curvilinear, having two raster layers with the lon & lat values for each pixel. Can you share a sample data set? On 14/11/2021 10:47, Gabriel Cotlier wrote: Dear Michael, Following your advice I have tired : library(terra)

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

2021-11-14 Thread Gabriel Cotlier
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

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

2021-11-13 Thread Gabriel Cotlier
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 wrote: > try terra::rast() or stars::read_stars() on the file, both use gdal to > interrogate and read. What you get

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

2021-11-13 Thread Michael Sumner
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