gis - Reading GlobSnow HDF4 files in R -


i trying read .hdr files in r. files come globsnow , can found @ http://www.globsnow.info/swe/archive_v2.0/2013/l3a_daily_swe_hdf/

i have used gdalutils package, seems work modis data, not working globsnow data. have tried this:

sd <- get_subdatasets("globsnow_swe_l3a_20130101_v2.0.hdf") gdal_translate(sd[2], sds=t, dst_dataset = "hdftrial.tif") 

however returns null.

i have tried installing gdal through homebrew, unsure how make work in r. opened data in hdfview , data seems right. there doesn't seem easy way access data in r. hoping raster or matrix .hdf file.

the null comes out me too, follow raster("hdftrial.tif") , loads raster in no problem. null comes because have no subdatasets (sds), intentionally calling single dataset, appears hdf not read in subdatasets if not declare.

library(gdalutils) library(raster) sd <- get_subdatasets("c:/_localdata/globsnow_swe_l3a_20130101_v2.0.hdf") gdal_translate(sd[2], dst_dataset = "hdftrial.tif")  plot(raster("hdftrial.tif")) 

when use gdal_translate pull each individual dataset both there, throws null if there not "subdatasets".

from gdal_translate:

 if (output_raster) {         if (missing(sds)) {             return(brick(dst_dataset))         }         else {             if (!sds) {                 return(brick(dst_dataset))             }             else {                 return(null)             }         }     }     else (return(null)) 

update:

gdal_translate("c:/_localdata/globsnow_swe_l3a_20130101_v2.0.hdf", sds=t, of="gtiff", dst_dataset = "hdftrial.tif") 

you not require get_subdatasets, internally. declaring sds=t create individual file each subdataset. still throws null, trying decipher why. file _#.tif each subdataset exists within dataset.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -