[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #EPZ-402342]: Clarification about Multi dimension variable



Hello,

I'm happy to try to answer your question.  

Regarding your first question, you would typically use 'coordinate variables' 
to index into the multiple dimensions; these coordinate variables have the same 
name as the dimension, and you can find more information about them here:

* 
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf_data_set_components.html#coordinate_variables

The coordinate variables would contain the values of the corresponding 
latitude, longitude and level of the various measurements and would be used to 
index into the data structure.

Regarding your second question, the time dimension is exactly as you suppose; 
it records the time of each measurement. 

I hope this helps!

-Ward

> Hello There,
> 
> 
> I am studying the NetCDF4 for writing Boundary Layer data using the NetCDF4 
> format.
> 
> 
> I see that there are components like,
> 
> Variable,
> 
> Dimension,
> 
> Attribute, etc..
> 
> 
> Everything seems to be ok for me but dimension looks little confusing.
> 
> 
> What I understand is I can create variables and write data using 2D or 3D 
> arrays(multi dimensional).
> 
> 
> What is the significance of having it multi dimensional? I mean, for example 
> I am writing pressure data and have declared pressure variable as,
> 
> 
> ======================================
> 
> 
> #define NDIMS 4
> #define NLAT 6
> #define NLON 12
> #define LAT_NAME "latitude"
> #define LON_NAME "longitude"
> #define NREC 2
> #define REC_NAME "time"
> #define LVL_NAME "level"
> #define NLVL 2
> 
> 
> /* DECLARING DIMENSIONS */
> 
> if ((retval = nc_def_dim(ncid, LVL_NAME, NLVL, &lvl_dimid)))
> ERR(retval);
> if ((retval = nc_def_dim(ncid, LAT_NAME, NLAT, &lat_dimid)))
> ERR(retval);
> if ((retval = nc_def_dim(ncid, LON_NAME, NLON, &lon_dimid)))
> ERR(retval);
> if ((retval = nc_def_dim(ncid, REC_NAME, NC_UNLIMITED, &rec_dimid)))
> ERR(retval);
> 
> 
> dimids[0] = rec_dimid;
> dimids[1] = lvl_dimid;
> dimids[2] = lat_dimid;
> dimids[3] = lon_dimid;
> 
> 
> /* DECLARING Variable */
> 
> 
> retval = nc_def_var(ncid, PRES_NAME, NC_FLOAT, NDIMS,
> dimids, &pres_varid)
> 
> 
> ======================================
> 
> I have couple of questions here,
> 
> 
> Q-1
> 
> In the above example, at any given point in time it will be holding the 
> pressure data.
> 
> It can hold maximum of NLVL * NLAT * NLON data, how each data is traced with 
> Latitude, Longitude and level?
> 
> 
> Is it so that I should have separate variables for Lat, Long and Lvl also to 
> store the value for latitude, longitude and level? Otherwise just storing the 
> pressure using this 3d array will just give me the plain pressure data
> 
> 
> Q-2
> 
> What is the significance of TIME dimension? Is it like to store the time of 
> data collection?
> 
> 
> 
> These might be silly question for you but I am bit puzzled.
> 
> 
> Appreciate your time and patience to answer my queries.
> 
> 
> Thanks
> 
> Suresh Panara
> 
> 
> 


Ticket Details
===================
Ticket ID: EPZ-402342
Department: Support netCDF
Priority: Normal
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.