Wednesday 21 January 2015

r - What is the easiest way to create map using HDF-5 data subset?


I need to visualize some area using values provided in HDF-EOS version 5 file and create map using those values and other GIS layers. Unfortunately, my QGIS do not recognize the HDF5 file.


Do I really need to compile GDAL manually as described at: SciGeo?



Maybe there's an easier way to do that? I thought about conversion to the GeoTIFF. However HEG tool crashes during conversion.


I opened my product in HDFView, but I don't see any option to generate GeoTIFF in this application.


Last, but not least, I've tried R! I read appropriate data set, but I don't know what to do next. Is there any possibility to save this data in different format? Or maybe I am able to (how? I can't find this in h5 package documentation)


My current code is:


pacman::p_load(h5)

# download HDF-5 file
destfile <- 'SMAP.h5'
if(!file.exists(destfile))
{

download.file('ftp://n5eil01u.ecs.nsidc.org/SAN/SMAP/SPL2SMAP.003/2015.07.07/SMAP_L2_SM_AP_02293_D_20150707T084111_R13080_001.h5',destfile)
}

# read file
file <- h5file(destfile ,'r')
dataset <- file["Soil_Moisture_Retrieval_Data"]["soil_moisture"]

# @Spacedman: Does your R have a GDAL that supports these files?
subset(rgdal::gdalDrivers(),grepl("HDF",long_name))
# it outputs:

# name long_name create copy
# 51 HDF4Image HDF4 Dataset TRUE FALSE
# 53 HDF5Image HDF5 Dataset FALSE FALSE


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...