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

[netCDF #JNH-860762]: Problems with CDL/vlen example



Lynton,

The problem has now been simplified to a small C program (attached) that 
creates a netCDF-4 file with one variable and gets an HDF5 error.  It's
not clear yet whether this is caused by a netCDF-4 bug or an HDF5 bug, but
we should be able to determine that by testing an equivalent HDF5 program
that doesn't use any netCDF-4 calls.  That has yet to be done ...

--Russ

> > New Client Reply: Problems with CDL/vlen example
> >
> > thanks Russ,
> > this is great news. I will need to schedule some time to get back to finish 
> > t
> > he work.I cannot do it right away but will get back to it as soon as I can.
> > Lynton
> >
> > -----Original Message-----
> > From: Unidata netCDF Support [mailto:address@hidden
> > Sent: 29 August 2012 20:55
> > To: Appel, Lynton
> > Cc: address@hidden; address@hidden; Appel, Lynton; sa
> > address@hidden
> > Subject: [netCDF #JNH-860762]: Problems with CDL/vlen example
> >
> > Hi Lynton,
> >
> > > Dear Sylwester and Russ,
> > > thanks for the enquiry
> > > I spent a lot of time on developing an upgraded C++ API that could
> > > handle user-defined in a much better way.  The validation process has got
> > > somewhat stalled by a bug in the netCDF-C layer or HDF5-layer.
> > > Russ is there any news on this?
> >
> > Yes, there is as of this afternoon.  The bug that was holding things up
> > appears to have been fixed with changes to netCDF-4 or HDF5.  I say "or",
> > because at this point, it's difficult to determine whether the fix was in
> > the upgrade from HDF5 1.8.8 to 1.8.9 or the netCDF-4 upgrade from 4.1.3
> > to 4.2.0, but it works now with the combination netCDF-4 version 4.2.1.1
> > and HDF5 version 1.8.9.  The details are in this Jira issue description
> > and comments:
> >
> >   https://www.unidata.ucar.edu/jira/browse/NCF-155
> >
> > Please try compiling and linking against the new versions and verify whether
> > you agree that the bug that was blocking release of your new version of the
> > netCDF-4 C++ release is now fixed.  I'm hoping no new bugs affecting that
> > code have been introduced ...
> >
> > --Russ
> >
> >
> >
> > Russ Rew                                         UCAR Unidata Program
> > address@hidden                      http://www.unidata.ucar.edu
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: JNH-860762
> > Department: Support netCDF
> > Priority: Critical
> > Status: Closed
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: JNH-860762
> > Department: Support netCDF
> > Priority: Critical
> > Status: Open
> > Link:  
> > https://www.unidata.ucar.edu/esupport/staff/index.php?_m=tickets&_a=vi
> > ewticket&ticketid=19304
> 
> 

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: JNH-860762
Department: Support netCDF
Priority: Critical
Status: Closed
#include <stdio.h>
#include <stdlib.h>
#include <netcdf.h>


typedef nc_vlen_t vl_t;
typedef struct cmp_t {
    vl_t strs[2];
} cmp_t;


void
check_err(const int stat, const int line, const char *file) {
    if (stat != NC_NOERR) {
        (void)fprintf(stderr,"line %d of %s: %s\n", line, file, 
nc_strerror(stat));
        fflush(stderr);
        exit(1);
    }
}

int
main() {/* create bugn.nc */

    int  stat;  /* return status */
    int  ncid;  /* netCDF id */

    /* group ids */
    int root_grp;

    /* type ids */
    int vl_t_typ;
    int cmp_t_typ;

    /* variable ids */
    int var_id;

    /* rank (number of dimensions) for each variable */
#   define RANK_var 0

    /* enter define mode */
    stat = nc_create("bugn.nc", NC_CLOBBER|NC_NETCDF4, &ncid);
    check_err(stat,__LINE__,__FILE__);
    root_grp = ncid;

    stat = nc_def_vlen(root_grp, "vl_t", NC_STRING, &vl_t_typ);              
    check_err(stat,__LINE__,__FILE__);

    stat = nc_def_compound(root_grp, sizeof(cmp_t), "cmp_t", &cmp_t_typ);    
    check_err(stat,__LINE__,__FILE__);
    {
    static int strs_dims[1] = {2};    
    stat = nc_insert_array_compound(root_grp, cmp_t_typ, "strs", 
NC_COMPOUND_OFFSET(cmp_t,strs), vl_t_typ, 1, strs_dims);    
    check_err(stat,__LINE__,__FILE__);
    }

    /* define variables */
    stat = nc_def_var(root_grp, "var", cmp_t_typ, RANK_var, 0, &var_id);
    check_err(stat,__LINE__,__FILE__);

    /* leave define mode */
    stat = nc_enddef (root_grp);
    check_err(stat,__LINE__,__FILE__);

    /* assign variable data */

    {
    static const char* vlen_3[] = {"ab", "cde", "fg"} ;
    static const char* vlen_4[] = {"hijk", "lm"} ;
    size_t zero = 0;
    static cmp_t var_data[1] = {{{{3, (void*)vlen_3}, {2, (void*)vlen_4}}}};
    stat = nc_put_var1(root_grp, var_id, &zero, var_data);
    check_err(stat,__LINE__,__FILE__);
    }

    stat = nc_close(root_grp);
    check_err(stat,__LINE__,__FILE__);
    return 0;
}

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.