0

我如何在 IDL 中用牛顿法得到方程的解,我的程序将提供各种(这里的瓦片),但牛顿法 id IDL 只是接收方程的初始解。请帮助我完成遥感图像处理的论文。

我的 IDL 程序是:</p>

Pro TSM_lixiaModel
 !Except=0
 Compile_opt idl2
 dir='I:\lwkDATA\waterRegion\MODIS\'
 files=file_search(dir,'*RC.tif',count=num)
 for i=0,num-1 do begin
file=files[i]
   raster=e.Openraster(file,external_type='ADS40')
   outFile=file_dirname(file)+'\'+file_basename(file,'.tif')$
   +'_TSM_lixiaModel.tif'


TSMraster=enviraster(uri=outfile,$
         nrows=raster.nrows,$
         ncolumns=raster.ncolumns,$
         nbands=1,$
         data_type=raster.data_type,$
         SPATIALREF=raster.SPATIALREF)
tileIterator=raster.createtileiterator(bands=2,tile_size=[100,100])
count=0
foreach tile,tileiterator do begin
  count++

  ***;Tile is variable, but not  the needed Solution of the equation
  ;S is needed Solution of the equation
  ;????? is the initially solution of the ‘newtfunc’,how do i give the       various(Tile) to newtfunc***

  processedTile=newton(??????,'newtfunc');

  currentSubRect=tileIterator.Current_subrect
  TSMraster.setdata,processedTile,sub_rect=currentsubrect
  print,'1'
endforeach
TSMraster.save
endfor
End

function newtfunc,S
   compile_opt idl2
   return,(r-93.0943)*S+49.2464*S*exp(-0.0001*S)-344.016+45*r
end
4

1 回答 1

0

我不完全理解您的代码,但也许您只需要在 ENVIRaster 上使用 GetData 方法?例如:

data = raster.GetData(BANDS=[0], SUB_RECT=[100,449,550,899])

然后你可以将你的数据传递给牛顿函数。完整的文档在这里: https ://www.harrisgeospatial.com/docs/enviraster__getdata.html

顺便说一句,在相关说明中,如果您需要将其他参数传递给 Newton 函数,一个技巧是使用公共块,您可以在调用例程中设置公共块,然后访问您的变量“新函数”。就像是:

pro mymain
  common foo, x, y, z
  x=1 & y=1 & z=1
  result = newton(...,'newtfunc')
end

function newtfunc,S
  common foo
  <use x,y,z here>
  return,...
end

希望有些帮助!如果没有,您可以联系技术支持。

于 2017-03-01T22:44:18.640 回答