[MITgcm-support] Bug in rdmds.m when loading multiple record files

Yuan Lian lian at ashimaresearch.com
Mon May 13 19:03:41 EDT 2013


Hi all,

I noticed a bug in rdmds.m under MITgcm/utils/matlab, which only affects 
the multiple-record files.

The problem comes from line 149:
allfiles=dir( sprintf('%s*.meta',fname) );

For example, when one wants to load A=rdmds('T', 'rec', 1), it actually 
will look up all variables starting with
'T', including 'Ttave' etc. This is particularly problematic if there 
are user defined output variables, e.g.,
if one wants to use variable name 'TSK' (surface temperature in this 
example). Because the function
"localrdmds" in rdmds is called within the j=1, size(allfiles,1) loop 
(line 157), the desired variable "T"
will be partially or entirely overwritten by "TSK" depending on the size 
of TSK.

Moving "*" right before "meta" can easily address the issue without 
affecting other functionality:
allfiles=dir( sprintf('%s.*meta',fname) );

Hope this helps.

Best,
Yuan


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20130513/3fc7845a/attachment.htm>


More information about the MITgcm-support mailing list