本文介绍了如何使用此R函数拼接相同的HDF文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个文件夹中有1000多个MODIS HDF图像:

There are more than 1,000 MODIS HDF images in a folder:

M:\join

他们的名字告诉我们哪些文件必须镶嵌在一起.

Their names show us which files must be mosaiced together.

例如,在以下文件中, 2009090 意味着这三个图像必须镶嵌在一起:

For example, in the below files, 2009090 means these three images must be mosaiced together:

MOD05_L2.A2009090.0420.051.2010336084010
MOD05_L2.A2009090.0555.051.2010336100338
MOD05_L2.A2009090.0600.051.2010336100514

或者这两个日期相同, 2009091 :

Or these two, are for the same date, 2009091:

MOD05_L2.A2009091.0555.051.2010336162871
MOD05_L2.A2009091.0600.051.2010336842395

我将使用此功能(功能源)将它们拼接起来:

I am going to mosaic them using this function (source of function ):

mosaicHDF(hdfNames, filename, MRTpath, bands_subset, delete=FALSE)

我应该如何将HDF文件引入 hdfNames ?

How should I introduce my HDF files to hdfNames?

我该怎么写文件名?

我试图找到此功能的手册,但没有任何东西.

I tried to find a manual for this function, but there was not anything.

感谢您的帮助.

推荐答案

幸运的是,我确实找到了答案.感谢您的帮助.

I did find the answer, fortunately. Thanks for your help.

hdfs <- c('MOD05_L2.A2009090.0420.051.2010336084010.hdf',
          'MOD05_L2.A2009090.0555.051.2010336100338.hdf',
          'MOD05_L2.A2009090.0600.051.2010336100514.hdf')

mosaicHDF(hdfNames=hdfs, filename='newhdf.hdf', MRTpath='C:/MRT/bin',bands_subset="1 0 0 0", delete=FALSE)

但是我有一个新问题:-)

But I have a new problem :-)

由于该文件夹中有数千个HDF文件,所以

Since there are thousands of HDF files in the folder,

如何编写一个循环以将所有HDF文件引入该函数?

How could I write a loop to introduce all HDF files to the function?

仅供参考:我对R很陌生.

FYI: I am quite new to R.

这篇关于如何使用此R函数拼接相同的HDF文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 15:02