Direct-access binary files

조회 수: 3 (최근 30일)
Mattia Albertini
Mattia Albertini 2020년 3월 8일
댓글: Walter Roberson 2020년 3월 9일
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
Mattia Albertini
Mattia Albertini 2020년 3월 8일
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 2020년 3월 8일
To confirm, the .inf file is a text file that describes the corresponding file that does not have an extension?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 3월 8일
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
Mattia Albertini
Mattia Albertini 2020년 3월 9일
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 2020년 3월 9일
Ok so the data is stored by row and each value is indeed 4 bytes

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by