prints
[wrffire.git] / other / Matlab / netcdf / README_matlab_netcdf.txt
blob6b7f5db4fc7525a0bb4cce8ab37458ea83b21de7
1 Files in this directory are to read/write NETCDF files from matlab.
3 1. download the version of mexnc appropriate for your matlab from 
4    http://mexcdf.sourceforge.net/downloads, suggest to this directory
5 2. uncompress and untar the file here so that mexnc is a subdirectory of this
6 directory
8 cd ../../..
9 cd wrfv2_fire/test/em_fire
10 <run wrf to produce some wrfrst* files> or put wrfrst files here
11 matlab
12 (executes startup.m; you should see a listing of files including ncdump)
13 >> f='wrfrst....'              % choose a netcdf file
14 >> p=ncdump(f)                 % list info on all variables
15 >> p=ncdump(f,'LFN')           % get info and value of one variable as
16 >> v=ncextract(p);             % extract variable value as Matlab array
17 >> lfn=ncread(f,'LFN');        % or, get the array directly 
18 >> ncload(f); mesh(lfn)        % alternatively, load all variables into the workspace
20 works also in em_real
25 NOTE: in variable info, _nc is type used to read from netcdf, _m is the matlab
26 type corresponding to what is in the netcdf file. The type in the netcdf file
27 is determined from numerical values of the data type (vartype for variables
28 and datatype for attributes). The translation table is in private/ncdatatype.m
29 I am not sure if the table is correct because the numerical values for data
30 type are not documented. The documentation uses symbolic constants. 
32 The disadvantage is that wrf creates the netcdf files (the wrfrst* and wrfout*) files at most once a minute, and only the arrays that are in the state are in those files. So, another possibility is call subroutine write_array_m in the code and then read the files using Matlab/util1_jan/read_array_m.m. See other/Matlab/vis But that will not work properly when wrf runs in parallel, 
33 either OpenMP or MPI.