Menu

NetCDF file handling crash

Help
2009-01-29
2013-06-03
  • John Burton

    John Burton - 2009-01-29

    Can anyone help?

    When reading a NetCDF file,  with GDL rc1 I get the following error:

    gdl: dstructgdl.hpp:380: void DStructGDL::InitTag(const std::string&, const DataGDL&) [with DataGDL = Data_<SpDULong>]: Assertion `GetTag( tIx)->N_Elements() == data.N_Elements()' failed.

    This bug has been reported on the Debian support website (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500136), on 25 Sep. 2008, but I've seen no response. More information from the bug report:

    Package: gnudatalanguage
    Version: 0.9~rc1-1.1
    Severity: important

    Inquiring a NetCDF variable with more than one dimension leads to an
    assertion error in dstructgdl.hpp when the tag DIM is initialized as
    GetTag(tIx)->N_Elements() == 1 and data.N_Elements == 2 (in fact the real
    dimension)

    gdl: dstructgdl.hpp:380: void DStructGDL::InitTag(const std::string&,
    const DataGDL&) [with DataGDL = Data_<SpDULong>]: Assertion `GetTag(
    tIx)->N_Elements() == data.N_Elements()' failed.

    This renders the package nearly unusable if you are dealing with NetCDF
    files.

    Here is a simple program code to reproduce the error

    ------------ snip here ------------
    fid = NCDF_OPEN('simple.nc')

    ; getting the variables is ok
    NCDF_VARGET, fid, 0, test1d
    NCDF_VARGET, fid, 1, test2d
    PRINT, '1d'
    PRINT, test1d
    PRINT, '2d'
    PRINT, test2d

    ; inquiring 1d-variables is ok
    inq1d = NCDF_VARINQ(fid, 0)
    PRINT, '1d'
    PRINT, inq1d

    ; but inquiring 2d (or nd) variables fails with an assertion error
    inq2d = NCDF_VARINQ(fid, 1)
    PRINT, '2d'
    PRINT, inq2d

    END
    ------------ snip here ------------

    and the NetCDF file can be produce by running
    ncgen -o simple.nc simple.txt
    with simple.txt being the following:
    ------------ snip here ------------
    netcdf simple {
    dimensions:
        x = 2 ;
        y = 2 ;
    variables:
            int test1d(x) ;
               test1d:long_name = "test1d" ;
                      test1d:standard_name = "test1d" ;
               int test2d(y, x) ;
               test2d:long_name = "test2d" ;
                      test2d:standard_name = "test2d" ;

    data:

    test1d = 1, 2 ;

    test2d =
       1, 2,
       3, 4 ;
    }
    ------------ snip here ------------

     
    • Alain C.

      Alain C. - 2009-01-29

      First of all,
      could make a try with the new gdl-0.9rc2 ?

      I am not an expert on Debian and on NetCDF
      but I do compiled the CVS versions (since at least one year)
      and the 0.9rc1 and 0.9rc2
      with     NetCDF on recent Debian machines (x86_64 and i686)

      FYI :

      gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

      ldd ./src/gdl
      [...]
      libnetcdf.so.3 => /usr/lib64/libnetcdf.so.3 (0x00007ffff7347000)

       
    • Sylwester Arabas

      Hello,

      This should not be happening anymore in 0.9-rc2.
      I've commented on it in the GDL tracker as well as in the Debian bug entry:

      https://sourceforge.net/tracker2/?func=detail&aid=2546175&group_id=97659&atid=618683
      http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500136

      Regards
      Sylwester

       
  • Alain C.

    Alain C. - 2012-08-07

    the current version of GDL perfectly works on this example.
    I tested on various OS

    Alain

     

Log in to post a comment.