netCDF4: full support?

  • Bernhard Seiwald

    Great work is and has been done for GDL! A question arises for me: are there plans to fully support netCDF4? Maybe in the near future?

  • Sylwester Arabas

    The answer is yes (i.e. a patch to support it would be very welcome).
    The plotting issues and documentation have higher priority now, in my opinion, though.
    Does current IDL release support netCDF4-specific API calls?


  • Bernhard Seiwald

    Great! I run IDL8.1 now for three days - writing routines for reading our netCDF4 files. It seems that IDL8.1 mostly supports netCDF4 features like additional types of variables and so on. Regarding the support of user defined compound data I am not sure. I failed to read such data strutures. Also a routine for defining a compound data type I could not find until now. netCDF4 is quite nice, combining netCDF and HDF.
    At least for me it would be great to have GDL als well! I will check some IDL routines from the experimental lab if they are running under GDL or not.


  • Sylwester Arabas

    Thanks. It would certainly help if you could provide us with a list of examples showing what works and what does not work with netcdf4 in GDL.


  • Bernhard Seiwald

    Hi Sylwester,
    thanks for your effort!
    For creating a netCDF-4file I used the examples provided by unidata:
    and here looking at the section: NetCDF-4 Examples   - simple_nc4
    where we may find  * simple_nc4_wr.c  and   * simple_nc4_rd.c   for writing and reading the file

    Here is now what I get in GDL:
    seiwald@linuxpc02:~/H1/GDL-IDL$ gdl

      GDL - GNU Data Language, Version 0.9.1

    - For basic information type HELP,/INFO
    - Default library routine search path used (GDL_PATH/IDL_PATH env. var. not set):
    - No startup file read (GDL_STARTUP/IDL_STARTUP env. var. not set).
    - Please report bugs, feature or help requests and patches at:

    GDL> file_name = ''      ;Default input file name
    GDL> id = NCDF_OPEN(file_name)        ;Open netCDF input file
    GDL> grpids = NCDF_GROUPSINQ(id)
    % Function not found: NCDF_GROUPSINQ
    % Execution halted at: $MAIN$         

    OK, it's clear because we need netCDF-4 support.

    In IDL8.1 I can go further on with reading the netCDF-4 file. The following lines work fine in IDL8.1:
    file_name = ''      ;Default input file name

    id = NCDF_OPEN(file_name)        ;Open netCDF input file

    grpids = NCDF_GROUPSINQ(id)
    grp1id = grpids
    grp2id = grpids
    grp1name = NCDF_GROUPNAME(grp1id)
    grp2name = NCDF_GROUPNAME(grp2id)

    DimIds = NCDF_DIMIDSINQ(id)
    NCDF_DIMINQ, id, DimIds, x, dimSizex
    NCDF_DIMINQ, id, DimIds, y, dimSizey

    varid1 = NCDF_VARID(grp1id, 'data')
    INQ_VID1 = NCDF_VARINQ(grp1id,varid1)
    help, inq_vid1
    print, inq_vid1
    NCDF_VARGET, grp1id, varid1, data1           ;Read variable 'data'
    help, data1
    print, data1

    Troubles start in IDL8.1 when I try to process the compound data in the group grp2 using lines like this:
    varid2 = NCDF_VARID(grp2id, 'data')
    INQ_VID2 = NCDF_VARINQ(grp2id,varid2)
    help, inq_vid2
    print, inq_vid2
    NCDF_VARGET, grp2id, varid2, data2           ;Read variable 'data'
    help, data2
    print, data2

    In my case, the netCDF-4 file looks in principle similar to that from the example mentioned above.

    I will try to check reading of classical netCDF files with GDL using the examples (data files and IDL examples) provided by unidata.

    Thank you very much!

    Best, Bernhard

  • Bernhard Seiwald


    I did some checks of netCDF (pre netCDF-4) functionality in GDL using the IDL code examples provided by unidata
    These examples work well.

    As expected, just creating a netCDF-4 file fails in GDL:
    % NCDF_CREATE: Keyword parameter NETCDF4_FORMAT not allowed in call to: NCDF_CREATE
    % Execution halted at: $MAIN$         



Log in to post a comment.