module nf_tmp

contains

function nf_strerror(error)
  character(80) :: nf_strerror
  integer :: error

  select case(error)
    case (0)
      !NC_NOERR
      nf_strerror =  "No error"
    case (-33)
      !NC_EBADID
      nf_strerror =  "Not a netCDF id"
    case (-34)
      !NC_ENFILE
      nf_strerror =  "Too many netCDF files open"
    case (-35)
      !NC_EEXIST
      nf_strerror =  "netCDF file exists && NC_NOCLOBBER"
    case (-36)
      !NC_EINVAL
      nf_strerror =  "Invalid argument"
    case (-37)
      !NC_EPERM
      nf_strerror =  "Write to read only"
    case (-38)
      !NC_ENOTINDEFINE
      nf_strerror =  "Operation not allowed in data mode"
    case (-39)
      !NC_EINDEFINE
      nf_strerror =  "Operation not allowed in define mode"
    case (-40)
      !NC_EINVALCOORDS
      nf_strerror =  "Index exceeds dimension bound"
    case (-41)
      !NC_EMAXDIMS
      nf_strerror =  "NC_MAX_DIMS exceeded"
    case (-42)
      !NC_ENAMEINUSE
      nf_strerror =  "String match to name in use"
    case (-43)
      !NC_ENOTATT
      nf_strerror =  "Attribute not found"
    case (-44)
      !NC_EMAXATTS
      nf_strerror =  "NC_MAX_ATTRS exceeded"
    case (-45)
      !NC_EBADTYPE
      nf_strerror =  "Not a netCDF data type or _FillValue type mismatch"
    case (-46)
      !NC_EBADDIM
      nf_strerror =  "Invalid dimension id or name"
    case (-47)
      !NC_EUNLIMPOS
      nf_strerror =  "NC_UNLIMITED in the wrong index"
    case (-48)
      !NC_EMAXVARS
      nf_strerror =  "NC_MAX_VARS exceeded"
    case (-49)
      !NC_ENOTVAR
      nf_strerror =  "Variable not found"
    case (-50)
      !NC_EGLOBAL
      nf_strerror =  "Action prohibited on NC_GLOBAL varid"
    case (-51)
      !NC_ENOTNC
      nf_strerror =  "Not a netCDF file"
    case (-52)
      !NC_ESTS
      nf_strerror =  "In Fortran, string too short"
    case (-53)
      !NC_EMAXNAME
      nf_strerror =  "NC_MAX_NAME exceeded"
    case (-54)
      !NC_EUNLIMIT
      nf_strerror =  "NC_UNLIMITED size already in use"
    case (-55)
      !NC_ENORECVARS
      nf_strerror =  "nc_rec op when there are no record vars"
    case (-56)
      !NC_ECHAR
      nf_strerror =  "Attempt to convert between text & numbers"
    case (-57)
      !NC_EEDGE
      nf_strerror =  "Edge+start exceeds dimension bound"
    case (-58)
      !NC_ESTRIDE
      nf_strerror =  "Illegal stride"
    case (-59)
      !NC_EBADNAME
      nf_strerror =  "Attribute or variable name contains illegal characters"
    case (-60)
      !NC_ERANGE
      nf_strerror =  "Numeric conversion not representable"
    case (-61)
      !NC_ENOMEM
      nf_strerror =  "Memory allocation (malloc) failure"
    case default
      nf_strerror =  "unknown error"
  end select

end function nf_strerror

end module nf_tmp


