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

[netCDF #JUF-873258]: Just a single example, please, would surely be quite helpful



The key is that you have to define a structure type in fortran
that corresponds to the compound type in the file.
By doing a web search for "defining a struct type in fortran"
I found some examples of doing that.

> 
> I have been unable to read compound user defined type variables with
> NF90_GET_VAR
> 
> (no problems to read simple type variables - the difficulty is with
> compound user types only)
> 
> I have a file with netcdf-4 format. That file has the root group and
> this has two groups.
> 
> One of these groups, named LEVEL-3_BINNED_DATA, has 4 variables (or
> datasets). Each variable has dimension 1 and size 4320.
> 
> One of these variables is named BinList and has 5 fields of different
> types, as listed below:
> 
> Variables in the group level-3_binned_data
> 
> Output from nf90_inquire_variable for variable with name:
> BinList
> ---------------------------------------------------------
> Type:
> 17
> Number of dimensions: 1
> Vector of IDs of every dimension:
> 1
> -----
> 
> Variable name: BinList
> Type ID: 17
> Type name: binListType
> Type size:
> 16
> Type base ID: 0
> Type fields: 5
> Type class:
> 16
> -------------------
> 
> Variable BinList, field number 1:
> field_name:
> bin_num
> field_offset: 0
> field_typeID: 9
> field_ndims: 0
> 
> field_dimsizes: 0
> Variable BinList, field number 2:
> field_name: nobs
> 
> field_offset: 4
> field_typeID: 3
> field_ndims: 0
> field_dimsizes:
> 0
> Variable BinList, field number 3:
> field_name: nscenes
> field_offset:
> 6
> field_typeID: 3
> field_ndims: 0
> field_dimsizes: 0
> Variable BinList,
> field number 4:
> field_name: weights
> field_offset: 8
> field_typeID: 5
> 
> field_ndims: 0
> field_dimsizes: 0
> Variable BinList, field number 5:
> 
> field_name: time_rec
> field_offset: 12
> field_typeID: 5
> field_ndims: 0
> 
> field_dimsizes: 0
> variable BinList has no attributes [mVarAttsNum( 1, 1,
> 1) = 0]
> 
> I would appreciate if you could help me how shouid I read the data,
> for example, from field number 4, please.
> 
> The Fortran Interface User Guide does NOT provide a single example
> on using NF90_GET_VAR to read values from compound user defined type
> variables.
> 
> If you could send me just a single example, that would surely be enough
> to desintegrate right away this road bloc on my work...
> 
> I thank you for the kindness of your attention and help.
> 
> Kind regards
> 
> Arlindo Arriaga,
> PhD Meteorology UW-Madison 1991.
> 
> 
> 

=Dennis Heimbigner
  Unidata


Ticket Details
===================
Ticket ID: JUF-873258
Department: Support netCDF
Priority: Critical
Status: Open
===================
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.