Skip to content

Bad NetCDF4 compatibility check #2026

Open

Description

@ashtonvcole

When using the conda package for this library, I ran into an unusual issue of PIO rejecting NetCDF4 while claiming it was supported.

has_netcdf4p = PIO_iotype_available(pio_iotype_netcdf4p) ! Evaluates to .TRUE.
piostat = pio_createfile(piosystem, piofile, &
            pio_iotype_netcdf, 'untitled.nc', pio_clobber) ! Works
piostat = pio_createfile(piosystem, piofile, &
            pio_iotype_netcdf4p, 'untitled.nc', pio_clobber) ! Aborts with vague PIO_EINVAL

I pinpointed the issue here, at function iotype_is_valid, lines 3130-3133. Because NetCDF has progressed to version 4.10.0, the patch number alone is no longer a reliable marker.

    /* Some builds include netCDF-4. */
    /* as of netcdf 4.9.3 NC_HAS_NC4 is no longer defined */
#if NC_HAS_NC4 || (NC_VERSION_PATCH > 2)
    if (iotype == PIO_IOTYPE_NETCDF4C || iotype == PIO_IOTYPE_NETCDF4P)
        ret++;
#endif /* _NETCDF4 */

A quick fix is just to use older versions of NetCDF.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions