# how to use Matlab netCDF functions for 4 dimensions data?

20 views (last 30 days)
nsyn on 9 Jun 2016
I have data with four dimensions, there are (lon,lat,level,time). I have no idea what should I do with this kind of data.. this is the display of my data:
Variablename Size: 249x249x34x2 Dimensions: west_east,south_north,bottom_top,Time Datatype: single Attributes: FieldType = 104 MemoryOrder = 'XYZ' description = 'pm10 dry mass' units = 'ug m^-3' stagger = '' coordinates = 'XLONG XLAT'
% code
clc
clear
file = 'F:\...\';
DATA = squeeze(data(:,:,1,1)); % I just think this command usable to 4D data (lon,lat,level,time), I don't know for sure
DATA = log10(DATA);
% lattitude and longitude
xlat = lat(1,:,1);
xlon = lon(:,1,1);
[xlat,xlon] = meshgrid(xlat,xlon);
When I use 'surfacem(xlat,xlon,DATA);' with the codes that following above, my result it is not look good, the DATA only shown around the ocean (lat and lon). please give me the suggestions the correct way to read 4D data and get the result from that kind of data.. I really need your help Thank you

#### 1 Comment

Chad Greene on 9 Jun 2016
If you double-click on DATA in the workspace it will show you the values in DATA. So to identify whether the problem is with surfacem or the underlying DATA, what are the values in DATA?

KSSV on 9 Jun 2016
where start,count,jump will be vectors of size 4X1 (because you are dealing with 4D data)...default values of jump is [1,1,1,1]...you can put your interested number, jump will skip the data by the numbers given in the vector jump.
If count is [inf,inf,inf,inf], it will consider the matrix till the end. This will specify the end point of the data.
If start is [1,1,1,1], matrix will be read from first position of each dimension.
Reading your own interest data is pretty straight forward by varying start,count,jump. Read the documentation multiple times, it makes things clear.

Muhammad Usman Saleem on 9 Jun 2016
if you are using NCAR reanalysis then use get_NCAR function to process