Navigation : Top/MATALB/mexncおよびsnctoolsのインストール

Linuxの場合

2008b

2008bからエンジン(DLL)はMATLABの本体を使用する.このため,インストールがとても簡単になった.

ダウンロード

インストール

  • 伸長して適当なところにおいてパスを通す.
    	C:\Users\mori\src\matlab\mexcdf
    	C:\Users\mori\src\matlab\mexcdf\mexnc
    	C:\Users\mori\src\matlab\mexcdf\netcdf_toolbox
    	C:\Users\mori\src\matlab\mexcdf\netcdf_toolbox\netcdf
    	C:\Users\mori\src\matlab\mexcdf\netcdf_toolbox\netcdf\ncsource
    	C:\Users\mori\src\matlab\mexcdf\netcdf_toolbox\netcdf\nctype
    	C:\Users\mori\src\matlab\mexcdf\netcdf_toolbox\netcdf\ncutility
    	C:\Users\mori\src\matlab\mexcdf\snctools
  • 確認
    >> setpref('SNCTOOLS','PRESERVE_FVD',true); <- 配列のオーダーが変わった(デフォルト)
    or
    >> setpref('SNCTOOLS','PRESERVE_FVD',false); <- 配列のオーダーを昔に
    >> nc_dump('example.nc')
    netcdf example.nc { 
    
    dimensions:
    	x = 50 ;
    	y = 50 ;
    	z = 5 ;
    	t = UNLIMITED ; (0 currently)
    
    
    variables:
    	double avagadros_number([]), shape = [1]
    		avagadros_number:description = "this variable has no dimensions" 
    	short temperature(x), shape = [50]
    		temperature:scale_factor = 1.8 
    		temperature:add_offset = 32 
    		temperature:units = "degrees_fahrenheit" 
    		temperature:description = "F = 9/5*C + 32" 
    	float peaks(x,y), shape = [50 50]
    		peaks:description = "z = peaks(50);" 
    	long time_series(z,t), shape = [5 0]
    		time_series:description = "this variable has an unlimited  dimension" 
    
    
    //global attributes:
    		:creation_date = "09-Jun-2008" 

2007b

ダウンロード

http://mexcdf.sourceforge.net

  1. mexcdf.tar.gz をダウンロード
  2. snctools-X.zip をダウンロード
  3. netcdf_toolbox-1.XX.tar.gzをダウンロード

mexncのインストール

  • mexcdf.tar.gzを解凍し、mexncの下にあるmakefileをコンパイルする.
  • ifortの環境ではmexopts.shに以下の変更が必要
    CC='icc'    
    NETCDF="/usr/local/netcdf-ifort"
  • mexncを生成.
    • make -f makefile
  • test
    >> mexnc ( 'STRERROR', 0 )
    ans =
    No error
    ! 注意) 環境に合わせてmexopt.sh(サンプル)の編集が必要
    • tests/test_mexnc.mを実施して,動作確認

snctoolsのインストール

  • unzip snctools-X.zip
  • pathを定義する.
  • tests/test_snctoos.mを実施して,動作確認

mexcdf and snctoolsの仕上げ

  • UnidataからtoolsUI version 2.2.18 (don't use 4.0)をダウンロード.
    >> javaaddpath ( '/home/jevans/matlab/classes/toolsUI-2.2.18.jar' ) ; 
    >> setpref ( 'SNCTOOLS', 'USE_JAVA', true ); % this requires SNCTOOLS 2.4.3 or better
  • USGS作成のマニュアル

NetCDF Toolboxのインストール

  • netcdf_toolbox-1.XX.tar.gzを解凍し以下のディレクトリーにパスを通す.
  • addpath /path/to/wherever/you/installed/this/netcdf
  • addpath /path/to/wherever/you/installed/this/netcdf/nctype
  • addpath /path/to/wherever/you/installed/this/netcdf/ncutility

Windows

2007b

ダウンロード

http://mexcdf.sourceforge.net

  1. mexcdf.tar.gz をダウンロード
    • 2.0.xのバージョンからLinux/Windows等すべて共通のファイルになった.
  2. snctools-X.zip をダウンロード
  3. netcdf_toolbox-1.XX.tar.gzをダウンロード
  4. netcdf-javaのtoolsUI.jarをダウンロード

mexncのインストール

  • mexcdf.tar.gzを解凍し,netcdf.dllをmatlabのパスの通る場所におく
    • 例)C:\Users\mori\src\matlab\matlab_public\netcdf
    • mexcdfをaddpathする
    • tests/test_mexnc.mを実施して,動作確認
      • この時点ではjavaの設定をしていないので一部エラーが出る.
        >> mexnc ( 'STRERROR', 0 )
        ans =
        No error

snctoolsのインストール

解凍してパスを通すだけ

  • unzip snctools-X.zip
  • pathを定義する.
  • tests/test_snctoos.mを実施して,動作確認

toolsUIのインストール

  • UnidataからtoolsUI version 2.2.18 (don't use 4.0)をダウンロード.
    >> javaaddpath ( '/C:\Users\mori\src\matlab\matlab_public\netcdf/toolsUI-2.2.18.jar' ) ; 
    >> setpref ( 'SNCTOOLS', 'USE_JAVA', true ); % this requires SNCTOOLS 2.4.3 or better
  • もう一度テストする
    • tests/test_mexnc.mを実施して,Java関係の動作確認

NetCDF Toolboxのインストール

startup.mに以下を記述する。

addpath /usr/local/matlab7/toolbox/mexnc
addpath /usr/local/matlab7/toolbox/netcdf_toolbox
addpath /usr/local/matlab7/toolbox/netcdf_toolbox/nctype
addpath /usr/local/matlab7/toolbox/netcdf_toolbox/ncutility

matlabを起動し、mexnc/test/test_mexnxを実行するとテストプログラムが起動する。 ちゃんと起動したら、正しくインストールされたことになる。

Archive