如何使用坐标原点从R中的h5文件投影栅格?

时间:2018-07-28 16:57:34

标签: r raster rhdf5

我想将h5文件中的data.frame投影到投影栅格中。我正在使用的h5文件是加利福尼亚内华达山脉的雪水等效网格,并且坐标的原点在文件的子级别之一中。我无法弄清楚如何使用原点创建投影的栅格网格。以下是我的代码,该代码下载数据并提取h5文件结构。我在rhdf5库中使用R

如何获取coordInfo并将其用于投影datSWE,使其成为投影栅格?

这是我用来创建第一部分代码的一些其他Web链接。

https://rpubs.com/fenclmar/98163

https://github.com/NEONScience/NEON-Data-Skills/blob/master/tutorials-in-development/R/R-RS-data-institute/hyperspectral/subset-h5-file-R.Rmd

# Call the R HDF5 Library, install from BioConductor repo
library(rhdf5)

#download the data
theUrl<-"ftp://ftp.snow.ucsb.edu/pub/org/snow/products/reconstruction/sierra/reconstruction_sierra_500m_CY2001.h5"
theFile<-"reconstruction_sierra_500m_CY2001.h5"
try(curl::curl_download(theUrl, theFile, quiet=TRUE))

# View structure of file
f <- "reconstruction_sierra_500m_CY2001.h5"
h5ls(f)

#look at how many "levels" of nesting 
h5ls(f,recursive=5)
fiu_struct <- h5ls(f,recursive=5)

# have a look at the structure.
fiu_struct
fiu_struct[3,1]
## Let's view the metadata for the coordinate info
coordInfo  <- h5readAttributes(f,fiu_struct[3,1])
coordInfo

##Extract the snow water equivalent data
datSWE <- h5read(f, "Grid/swe")
str(datSWE)
day1<-datSWE[,,1] #extract first day of the time series grid

0 个答案:

没有答案