0

netcdf ファイルからパッケージで生成されたラスター ファイルがrasterあり、fillvalue、スケール ファクター、およびオフセットを抽出する必要があります。パッケージncdfを使用すると、次のコードでこれらの属性を抽出できます。

fillvalue <- att.get.ncdf(ncdf,"tp","_FillValue")
scale <- att.get.ncdf(ncdf,"tp","scale_factor")
offset <- att.get.ncdf(ncdf,"tp","add_offset")

しかし、rasterパッケージではそれらを抽出する方法がわからないのですが、可能ですか? または、それらを抽出する必要がありncdfますか?

4

1 に答える 1

1

I don't have a ncdf file to test, but if you read the file using raster and saved it using raster, I believe the below should work. If not try using readGDAL from the rgdal package to read the ncdf image.

library(raster)    
img <- raster(file_path)
scale <- gain(img)
offset <- offs(img)
fillvalue <- NAvalue(img)
于 2014-01-15T14:43:18.600 に答える