Navigation :
Top/netcdf
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- バックアップ を表示
- netcdf へ行く。
- 1 (2004-07-25 (日) 01:17:30)
- 2 (2005-02-02 (水) 19:32:20)
- 3 (2005-07-01 (金) 20:37:45)
- 4 (2006-06-08 (木) 20:02:36)
- 5 (2006-06-09 (金) 19:14:53)
- 6 (2006-07-18 (火) 19:27:43)
- 7 (2006-11-28 (火) 16:25:08)
- 8 (2006-12-05 (火) 12:05:09)
- 9 (2006-12-05 (火) 12:05:09)
- 10 (2006-12-05 (火) 12:05:09)
- 11 (2006-12-05 (火) 12:05:09)
- 12 (2007-12-11 (火) 18:09:34)
- 13 (2007-12-11 (火) 18:09:34)
- 14 (2008-03-24 (月) 13:27:00)
- 15 (2008-07-11 (金) 01:45:52)
- 16 (2008-12-03 (水) 14:55:02)
- 17 (2008-12-03 (水) 17:28:57)
- 18 (2012-03-11 (日) 02:19:08)
- 19 (2013-07-18 (木) 21:22:33)
Matlabでnetcdfを使うときのメモ * Outline [#nad6ad73] - netcdf -> mexncと改名 - Combination -- MEXNC + SNCTOOLS -- MEXNC + NetCDF Toolbox netcdfファイルのインターフェースはsnctoolsとNetCDF Toolboxとなる.両者は共存できるが,snctoolsとNetCDF Toolboxではコマンド体系が異なるので(プログラムがこんがらがらないように)注意する. ** MEXNC [#k310753e] MEXNC is a mex-file interface to NetCDF files for MATLAB, and has roughly a one-to-one equivalence with the C API for NetCDF. In fact, there's no better introduction to MEXNC than to read the NetCDF User's Guide for C provided by Unidata. ** SNCTOOLS [#q02f7551] SNCTOOLS is a set of m-files that sit on top of MEXNC. You might find them a little easier to use in day-to-day activities than the mex-file itself. Check the tutorial for some examples. ** NetCDF Toolbox [#q3e8e17b] Completely unsupported. It's available here as a download, but I didn't write it and so I can't answer any questions about it. Seriously. If you download it, you are on your own. * Linuxの場合 (2007b) [#n5c5f95d] **ダウンロード [#z99791e5] http://mexcdf.sourceforge.net + mexcdf.tar.gz をダウンロード + snctools-X.zip をダウンロード + netcdf_toolbox-1.XX.tar.gzをダウンロード **インストール [#i32a18b9] *** mexnc [#l8459333] - 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 [#pda2fe7c] - unzip snctools-X.zip - pathを定義する. - tests/test_snctoos.mを実施して,動作確認 *** mexcdf and snctoolsの仕上げ [#u6e32e47] -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作成のマニュアル:http://woodshole.er.usgs.gov/staffpages/cdenham/public_html/MexCDF/nc4ml5_guide.html]] *** NetCDF Toolbox [#i7ebbbaf] - 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)の場合 [#j8a8f025] **ダウンロード [#z99791e5] http://mexcdf.sourceforge.net + mexcdf.tar.gz をダウンロード -- 2.0.xのバージョンからLinux/Windows等すべて共通のファイルになった. + snctools-X.zip をダウンロード + netcdf_toolbox-1.XX.tar.gzをダウンロード -- 過去のプログラムとの互換性維持のためインストールしておく http://www.unidata.ucar.edu/software/netcdf-java/ + netcdf-javaのtoolsUI.jarをダウンロード **インストール [#i32a18b9] *** mexnc [#l8459333] - 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 [#pda2fe7c] - unzip snctools-X.zip - pathを定義する. - tests/test_snctoos.mを実施して,動作確認 *** snctools [#h1a62e80] - 解凍してパスを通すだけ *** toolsUI [#q3b0b248] - 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 [#i7ebbbaf] 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 [#fa3266fb] - [[netcdf - R2006a]] - [[netcdf - R14]] * SNCTOOLS の使い方 [#mcab6d77] - nc_dump - nc_varput - http://mexcdf.sourceforge.net/tutorial/ * NetCDF Toolbox の使い方 [#y289845d] *** netCDFデータを読む [#i44ca6e7] - 文法 -- nc = netcdf('path', 'mode') -- nc -- The output "netcdf" object, or [] if error. -- path -- The path (filename) as a string. -- mode -- The string 'nowrite' or 'write'. - 例 -- nc = netcdf('foo.nc', 'nowrite') *** ファイルを閉じる [#y1832081] - 文法 -- result = close(nc) *** ファイルの情報を得る [#ae1d44d1] - 文法 -- theDims = dim(nc) -- theVars = var(nc) -- theGAtts = att(nc) -- theRecdim = recdim(nc) - 内容 -- nc -- "netcdf" object. -- theDims -- List of "ncdim" dimension objects. -- theVars -- List of "ncvar" variable objects. -- theGAtts -- List of "ncatt" global attribute objects. -- theRecdim -- The "ncdim" record-dimension object. - 例 -- nc = netcdf('foo.nc', 'write') -- if isempty(nc), error(' ## Bad netcdf operation.'), end -- theDims = dim(nc) % List of "ncdim" dimension objects. -- theVars = var(nc) % List of "ncvar" variable objects. -- theGAtts = att(nc) % List of "ncatt" global attribute objects. -- theRecdim = recdim(nc) % The "ncdim" record-dimension object. *** オブジェクトからデータを得る [#n065f6ef] - 文法 -- theVar = nc{'theVarname'}; -- theVar = nc{'theVarname'}(:); -- theVar = ncvar('theVarname', nc); - 内容 -- theVar -- The "ncvar" variable object. -- nc -- The parent "netcdf" object. -- theVarname -- The string-name of the variable. - 例 -- theVar = nc{'elevation'} *** データを書き込む [#g39c8167] nc=netcdf(fname,'write'); nc{'h'}(:)=h; close(nc); *Link [#z7919b6c] - [[mexnc:http://mexcdf.sourceforge.net/]] - [[snctools:http://mexcdf.sourceforge.net/tutorial/]] - [[NetCDF:http://www.unidata.ucar.edu/software/netcdf/]] -- [[netcdf time convention:http://www.unidata.ucar.edu/software/netcdf/time/]] -[[CSIRO matlab/netCDF interface:http://www.marine.csiro.au/sw/matlab-netcdf.html]] -[[MexCDF and NetCDF Toolbox For Matlab-5&6:http://woodshole.er.usgs.gov/staffpages/cdenham/public_html/MexCDF/nc4ml5.html]] - [[NetCDF Toolbox Interface Descriptions:http://mexcdf.sourceforge.net/netcdf_toolbox_guide.html]] - [[NetCDF Simple Demo:http://www.ems.psu.edu/~young/meteo473/netcdf_demo.m]]