Error opening IASI L1 native file in matlab using CODA

Hi, I am having problems when I call the function coda_fetch for the L1 file of IASI.
The function works properly for the L2 files and I can see the fields contained in the file, though for the L1 files I get this error:
Unexpected Standard exception from MEX file.
What() is:bad allocation

Error in coda_fetch (line 25)
[varargout{1:max(1,nargout)}] = coda_matlab(‘FETCH’,varargin{:});

All L1 files exceed 2 Gb, is that the problem?
Are there any way to solve this issue or to retreive the variables?


This may be a 32bit limitation somewhere. What operating system are you running this on, and which coda version are you using? And which MATLAB version?

Hi, thank you for your answer.
I am on a Windows 10 system, using the Matlab version 9.11 (R2021b). I have installed coda through the binary installation, the version is 2.24.

However, my computer has 8 Gb of RAM so I have increased the virtual memory up to 5223 Mb, in this way the “maximum possible array” in matlab is now around 8000 Mb.
It works though is very slow, even saving the workspace and reloading it instead of calling coda functions every time.
Any suggestion on more efficient ways?

Could you maybe show how you are actually trying to read data from the product? Are you doing a full product fetch? If so, you should definitely try to break up your reads. And that will likely solve things.

There is an example in python that shows how this works for the GOME-2 L1b product (GOME-2 L1b has a sort-of similar format to the IASI L1 one). However, this example uses the lower-level coda functions, that are only available in python. For iterating over dataset records in CODA for MATLAB, you might look at e.g. an example for MIPAS L1. If you combine the information from both examples, together with the coda format definition documentation, you might be able to read through the product iteratively and thus reduce the overall memory usage.

1 Like

Thank you! The links were very useful, now it works better and I can retrieve all the variables I need in few seconds