MacBookにgdalをインストールしてしまった。これまでのコードでは、R
のH4ファイル(.hdf)を開いて操作するようになっていました。同じコードがデスクトップ上で動作します。しかし、現時点では、このコードはデスクトップ上で動作し、ノートパソコンでは動作しません。同じコード。同じデータ。GDALをOSX/MAC上でバインドする - R4でファイルを開く/探索できないR
これは、gdal
からconda
までpython
サポートをインストールしようとしていると思われます。
これで、hashfのhdfファイルにBashのコマンドラインでgdalinfo
を実行すると、ファイルが正常に読み込まれます。しかし、私はR
でこのコードを実行する場合 - )(GDALutils関数get_subdatasetsを使用して:
get_subdatasets("MOD09GA.A2016199.h09v05.006.2016201065406.hdf")
それはエラーを返します:
別のパッケージを使用して、同様ERROR 4: `data/week6/modis/reflectance/17_july_2016/MOD09GA.A2016199.h09v05.006.2016201065406.hdf' not recognised as a supported file format.
gdalinfo failed - unable to open 'data/week6/modis/reflectance/17_july_2016/MOD09GA.A2016199.h09v05.006.2016201065406.hdf'.
Error in split1[[1]] : subscript out of bounds
In addition: Warning message:
running command '"/usr/local/Cellar/gdal/1.11.5_3/bin/gdalinfo" "data/week6/modis/reflectance/17_july_2016/MOD09GA.A2016199.h09v05.006.2016201065406.hdf"' had status 1
`` `
- rgdal私は関数を実行します。gdalinfo()
Warning message: running command '"/usr/local/Cellar/gdal/1.11.5_3/bin/gdalinfo" "data/week6/modis/reflectance/17_july_2016/MOD09GA.A2016199.h09v05.006.2016201065406.hdf"' had status 1
私は、これら2つの異なるパッケージや関連機能です実現。
私はこの記事を見つけました:
が、コードgdal_chooseInstallation(hasDrivers=c("HDF4","HDF5"))
戻り
Error in gdal_chooseInstallation(hasDrivers = c("HDF4", "HDF5")) : No installations match.
注:興味深いことに、この同じ私のデスクトップ上のコード(R内のファイルを読むことができる)も、ドライバを見つけることができてもエラーを返します。
私は、Rの外のコマンドラインでh4ファイルを探索できるので、ドライバが自分のコンピュータに存在することは当然知っています。私のコードは、デスクトップと同じデータ同じディレクトリ構造。
私は潜在的な競合を削除するか、(私はそのバージョンがしかし何であるかわからない!)正しいGDALのバージョンにRを指示するために、私のMac上で私のGDALのスレートをきれいにすることができますどのように任意のアイデア?これは私が取り組むするかどうかはわかりませんRへの結合GDALに関連付けられた特定のものです。
UPDATE: Rでこれを実行:
system("gdalinfo --version")
戻り値:
GDAL 1.11.5, released 2016/07/01
しかし、コマンドライン
gdalinfo --version
返し
GDAL 2.1.0, released 2016/04/25
UPDATES: は、私は最終的に2対GDAL 2をリンクして解除する方法を考え出したと私はどのように考え出しました
を:この時点で、しかしHDF4インストールするために醸造を使用し、私はここにチュートリアルを使用していますgdal2
を再インストールすることはできません
これは昨日働いていたが、その後、私はgdal2
brew remove gdal2
# install h4 libraries
brew install hdf4
を削除し、その後、チュートリアルの指示に従って再インストールしようとしたにH4ライブラリをインストールする必要がありました。
==> Installing gdal2 from osgeo/osgeo4mac
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Downloading http://download.osgeo.org/gdal/2.2.1/gdal-2.2.1.tar.gz
Already downloaded: /Users/leah-su/Library/Caches/Homebrew/gdal2-2.2.1.tar.gz
==> ./configure --prefix=/usr/local/Cellar/gdal2/2.2.1 --mandir=/usr/local/Cella
Last 15 lines from /Users/leah-su/Library/Logs/Homebrew/gdal2/01.configure:
checking for SDget_maxopenfiles in -lmfhdf... yes
checking for H5Fopen in -lhdf5... yes
checking for kea-config... no
checking for kea... no
checking for nc-config... /usr/local/bin/nc-config
checking libnetcdf compiler and linker flags with nc-config...
got version="netCDF 4.4.1.1", prefix="/usr/local/Cellar/netcdf/4.4.1.1_6",
libs="-L/usr/local/Cellar/netcdf/4.4.1.1_6/lib -lnetcdf -lhdf5_hl -lhdf5 -lsz -lz -ldl -lm -lcurl", includedir="/usr/local/Cellar/netcdf/4.4.1.1_6/include"
checking for nc_open in -lnetcdf... yes
checking for netcdf-4 (and HDF5) support in libnetcdf... yes
checking for HDF4 support in libnetcdf... no
configure: using JasPer library from /usr/local.
checking for jp2_encode_uuid in -ljasper... no
configure: hacked JasPer version not found, GeoJP2 disabled.
configure: error: openjpeg.h not found in /usr/local/include/openjpeg-2.0 or /usr/local/include/openjpeg-2.1
If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/osgeo/homebrew-osgeo4mac/issues
These open issues may also help:
brew install osgeo/osgeo4mac/gdal2-mrsid fails https://github.com/OSGeo/homebrew-osgeo4mac/issues/250
Failed to build gdal2 with common flags https://github.com/OSGeo/homebrew-osgeo4mac/issues/245
Cannot upgrade gdal2 on OS X 10.12.6 https://github.com/OSGeo/homebrew-osgeo4mac/issues/252
Please add --without-pdfium option to gdal2 formula https://github.com/OSGeo/homebrew-osgeo4mac/issues/220
Using osgeo4mac's gdal2 with homebrew core's postgis https://github.com/OSGeo/homebrew-osgeo4mac/issues/185
gdal1-mrsid and gdal2-mrsid fails to build https://github.com/OSGeo/homebrew-osgeo4mac/issues/213
`` `