1 |
function foo = gluemnc(diags,nIter0) |
2 |
% gluemnc.m |
3 |
% written by david wang, ldeo |
4 |
% |
5 |
% purpose: use mnc_assembly.m to glue the multi-tile *.*.nc mnc output |
6 |
% into a single "global" nc file, which is subject to further |
7 |
% manipulation (e.g., adding/modifying coordiates/attributes) |
8 |
% if necessary. |
9 |
% |
10 |
% diags: diagnostics name |
11 |
% nIter0: 10-digit iterate # |
12 |
% EXAMPLE: |
13 |
% foo = gluemnc('state','0000000000'); |
14 |
|
15 |
% $Header: $ |
16 |
% $Name: $ |
17 |
|
18 |
if nargin ~= 2, error('there have to be two input arguments!'); end |
19 |
|
20 |
nc_in = [diags,'.',nIter0,'.t%03d.nc']; |
21 |
nc_inone = [diags,'.',nIter0,'.t001.nc']; |
22 |
nc_inall = [diags,'.',nIter0,'.t*.nc']; |
23 |
nc_out = [diags,'_',nIter0,'.nc']; |
24 |
|
25 |
varlist = ncload(nc_inone); |
26 |
nvars = length(varlist); |
27 |
vars = struct([]); |
28 |
|
29 |
for i = 1:nvars, |
30 |
vars(i).name = char(varlist(i)); |
31 |
end |
32 |
|
33 |
[nt,nf] = mnc_assembly(nc_in, vars, nc_out); |
34 |
|
35 |
reply = input('delete the original tiled files? [y/n] ','s'); |
36 |
if isempty(reply), reply = 'y'; end |
37 |
if strcmpi(reply,'y'), delete(nc_inall); end |
38 |
|
39 |
return |