Commits (3)
......@@ -3,7 +3,7 @@ variables:
TERM: linux
MATLAB_VERSION: R2020b
OLD_MATLAB_VERSION: R2014a
OCTAVE_VERSION: 5.2.0
OCTAVE_VERSION: 6.2.0
before_script:
- git clone https://git.dynare.org/Dynare/m-unit-tests
......
[![pipeline status](https://git.dynare.org/Dynare/dseries/badges/master/pipeline.svg)](https://git.dynare.org/Dynare/dseries/commits/master)
This MATLAB/Octave toolbox comes with two classes:
This MATLAB/Octave toolbox comes with three classes:
- `@dates` which is used to handle dates.
- `@dseries` which is used to handle time series data.
- `@x13` which provides an interface to X13-ARIMEA-SEATS.
The package is a dependence of
[Dynare](https=//git.dynare.org/Dynare/dynare), but can also be used
......@@ -27,13 +28,12 @@ or downloading a zip archive:
Add the `dseries/src` folder to the MATLAB/Octave path, and run the following command (on MATLAB/Octave) prompt:
>> dseries().initialize()
>> initialize_dseries_class
which, depending on your system, will add the necessary subfolders to
the MATLAB/Octave path.
You are then ready to go. A full documentation will come soon,
but you can already obtain a general idea by looking into the Dynare
You are then ready to go. A full documentation is available in the Dynare
reference manual.
Note that [X13-ARIMA-SEATS](https://www.census.gov/srd/www/x13as/) is required
......
......@@ -38,14 +38,7 @@ if ~isequal(o.freq, p.freq)
return
end
% Octave 6.1.0 added support for the 'legacy' option, but it was buggy.
% The problem should be fixed in Octave 6.2.0.
% See: https://savannah.gnu.org/bugs/?59708
if isoctave && octave_ver_less_than('6.2')
time = intersect(o.time, p.time);
else
time = intersect(o.time, p.time, 'legacy');
end
time = intersect(o.time, p.time, 'legacy');
q = dates();
if isempty(time)
......
......@@ -42,11 +42,7 @@ if ~isequal(o.freq, p.freq)
error('dates:remove', 'Inputs must have common frequency.')
end
if isoctave && octave_ver_less_than('6')
time = setdiff(o.time, p.time);
else
time = setdiff(o.time, p.time, 'legacy');
end
time = setdiff(o.time, p.time, 'legacy');
o.time = time;
......@@ -180,4 +176,4 @@ if t(1)
end
T = all(t);
%@eof:7
\ No newline at end of file
%@eof:7
......@@ -48,18 +48,10 @@ if isequal(o.length(), p.length()) && isequal(o, p)
return
end
if isoctave && octave_ver_less_than('6')
if nargout<2
time = setdiff(o.time, p.time);
else
[time, io] = setdiff(o.time, p.time);
end
if nargout<2
time = setdiff(o.time, p.time, 'legacy');
else
if nargout<2
time = setdiff(o.time, p.time, 'legacy');
else
[time, io] = setdiff(o.time, p.time, 'legacy');
end
[time, io] = setdiff(o.time, p.time, 'legacy');
end
q = dates(o.freq);
......@@ -182,4 +174,4 @@ if t(1)
t(2) = isequal(c1, d3);
end
T = all(t);
%@eof:6
\ No newline at end of file
%@eof:6
......@@ -30,11 +30,7 @@ if o.ndat()<=1
return
end
if isoctave && octave_ver_less_than('6')
[~, id] = unique(o.time);
else
[~, id] = unique(o.time(:,1), 'legacy');
end
[~, id] = unique(o.time(:,1), 'legacy');
o.time = o.time(sort(id));
......
function initialize_dseries_class()
% Copyright © 2015-2020 Dynare Team
% Copyright © 2015-2021 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -111,4 +111,12 @@ if isempty(select_x13_binary(true))
rmpath([dseries_src_root 'utilities/x13']);
end
% The following version requirement should not be stricter than the one in
% Dynare (matlab/dynare.m and mex/build/octave/configure.ac)
if isoctave && octave_ver_less_than('6.2.0')
skipline()
warning(['This version of dseries has only been tested on Octave 6.2.0 and above. It may fail to run or give unexpected result. Consider upgrading your version of Octave.'])
skipline()
end
assignin('caller', 'dseries_src_root', dseries_src_root);
......@@ -6,7 +6,7 @@ function ds = convert_mdbnomics(o)
% OUTPUTS
% - ds [dseries]
% Copyright (C) 2020 Dynare Team
% Copyright (C) 2020-2021 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -29,21 +29,13 @@ end
ds = dseries();
% Check for multiple datasets
if isoctave && octave_ver_less_than('6')
dataset_codes = unique(o.data(:,o.col_idx.dataset_code));
else
dataset_codes = unique(o.data(:,o.col_idx.dataset_code),'stable');
end
dataset_codes = unique(o.data(:,o.col_idx.dataset_code),'stable');
% Convert mdbnomics to dseries
for ii = 1:length(dataset_codes)
% Slice data for dataset
ds_dataset = o.data(strcmp(o.data(:,o.col_idx.dataset_code),dataset_codes{ii}),:);
if isoctave && octave_ver_less_than('6')
series_codes = unique(ds_dataset(:,o.col_idx.series_code));
else
series_codes = unique(ds_dataset(:,o.col_idx.series_code),'stable');
end
series_codes = unique(ds_dataset(:,o.col_idx.series_code),'stable');
% Get list of variable names
list_of_names = cellfun(@(x)regexprep(x, '[^a-zA-Z0-9]', '_'), series_codes, 'UniformOutput', false);
% Get dataset values
......@@ -90,11 +82,7 @@ end
% Add tags to the variables
if length(dataset_codes) > 1
if isoctave && octave_ver_less_than('6')
series_codes = unique(o.data(:,o.col_idx.series_code));
else
series_codes = unique(o.data(:,o.col_idx.series_code),'stable');
end
series_codes = unique(o.data(:,o.col_idx.series_code),'stable');
list_of_names = cellfun(@(x)regexprep(x, '[^a-zA-Z0-9]', '_'), series_codes, 'UniformOutput', false);
series_length = cell2mat(cellfun(@(x)length(find(strcmp(x, o.data(:,o.col_idx.series_code)))), series_codes, 'UniformOutput', false));
end
......