Direct-access binary files

2 vues (au cours des 30 derniers jours)
Mattia Albertini
Mattia Albertini le 8 Mar 2020
Hi,
I need to upload a dataset on MatLab for research purposes, and the best dataset I was able to find apparently is formatted as a direct access binary file, here it comes:
Data files are written as direct-access binary files.
Infofile description:
Row 1 longitude resolution (XSTEP)
Row 2 latitude resolution (YSTEP)
Row 3 number of rows (NROWS)
Row 4 number of columns (NCOLS)
Row 5 no data code (NODATA)
Row 6 longitude of the central point of the upper left grid box (ULXCUT)
Row 7 latitude of the central point of the upper left grid box (ULYCUT)
Row 8 record length in bytes (BANDROWBYTES)
Row 9 file name
Now, my question is extremely simple: How do I extract all the informations contained here in a table? With the current information I found online I wasn't able to do anything.
  3 commentaires
Mattia Albertini
Mattia Albertini le 8 Mar 2020
Unfortunately, I am not allowed to share the documentation. I got access to the dataset from the following website:
but to be able to view the data you have to ask formally the dataset and state Your purpose.
The message I have written above was contained in a folder with two files: CLINO_PCP_ITA_Y & CLINO_PCP_ITA_Y.inf that is all..
Walter Roberson
Walter Roberson le 8 Mar 2020
To confirm, the .inf file is a text file that describes the corresponding file that does not have an extension?

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 8 Mar 2020
The .inf file appears to be a text file. Read the first 8 rows of it as numbers and assign to appropriate variables.
After that you would probably use https://www.mathworks.com/help/matlab/ref/multibandread.html multiband read. Offset would be 0. I suspect that precision is 'single'. Difficult to guess whether it is big-endian or little-endian. bands is probably 1. It is not immediately clear whether the data is in row-major order or column-major order so it is not clear whether you should use [nrows, ncols] or [ncols, nrows] as the size parameter.
I am not sure at the moment what the bandrowbytes would do for you... unless, that is, there are multiple bands
Can you show us a sample .inf file, and show us the size of the corresponding binary file?
My suspicion is that the "no data code" is the value that is stored in the file to indicate that no data is available at that location.
  2 commentaires
Mattia Albertini
Mattia Albertini le 9 Mar 2020
Thank you Walter for Your suggestions,
The .inf file is,
XSTEP=0.00833333333333
YSTEP=0.00833333333333
NROWS= 1801
NCOLS= 1801
NODATA= -9999
ULXCUT 5.00416666666667
ULYCUT= 49.99583333333333
BANDROWBYTES= 7204
CLINO_TMM_ITA_Y
Walter Roberson
Walter Roberson le 9 Mar 2020
Ok so the data is stored by row and each value is indeed 4 bytes

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by