[Dart-dev] DART/branches Revision: 11061
dart at ucar.edu
dart at ucar.edu
Wed Feb 8 16:21:54 MST 2017
thoar at ucar.edu
2017-02-08 16:21:54 -0700 (Wed, 08 Feb 2017)
90
plot_total_err now works for lorenz_63 (and quite possibly most other low-order models).
Modified: DART/branches/rma_single_file/matlab/CheckModel.m
===================================================================
--- DART/branches/rma_single_file/matlab/CheckModel.m 2017-02-08 23:19:14 UTC (rev 11060)
+++ DART/branches/rma_single_file/matlab/CheckModel.m 2017-02-08 23:21:54 UTC (rev 11061)
@@ -4,7 +4,7 @@
% vars is a structure containing a minimal amount of metadata about the netCDF file.
%
% EXAMPLE:
-% fname = 'Prior_Diag.nc';
+% fname = 'preassim_member_0001.nc';
% vars = CheckModel(fname)
%% DART software - Copyright UCAR. This open source software is provided
@@ -16,11 +16,11 @@
if ( exist(fname,'file') ~= 2 ), error('%s does not exist.',fname); end
% Get some information from the file
-model = nc_attget(fname,nc_global,'model');
-num_copies = dim_length(fname,'copy'); % determine # of ensemble members
+model = ncreadatt(fname,'/','model');
+num_copies = dim_length(fname,'member'); % determine # of ensemble members
[ens_size, ens_indices] = get_ensemble_indices(fname);
-times = nc_varget(fname,'time');
-timeunits = nc_attget(fname,'time','units');
+times = ncread(fname,'time');
+timeunits = ncreadatt(fname,'time','units');
timebase = sscanf(timeunits,'%*s%*s%d%*c%d%*c%d'); % YYYY MM DD
timeorigin = datenum(timebase(1),timebase(2),timebase(3));
dates = times + timeorigin;
@@ -36,11 +36,10 @@
case {'9var','lorenz_63','lorenz_84','ikeda'}
- num_vars = dim_length(fname,'StateVariable'); % determine # of state varbls
- StateVariable = nc_varget(fname,'StateVariable');
+ num_vars = dim_length(fname,'location'); % determine # of state varbls
def_state_vars = zeros(1,num_vars); % for use as a subscript array,
- def_state_vars(:) = StateVariable(:); % def_state_vars must be a row vector.
+ def_state_vars(:) = 1:num_vars; % def_state_vars must be a row vector.
vars = struct('model',model, ...
'def_var','state', ...
@@ -50,8 +49,8 @@
'ensemble_indices',ens_indices, ...
'time',dates, ...
'time_series_length',num_times, ...
- 'min_state_var',min(StateVariable), ...
- 'max_state_var',max(StateVariable), ...
+ 'min_state_var',1, ...
+ 'max_state_var',num_vars, ...
'def_state_vars',def_state_vars);
vars.fname = fname;
Modified: DART/branches/rma_single_file/matlab/CheckModelCompatibility.m
===================================================================
--- DART/branches/rma_single_file/matlab/CheckModelCompatibility.m 2017-02-08 23:19:14 UTC (rev 11060)
+++ DART/branches/rma_single_file/matlab/CheckModelCompatibility.m 2017-02-08 23:21:54 UTC (rev 11061)
@@ -35,16 +35,12 @@
pinfo_out.diagn_time = [-1,-1];
%% Get some information from the file1
-tmodel = nc_attget(file1,nc_global,'model');
+tmodel = ncreadatt(file1,'/','model');
-if (isempty(tmodel))
- error('%s has no ''model'' global attribute.',file1)
-end
-
tvars = get_DARTvars(file1);
tnum_times = dim_length(file1,'time');
-times = nc_varget( file1,'time');
-timeunits = nc_attget( file1,'time','units');
+times = ncread( file1,'time');
+timeunits = ncreadatt( file1,'time','units');
timebase = sscanf(timeunits,'%*s%*s%d%*c%d%*c%d'); % YYYY MM DD
timeorigin = datenum(timebase(1),timebase(2),timebase(3));
ttimes = times + timeorigin;
@@ -55,16 +51,12 @@
end
%% Get some information from the file2
-dmodel = nc_attget(file1,nc_global,'model');
+dmodel = ncreadatt(file1,'/','model');
-if (isempty(dmodel))
- error('%s has no ''model'' global attribute.',file2)
-end
-
dvars = get_DARTvars(file2);
dnum_times = dim_length(file2,'time');
-times = nc_varget( file2,'time');
-timeunits = nc_attget( file2,'time','units');
+times = ncread( file2,'time');
+timeunits = ncreadatt( file2,'time','units');
timebase = sscanf(timeunits,'%*s%*s%d%*c%d%*c%d'); % YYYY MM DD
timeorigin = datenum(timebase(1),timebase(2),timebase(3));
dtimes = times + timeorigin;
@@ -88,17 +80,19 @@
error('no No NO ... both files must have same shape of state variables.')
More information about the Dart-dev
mailing list