RGDX compress issue

Post Reply
Posts: 6
Joined: 2 weeks ago

RGDX compress issue

Post by hermann.westerholt » 1 week ago


I am having some trouble with the compress feature of the GDXMRW tool (GAMS 24.9) in Matlab (R2017b). I hope that the following piece of code can explain my problem (Matlab and GDX file also in the attachments):

Code: Select all

%% Introductory text for clarity:
% price.gdx contains parameters of price data, such as the German day-ahead price
% for electricity in 2016 ('DAP'). In the underlying model, a year consists
% of 52 weeks, and a week consists of 168 hours. When displayed in 'full'
% form, the parameter DAP(w,h) is structured accordingly:
% DAP_full.val = [52x168] double

guel = @(s,v) strcat(s,strsplit(num2str(v)));

s.name = 'DAP';
s.form = 'full';
s.uels = {guel('',1:52),guel('',1:168)};
DAP_full = rgdx('prices.gdx',s);

% So far, so good. Displaying the very same parameter in 'sparse' and 
% 'uncompressed' form, should yield a matrix with 52x168 = 8736 lines and
% 3 columns (1st col: week, 2nd col: hour, 3rd col: price).

s.compress = 'false';
s.form = 'sparse';
DAP_sparse = rgdx('prices.gdx',s);

% Unfortunately, DAP_sparse.val only contains 8735 entries. As can be
% verified with DAP_full, the price in hour 124 of week 5 is zero. This is
% the very same entry which is missing in DAP_sparse.val - it appears that
% setting the compress field to 'false' does not have the desired effect.
Any help with this issue is highly appreciated.

Best regards,
(26.5 KiB) Downloaded 4 times

Post Reply