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 <edzer.pebe...@uni-muenster.de> 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) plot with stars using: > > library(stars) > > lat = > > read_stars("HDF5:ECOSTRESS_L1B_GEO_11712_012_20200730T061029_0601_01.h5://Geolocation/latitude") > lon = > > read_stars("HDF5:ECOSTRESS_L1B_GEO_11712_012_20200730T061029_0601_01.h5://Geolocation/longitude") > > var = > "HDF5:ECOSTRESS_L2_LSTE_11712_012_20200730T061029_0601_01.h5://SDS/LST" > > lst = read_stars(var, curvilinear = list(x = lon, y = lat)) > > plot(lst, downsample = 50, axes = TRUE, reset = FALSE) > > library(rnaturalearth) > ne = ne_countries(returnclass = "sf") > > plot(st_geometry(ne), add = TRUE, border = 'yellow') > # california border seems to make sense > > > but I'm not sure how to make a regular raster (in some CRS) out of this > for exporting to GeoTIFF. > > On 14/11/2021 11:00, Edzer Pebesma wrote: > > 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) > >> 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 > >> > > > > -- > Edzer Pebesma > Institute for Geoinformatics > Heisenbergstrasse 2, 48151 Muenster, Germany > Phone: +49 251 8333081 > > _______________________________________________ > 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