switch(nctype) statement fell through...

Developers
Anonymous
2012-09-07
2013-10-17

  • Anonymous
    2012-09-07

    I created a netCDF4 file  and wanted to dump the global attributes: ncks -M tpc100p009.nc. This bombs out at an attribute which is (from ncdump, which has no issue with it): Cycle_Number = 100L.

    The error is: nco_dfl_case_nc_type_err(): ERROR switch(nctype) statement fell through to default case, which is illegal.
    Not handling the default case causes gcc to emit warnings when compiling NCO with the NETCDF2_ONLY token (because nctype definition is braindead in netCDF2.x). Exiting…
    nco_err_exit(): ERROR NCO will now exit with system call exit(EXIT_FAILURE)

     
  • Charlie Zender
    Charlie Zender
    2012-09-07

    thanks for your report.
    ncks should work fine on netCDF4 files that do not contain netCDF4 features of groups or opaque types.
    if the input file includes those kind of netCDF4 features, then ncks probably crashed because of that.
    otherwise, you may have found a bug, and i encourage you to post the input file where we can examine it.
    cz

     
  • Charlie Zender
    Charlie Zender
    2012-09-09

    works fine for me (see below). you are probably using an old version of ncks
    that cannot handle NC_INT64.  suggest you upgrade to latest version to be sure.
    cz

    zender@roulee:~/Téléchargements$ ncks -M tpc100p009.nc
    Opened file tpc100p009.nc: dimensions = 2, variables = 147, global atts. = 36, ID = 65536, type = NC_FORMAT_NETCDF4
    Global attribute 0: Conventions, size = 6 NC_CHAR, value = CF-1.6
    Global attribute 1: title, size = 63 NC_CHAR, value = TOPEX/POSEIDON MGDR-B Pass File converted from CCSDS to netCDF4
    Global attribute 2: institution, size = 22 NC_CHAR, value = University of Colorado
    Global attribute 3: history, size = 64 NC_CHAR, value = 2012-09-02 01:08:36: Created by mastersd on crozon.colorado.edu

    Global attribute 4: references, size = 29 NC_CHAR, value = http://sealevel.colorado.edu/
    Global attribute 5: comment, size = 208 NC_CHAR, value = Conversion from native CCSDS to netCDF4 performed using python function tp_mgdrb2nc based on CODA python interface (http://www.stcorp.nl/coda/doc/) and Topex_Poseidon-PODAAC.codadef and netCDF4 python module.
    Global attribute 6: Producer_Agency_Name, size = 4 NC_CHAR, value = NASA
    Global attribute 7: Producer_Institution_Name, size = 5 NC_CHAR, value = JPL 
    Global attribute 8: Source_Name, size = 14 NC_CHAR, value = TOPEX/POSEIDON
    Global attribute 9: Sensor_Name, size = 14 NC_CHAR, value = Altimeters-T/P
    Global attribute 10: Data_Handbook_Reference, size = 20 NC_CHAR, value = JPL D-11007 Vers 2.0
    Global attribute 11: Product_Create_Start_Time, size = 1 NC_DOUBLE, value = -85569938
    Global attribute 12: Product_Create_End_Time, size = 1 NC_DOUBLE, value = -85569938
    Global attribute 13: Generating_Software_Name, size = 5 NC_CHAR, value = MGREP
    Global attribute 14: Build_Id, size = 15 NC_CHAR, value = IOM 3890-96-032
    Global attribute 15: Pass_File_Data_Type, size = 6 NC_CHAR, value = MGDR 
    Global attribute 16: Poseidon_Range_Bias, size = 1 NC_DOUBLE, value = 0
    Global attribute 17: Topex_Range_Bias, size = 1 NC_DOUBLE, value = 1.5
    Global attribute 18: TP_sigma0_offset, size = 1 NC_DOUBLE, value = 0.159999996424
    Global attribute 19: NASA_Orbit_Filename, size = 40 NC_CHAR, value = nasapoe100.dat    1995-194T14:54:16    
    Global attribute 20: Orbit_Qual_NASA, size = 9 NC_CHAR, value = POD_QUAL
    Global attribute 21: CNES_Orbit_Filename, size = 42 NC_CHAR, value = ephte1t11658800c  1995-283T08:27:00      
    Global attribute 22: Orbit_Qual_CNES, size = 1 NC_CHAR, value = C
    Global attribute 23: Topex_Pass_File_Id, size = 38 NC_CHAR, value = c100p009.dat 1995-195T21:40:54       
    Global attribute 24: Poseidon_Pass_File_Id, size = 38 NC_CHAR, value =                                      
    Global attribute 25: CORIOTROP_File_Id, size = 38 NC_CHAR, value = cti0g1tp16588000 1995-155T00:00:00   
    Global attribute 26: Cycle_Number, size = 1 NC_INT64, value = 100
    Global attribute 27: Pass_Number, size = 1 NC_INT64, value = 9
    Global attribute 28: Pass_Data_Count, size = 1 NC_INT64, value = 3027
    Global attribute 29: Rev_Number, size = 1 NC_INT64, value = 13130
    Global attribute 30: Equator_Longitude, size = 1 NC_DOUBLE, value = 346.540008545
    Global attribute 31: Equator_Time, size = 1 NC_DOUBLE, value = -144622206.8
    Global attribute 32: Time_First_Pt, size = 1 NC_DOUBLE, value = -144623893.14
    Global attribute 33: Time_Last_Pt, size = 1 NC_DOUBLE, value = -144620521.54
    Global attribute 34: Time_Epoch, size = 1 NC_DOUBLE, value = -1325376000
    Global attribute 35: source, size = 171 NC_CHAR, value = ftp://podaac-ftp.jpl.nasa.gov/allData/topex/L2/mgdrb/MGB_100/MGB100.009.gz
    ftp://podaac-ftp.jpl.nasa.gov/allData/topex/preview/L2/tmr_replace/TMR_030/TMR_100/TMR_C100_P009

    zender@roulee:~/Téléchargements$

     
  • Charlie Zender
    Charlie Zender
    2012-09-09

    a more remote possibility is that you are already using a recent version of NCO, but it has  not been compiled with ENABLE_NETCDF4. but if this were the case, i would expect a different error message. so upgrade NCO.
    cz

     

  • Anonymous
    2012-09-09

    It's 4.0.8 built on a gentoo system:

    ./configure -prefix=/usr -build=x86_64-pc-linux-gnu -host=x86_64-pc-linux-gnu -mandir=/usr/share/man -infodir=/usr/share/info -datadir=/usr/share -sysconfdir=/etc -localstatedir=/var/lib -libdir=/usr/lib64 -disable-dependency-tracking -disable-udunits -enable-gsl -enable-ncap2 -disable-static -enable-udunits2 -enable-netcdf4 -enable-dap-netcdf -disable-dap-opendap


    DEBUG: enable_dap_netcdf = yes and enable_dap_opendap = no
    Testing for DAP-netCDF support (is DAP in libnetcdf.a?)…
    checking for nc__opendap in -lnetcdf… yes
    configure: DAP support enabled
    checking netcdf.h usability… yes
    checking netcdf.h presence… yes
    checking for netcdf.h… yes
    #################################
    #  Test for netCDF4 support     #
    #################################
    DEBUG: After netCDF4 section LIBS = -lnetcdf  -lcurl
    configure: netcdf.h contains netCDF4 definitions
    DEBUG: After netCDF4 section header_defines_nc_chunked =
    DEBUG: After netCDF3 section LIBS = -lnetcdf  -lcurl


    ###############################
    #    Require Shared Libs?     #
    ###############################
    DEBUG: enable_shared: yes
    DEBUG: enable_ncoxx: yes and NCOXX = nco++
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating data/Makefile
    config.status: creating src/Makefile
    config.status: creating src/nco/Makefile
    config.status: creating man/Makefile
    config.status: creating doc/Makefile
    config.status: creating src/nco_c++/Makefile
    config.status: creating src/nco++/Makefile
    config.status: creating config.h
    config.status: executing depfiles commands
    config.status: executing libtool commands

    Configuration Parameters:
    AR_FLAGS…………. cru
    CC………………. x86_64-pc-linux-gnu-gcc -std=gnu99
    CFLAGS…………… -mtune=generic -O2 -pipe -DHAVE_NETCDF4_H -std=c99 -D_BSD_SOURCE -D_POSIX_SOURCE
    CPP……………… x86_64-pc-linux-gnu-gcc -E
    CPPFLAGS…………. -I/usr/include  -I/usr/include
    CXX……………… x86_64-pc-linux-gnu-g++
    CXXFLAGS…………. -mtune=generic -O2 -pipe -DHAVE_NETCDF4_H
    ENABLE_DAP_NETCDF…. yes
    ENABLE_DAP_OPENDAP… no
    ENABLE_DAP……….. yes
    ENABLE_GSL……….. yes
    ENABLE_MPI………..
    ENABLE_NETCDF4……. yes
    ENABLE_UDUNITS……. no
    ENABLE_UDUNITS2…… yes
    GSL_ROOT…………. /usr
    HAVE_NETCDF4_H…….
    HOST……………..
    host…………….. x86_64-pc-linux-gnu
    HOSTNAME…………. crozon
    LDFLAGS………….. -L/usr/lib -lnetcdf -Wl,-O1 -Wl,-as-needed
    LIBS…………….. -ludunits2 -lgsl -lm -lnetcdf  -lcurl -L/usr/lib64 -lgsl -lgslcblas -lm -ludunits2
    NETCDF4_ROOT………
    *******************************************************************
    Configuration complete. You are now ready to run 'make'.
    Ensure 'make' points to GNU Make (AT&T Make chokes on GNU syntax).
    If the build fails, please examine the file 'configure.eg'
    in the top-level NCO directory.  It contains examples known to
    build NCO for various platforms and compilers.
    *******************************************************************


    (and compiles without errors)

     
  • Charlie Zender
    Charlie Zender
    2012-09-09

    i'm a little surprised such a recent release does not work.
    the next step is to upgrade to 4.2.1 or to the daily snapshot and see if the problem persists.
    if it does, then i'll really scratch my head, because it works for me.
    cz

     

  • Anonymous
    2012-09-10

    Works with 4.2.1. I'll file a request with the gentoo team to update the ebuilds to 4.2.1. Thanks for the help!