/* File: diag2pythonmodule.c
 * This file is auto-generated with f2py (version:1.26.2).
 * f2py is a Fortran to Python Interface Generator (FPIG), Second Edition,
 * written by Pearu Peterson <pearu@cens.ioc.ee>.
 * Generation date: Wed Oct 22 19:09:14 2025
 * Do not edit this file directly unless you know what you are doing!!!
 */

#ifdef __cplusplus
extern "C" {
#endif

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */

/* Unconditionally included */
#include <Python.h>
#include <numpy/npy_os.h>

/*********************** See f2py2e/cfuncs.py: includes ***********************/
#include "fortranobject.h"
#include <string.h>
#include <math.h>

/**************** See f2py2e/rules.py: mod_rules['modulebody'] ****************/
static PyObject *diag2python_error;
static PyObject *diag2python_module;

/*********************** See f2py2e/cfuncs.py: typedefs ***********************/
typedef char * string;
typedef char character;

/****************** See f2py2e/cfuncs.py: typedefs_generated ******************/
/*need_typedefs_generated*/

/********************** See f2py2e/cfuncs.py: cppmacros **********************/
\
#define FAILNULL(p) do {                                            \
    if ((p) == NULL) {                                              \
        PyErr_SetString(PyExc_MemoryError, "NULL pointer found");   \
        goto capi_fail;                                             \
    }                                                               \
} while (0)

#define STRINGMALLOC(str,len)\
    if ((str = (string)malloc(len+1)) == NULL) {\
        PyErr_SetString(PyExc_MemoryError, "out of memory");\
        goto capi_fail;\
    } else {\
        (str)[len] = '\0';\
    }

/* See fortranobject.h for definitions. The macros here are provided for BC. */
#define rank f2py_rank
#define shape f2py_shape
#define fshape f2py_shape
#define len f2py_len
#define flen f2py_flen
#define slen f2py_slen
#define size f2py_size

#define STRINGFREE(str) do {if (!(str == NULL)) free(str);} while (0)

/*
STRINGPADN replaces null values with padding values from the right.

`to` must have size of at least N bytes.

If the `to[N-1]` has null value, then replace it and all the
preceding, nulls with the given padding.

STRINGPADN(to, N, PADDING, NULLVALUE) is an inverse operation.
*/
#define STRINGPADN(to, N, NULLVALUE, PADDING)                   \
    do {                                                        \
        int _m = (N);                                           \
        char *_to = (to);                                       \
        for (_m -= 1; _m >= 0 && _to[_m] == NULLVALUE; _m--) {  \
             _to[_m] = PADDING;                                 \
        }                                                       \
    } while (0)

#ifdef DEBUGCFUNCS
#define CFUNCSMESS(mess) fprintf(stderr,"debug-capi:"mess);
#define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \
    PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\
    fprintf(stderr,"\n");
#else
#define CFUNCSMESS(mess)
#define CFUNCSMESSPY(mess,obj)
#endif

#ifndef max
#define max(a,b) ((a > b) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) ((a < b) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b) ((a > b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b) ((a < b) ? (a) : (b))
#endif

#define CHECKSCALAR(check,tcheck,name,show,var)\
    if (!(check)) {\
        char errstring[256];\
        sprintf(errstring, "%s: "show, "("tcheck") failed for "name, var);\
        PyErr_SetString(diag2python_error,errstring);\
        /*goto capi_fail;*/\
    } else 
#if defined(PREPEND_FORTRAN)
#if defined(NO_APPEND_FORTRAN)
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) _##F
#else
#define F_FUNC(f,F) _##f
#endif
#else
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) _##F##_
#else
#define F_FUNC(f,F) _##f##_
#endif
#endif
#else
#if defined(NO_APPEND_FORTRAN)
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F
#else
#define F_FUNC(f,F) f
#endif
#else
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F##_
#else
#define F_FUNC(f,F) f##_
#endif
#endif
#endif
#if defined(UNDERSCORE_G77)
#define F_FUNC_US(f,F) F_FUNC(f##_,F##_)
#else
#define F_FUNC_US(f,F) F_FUNC(f,F)
#endif

/*
STRINGCOPYN copies N bytes.

`to` and `from` buffers must have sizes of at least N bytes.
*/
#define STRINGCOPYN(to,from,N)                                  \
    do {                                                        \
        int _m = (N);                                           \
        char *_to = (to);                                       \
        char *_from = (from);                                   \
        FAILNULL(_to); FAILNULL(_from);                         \
        (void)strncpy(_to, _from, _m);             \
    } while (0)


/************************ See f2py2e/cfuncs.py: cfuncs ************************/
/*
  Create a new string buffer `str` of at most length `len` from a
  Python string-like object `obj`.

  The string buffer has given size (len) or the size of inistr when len==-1.

  The string buffer is padded with blanks: in Fortran, trailing blanks
  are insignificant contrary to C nulls.
 */
static int
string_from_pyobj(string *str, int *len, const string inistr, PyObject *obj,
                  const char *errmess)
{
    PyObject *tmp = NULL;
    string buf = NULL;
    npy_intp n = -1;
#ifdef DEBUGCFUNCS
fprintf(stderr,"string_from_pyobj(str='%s',len=%d,inistr='%s',obj=%p)\n",
               (char*)str, *len, (char *)inistr, obj);
#endif
    if (obj == Py_None) {
        n = strlen(inistr);
        buf = inistr;
    }
    else if (PyArray_Check(obj)) {
        PyArrayObject *arr = (PyArrayObject *)obj;
        if (!ISCONTIGUOUS(arr)) {
            PyErr_SetString(PyExc_ValueError,
                            "array object is non-contiguous.");
            goto capi_fail;
        }
        n = PyArray_NBYTES(arr);
        buf = PyArray_DATA(arr);
        n = strnlen(buf, n);
    }
    else {
        if (PyBytes_Check(obj)) {
            tmp = obj;
            Py_INCREF(tmp);
        }
        else if (PyUnicode_Check(obj)) {
            tmp = PyUnicode_AsASCIIString(obj);
        }
        else {
            PyObject *tmp2;
            tmp2 = PyObject_Str(obj);
            if (tmp2) {
                tmp = PyUnicode_AsASCIIString(tmp2);
                Py_DECREF(tmp2);
            }
            else {
                tmp = NULL;
            }
        }
        if (tmp == NULL) goto capi_fail;
        n = PyBytes_GET_SIZE(tmp);
        buf = PyBytes_AS_STRING(tmp);
    }
    if (*len == -1) {
        /* TODO: change the type of `len` so that we can remove this */
        if (n > NPY_MAX_INT) {
            PyErr_SetString(PyExc_OverflowError,
                            "object too large for a 32-bit int");
            goto capi_fail;
        }
        *len = n;
    }
    else if (*len < n) {
        /* discard the last (len-n) bytes of input buf */
        n = *len;
    }
    if (n < 0 || *len < 0 || buf == NULL) {
        goto capi_fail;
    }
    STRINGMALLOC(*str, *len);  // *str is allocated with size (*len + 1)
    if (n < *len) {
        /*
          Pad fixed-width string with nulls. The caller will replace
          nulls with blanks when the corresponding argument is not
          intent(c).
        */
        memset(*str + n, '\0', *len - n);
    }
    STRINGCOPYN(*str, buf, n);
    Py_XDECREF(tmp);
    return 1;
capi_fail:
    Py_XDECREF(tmp);
    {
        PyObject* err = PyErr_Occurred();
        if (err == NULL) {
            err = diag2python_error;
        }
        PyErr_SetString(err, errmess);
    }
    return 0;
}

static struct { int nd;npy_intp *d;int *i,*i_tr,tr; } forcombcache;
static int initforcomb(npy_intp *dims,int nd,int tr) {
  int k;
  if (dims==NULL) return 0;
  if (nd<0) return 0;
  forcombcache.nd = nd;
  forcombcache.d = dims;
  forcombcache.tr = tr;
  if ((forcombcache.i = (int *)malloc(sizeof(int)*nd))==NULL) return 0;
  if ((forcombcache.i_tr = (int *)malloc(sizeof(int)*nd))==NULL) return 0;
  for (k=1;k<nd;k++) {
    forcombcache.i[k] = forcombcache.i_tr[nd-k-1] = 0;
  }
  forcombcache.i[0] = forcombcache.i_tr[nd-1] = -1;
  return 1;
}
static int *nextforcomb(void) {
  int j,*i,*i_tr,k;
  int nd=forcombcache.nd;
  if ((i=forcombcache.i) == NULL) return NULL;
  if ((i_tr=forcombcache.i_tr) == NULL) return NULL;
  if (forcombcache.d == NULL) return NULL;
  i[0]++;
  if (i[0]==forcombcache.d[0]) {
    j=1;
    while ((j<nd) && (i[j]==forcombcache.d[j]-1)) j++;
    if (j==nd) {
      free(i);
      free(i_tr);
      return NULL;
    }
    for (k=0;k<j;k++) i[k] = i_tr[nd-k-1] = 0;
    i[j]++;
    i_tr[nd-j-1]++;
  } else
    i_tr[nd-1]++;
  if (forcombcache.tr) return i_tr;
  return i;
}
static int
int_from_pyobj(int* v, PyObject *obj, const char *errmess)
{
    PyObject* tmp = NULL;

    if (PyLong_Check(obj)) {
        *v = Npy__PyLong_AsInt(obj);
        return !(*v == -1 && PyErr_Occurred());
    }

    tmp = PyNumber_Long(obj);
    if (tmp) {
        *v = Npy__PyLong_AsInt(tmp);
        Py_DECREF(tmp);
        return !(*v == -1 && PyErr_Occurred());
    }

    if (PyComplex_Check(obj)) {
        PyErr_Clear();
        tmp = PyObject_GetAttrString(obj,"real");
    }
    else if (PyBytes_Check(obj) || PyUnicode_Check(obj)) {
        /*pass*/;
    }
    else if (PySequence_Check(obj)) {
        PyErr_Clear();
        tmp = PySequence_GetItem(obj, 0);
    }

    if (tmp) {
        if (int_from_pyobj(v, tmp, errmess)) {
            Py_DECREF(tmp);
            return 1;
        }
        Py_DECREF(tmp);
    }

    {
        PyObject* err = PyErr_Occurred();
        if (err == NULL) {
            err = diag2python_error;
        }
        PyErr_SetString(err, errmess);
    }
    return 0;
}


/********************* See f2py2e/cfuncs.py: userincludes *********************/
/*need_userincludes*/

/********************* See f2py2e/capi_rules.py: usercode *********************/


/* See f2py2e/rules.py */
/*eof externroutines*/

/******************** See f2py2e/capi_rules.py: usercode1 ********************/


/******************* See f2py2e/cb_rules.py: buildcallback *******************/
/*need_callbacks*/

/*********************** See f2py2e/rules.py: buildapi ***********************/

/************************************ open ************************************/
static char doc_f2py_rout_diag2python_diag2python_open[] = "\
fnumber = open(filename,[filename2,isis])\n\nWrapper for ``open``.\
\n\nParameters\n----------\n"
"filename : input string(len=-1)\n"
"\nOther Parameters\n----------------\n"
"filename2 : input string(len=-1), optional\n    Default: 'None'\n"
"isis : input rank-2 array('c') with bounds (f2py_isis_d0,f2py_isis_d1), optional\n    Default: 'None'\n"
"\nReturns\n-------\n"
"fnumber : int";
/* #declfortranroutine# */
static PyObject *f2py_rout_diag2python_diag2python_open(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           void (*f2py_func)(int*,string,string,character*,int*,int*,size_t,size_t)) {
    PyObject * volatile capi_buildvalue = NULL;
    volatile int f2py_success = 1;
/*decl*/

    int openf2pywrap = 0;
    string filename = NULL;
    int slen(filename);
    PyObject *filename_capi = Py_None;
    string filename2 = NULL;
    int slen(filename2);
    PyObject *filename2_capi = Py_None;
    character *isis = NULL;
    npy_intp isis_Dims[2] = {-1, -1};
    const int isis_Rank = 2;
    PyArrayObject *capi_isis_as_array = NULL;
    int capi_isis_intent = 0;
    PyObject *isis_capi = Py_None;
    int f2py_isis_d0 = 0;
    int f2py_isis_d1 = 0;
    static char *capi_kwlist[] = {"filename","filename2","isis",NULL};

/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
    if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
        "O|OO:diag2python.diag2python.open",\
        capi_kwlist,&filename_capi,&filename2_capi,&isis_capi))
        return NULL;
/*frompyobj*/
    /* Processing variable filename */
    slen(filename) = -1;
    f2py_success = string_from_pyobj(&filename,&slen(filename),"",filename_capi,"string_from_pyobj failed in converting 1st argument`filename' of diag2python.diag2python.open to C string");
    if (f2py_success) {
        STRINGPADN(filename, slen(filename), '\0', ' ');
    /* Processing variable filename2 */
    slen(filename2) = -1;
    f2py_success = string_from_pyobj(&filename2,&slen(filename2),"None",filename2_capi,"string_from_pyobj failed in converting 1st keyword`filename2' of diag2python.diag2python.open to C string");
    if (f2py_success) {
        STRINGPADN(filename2, slen(filename2), '\0', ' ');
    /* Processing variable isis */
    ;
    capi_isis_intent |= F2PY_INTENT_IN|F2PY_OPTIONAL;
    const char * capi_errmess = "diag2python.diag2python.diag2python.open: failed to create array from the 2nd keyword `isis`";
    capi_isis_as_array = ndarray_from_pyobj(  NPY_STRING,1,isis_Dims,isis_Rank,  capi_isis_intent,isis_capi,capi_errmess);
    if (capi_isis_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = diag2python_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        isis = (character *)(PyArray_DATA(capi_isis_as_array));

    if (isis_capi == Py_None) {


        int *_i,capi_i=0;
        CFUNCSMESS("open: Initializing isis='None'\n");
        if (initforcomb(PyArray_DIMS(capi_isis_as_array),
                        PyArray_NDIM(capi_isis_as_array),1)) {
            while ((_i = nextforcomb()))
                isis[capi_i++] = 'None'; /* fortran way */
        } else {
            PyObject *exc, *val, *tb;
            PyErr_Fetch(&exc, &val, &tb);
            PyErr_SetString(exc ? exc : diag2python_error,
                "Initialization of 2nd keyword isis failed (initforcomb).");
            npy_PyErr_ChainExceptionsCause(exc, val, tb);
            f2py_success = 0;
        }
    }
    if (f2py_success) {
    /* Processing variable openf2pywrap */
    /* Processing variable f2py_isis_d0 */
    f2py_isis_d0 = shape(isis, 0);
    /* Processing variable f2py_isis_d1 */
    f2py_isis_d1 = shape(isis, 1);
/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
    (*f2py_func)(&openf2pywrap,filename,filename2,isis,&f2py_isis_d0,&f2py_isis_d1,slen(filename),slen(filename2));
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
        if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
        CFUNCSMESS("Building return value.\n");
        capi_buildvalue = Py_BuildValue("i",openf2pywrap);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
        } /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
    /* End of cleaning variable f2py_isis_d1 */
    /* End of cleaning variable f2py_isis_d0 */
    /* End of cleaning variable openf2pywrap */
    }  /*if (f2py_success) of isis init*/
    if((PyObject *)capi_isis_as_array!=isis_capi) {
        Py_XDECREF(capi_isis_as_array); }
    }  /* if (capi_isis_as_array == NULL) ... else of isis */
    /* End of cleaning variable isis */
        STRINGFREE(filename2);
    }  /*if (f2py_success) of filename2*/
    /* End of cleaning variable filename2 */
        STRINGFREE(filename);
    }  /*if (f2py_success) of filename*/
    /* End of cleaning variable filename */
/*end of cleanupfrompyobj*/
    if (capi_buildvalue == NULL) {
/*routdebugfailure*/
    } else {
/*routdebugleave*/
    }
    CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
    return capi_buildvalue;
}
/******************************** end of open ********************************/

/*********************************** close ***********************************/
static char doc_f2py_rout_diag2python_diag2python_close[] = "\
iret = close(fnumber)\n\nWrapper for ``close``.\
\n\nParameters\n----------\n"
"fnumber : input int\n"
"\nReturns\n-------\n"
"iret : int";
/* #declfortranroutine# */
static PyObject *f2py_rout_diag2python_diag2python_close(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           void (*f2py_func)(int*,int*)) {
    PyObject * volatile capi_buildvalue = NULL;
    volatile int f2py_success = 1;
/*decl*/

    int closef2pywrap = 0;
    int fnumber = 0;
    PyObject *fnumber_capi = Py_None;
    static char *capi_kwlist[] = {"fnumber",NULL};

/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
    if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
        "O|:diag2python.diag2python.close",\
        capi_kwlist,&fnumber_capi))
        return NULL;
/*frompyobj*/
    /* Processing variable fnumber */
        f2py_success = int_from_pyobj(&fnumber,fnumber_capi,"diag2python.diag2python.close() 1st argument (fnumber) can't be converted to int");
    if (f2py_success) {
    /* Processing variable closef2pywrap */
/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
    (*f2py_func)(&closef2pywrap,&fnumber);
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
        if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
        CFUNCSMESS("Building return value.\n");
        capi_buildvalue = Py_BuildValue("i",closef2pywrap);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
        } /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
    /* End of cleaning variable closef2pywrap */
    } /*if (f2py_success) of fnumber*/
    /* End of cleaning variable fnumber */
/*end of cleanupfrompyobj*/
    if (capi_buildvalue == NULL) {
/*routdebugfailure*/
    } else {
/*routdebugleave*/
    }
    CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
    return capi_buildvalue;
}
/******************************** end of close ********************************/

/********************************* getvarinfo *********************************/
static char doc_f2py_rout_diag2python_diag2python_getvarinfo[] = "\
nkx = getvarinfo(fnumber,varname)\n\nWrapper for ``getvarinfo``.\
\n\nParameters\n----------\n"
"fnumber : input int\n"
"varname : input string(len=-1)\n"
"\nReturns\n-------\n"
"nkx : int";
/*  */
static PyObject *f2py_rout_diag2python_diag2python_getvarinfo(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           void (*f2py_func)(int*,string,int*,size_t)) {
    PyObject * volatile capi_buildvalue = NULL;
    volatile int f2py_success = 1;
/*decl*/

    int fnumber = 0;
    PyObject *fnumber_capi = Py_None;
    string varname = NULL;
    int slen(varname);
    PyObject *varname_capi = Py_None;
    int nkx = 0;
    static char *capi_kwlist[] = {"fnumber","varname",NULL};

/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
    if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
        "OO|:diag2python.diag2python.getvarinfo",\
        capi_kwlist,&fnumber_capi,&varname_capi))
        return NULL;
/*frompyobj*/
    /* Processing variable fnumber */
        f2py_success = int_from_pyobj(&fnumber,fnumber_capi,"diag2python.diag2python.getvarinfo() 1st argument (fnumber) can't be converted to int");
    if (f2py_success) {
    /* Processing variable varname */
    slen(varname) = -1;
    f2py_success = string_from_pyobj(&varname,&slen(varname),"",varname_capi,"string_from_pyobj failed in converting 2nd argument`varname' of diag2python.diag2python.getvarinfo to C string");
    if (f2py_success) {
        STRINGPADN(varname, slen(varname), '\0', ' ');
    /* Processing variable nkx */
/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
                (*f2py_func)(&fnumber,varname,&nkx,slen(varname));
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
        if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
        CFUNCSMESS("Building return value.\n");
        capi_buildvalue = Py_BuildValue("i",nkx);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
        } /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
    /* End of cleaning variable nkx */
        STRINGFREE(varname);
    }  /*if (f2py_success) of varname*/
    /* End of cleaning variable varname */
    } /*if (f2py_success) of fnumber*/
    /* End of cleaning variable fnumber */
/*end of cleanupfrompyobj*/
    if (capi_buildvalue == NULL) {
/*routdebugfailure*/
    } else {
/*routdebugleave*/
    }
    CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
    return capi_buildvalue;
}
/***************************** end of getvarinfo *****************************/

/********************************** getnvars **********************************/
static char doc_f2py_rout_diag2python_diag2python_getnvars[] = "\
nvars = getnvars(fnumber)\n\nWrapper for ``getnvars``.\
\n\nParameters\n----------\n"
"fnumber : input int\n"
"\nReturns\n-------\n"
"nvars : int";
/* #declfortranroutine# */
static PyObject *f2py_rout_diag2python_diag2python_getnvars(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           void (*f2py_func)(int*,int*)) {
    PyObject * volatile capi_buildvalue = NULL;
    volatile int f2py_success = 1;
/*decl*/

    int getnvarsf2pywrap = 0;
    int fnumber = 0;
    PyObject *fnumber_capi = Py_None;
    static char *capi_kwlist[] = {"fnumber",NULL};

/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
    if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
        "O|:diag2python.diag2python.getnvars",\
        capi_kwlist,&fnumber_capi))
        return NULL;
/*frompyobj*/
    /* Processing variable fnumber */
        f2py_success = int_from_pyobj(&fnumber,fnumber_capi,"diag2python.diag2python.getnvars() 1st argument (fnumber) can't be converted to int");
    if (f2py_success) {
    /* Processing variable getnvarsf2pywrap */
/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
    (*f2py_func)(&getnvarsf2pywrap,&fnumber);
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
        if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
        CFUNCSMESS("Building return value.\n");
        capi_buildvalue = Py_BuildValue("i",getnvarsf2pywrap);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
        } /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
    /* End of cleaning variable getnvarsf2pywrap */
    } /*if (f2py_success) of fnumber*/
    /* End of cleaning variable fnumber */
/*end of cleanupfrompyobj*/
    if (capi_buildvalue == NULL) {
/*routdebugfailure*/
    } else {
/*routdebugleave*/
    }
    CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
    return capi_buildvalue;
}
/****************************** end of getnvars ******************************/

/******************************* getObsVarInfo *******************************/
static char doc_f2py_rout_diag2python_diag2python_getObsVarInfo[] = "\
vName,nTypes = getObsVarInfo(FNumber,nVars)\n\nWrapper for ``getObsVarInfo``.\
\n\nParameters\n----------\n"
"FNumber : input int\n"
"nVars : input int\n"
"\nReturns\n-------\n"
"vName : rank-1 array('S') with bounds (nVars)\n"
"nTypes : rank-1 array('i') with bounds (nVars)";
/*  */
static PyObject *f2py_rout_diag2python_diag2python_getObsVarInfo(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           void (*f2py_func)(int*,int*,string*,int*,size_t)) {
    PyObject * volatile capi_buildvalue = NULL;
    volatile int f2py_success = 1;
/*decl*/

    int FNumber = 0;
    PyObject *FNumber_capi = Py_None;
    int nVars = 0;
    PyObject *nVars_capi = Py_None;
    string *vName = NULL;
    npy_intp vName_Dims[1] = {-1};
    const int vName_Rank = 1;
    PyArrayObject *capi_vName_as_array = NULL;
    int capi_vName_intent = 0;
    int slen(vName) = 0;
    int *nTypes = NULL;
    npy_intp nTypes_Dims[1] = {-1};
    const int nTypes_Rank = 1;
    PyArrayObject *capi_nTypes_as_array = NULL;
    int capi_nTypes_intent = 0;
    static char *capi_kwlist[] = {"FNumber","nVars",NULL};

/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
    if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
        "OO|:diag2python.diag2python.getObsVarInfo",\
        capi_kwlist,&FNumber_capi,&nVars_capi))
        return NULL;
/*frompyobj*/
    /* Processing variable FNumber */
        f2py_success = int_from_pyobj(&FNumber,FNumber_capi,"diag2python.diag2python.getObsVarInfo() 1st argument (FNumber) can't be converted to int");
    if (f2py_success) {
    /* Processing variable nVars */
        f2py_success = int_from_pyobj(&nVars,nVars_capi,"diag2python.diag2python.getObsVarInfo() 2nd argument (nVars) can't be converted to int");
    if (f2py_success) {
    /* Processing variable vName */
    vName_Dims[0]=nVars;
    capi_vName_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "diag2python.diag2python.diag2python.getObsVarInfo: failed to create array from the hidden `vName`";
    capi_vName_as_array = ndarray_from_pyobj(  NPY_STRING,15,vName_Dims,vName_Rank,  capi_vName_intent,Py_None,capi_errmess);
    if (capi_vName_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = diag2python_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        vName = (string *)(PyArray_DATA(capi_vName_as_array));

    slen(vName) = f2py_itemsize(vName);
    /* Processing variable nTypes */
    nTypes_Dims[0]=nVars;
    capi_nTypes_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "diag2python.diag2python.diag2python.getObsVarInfo: failed to create array from the hidden `nTypes`";
    capi_nTypes_as_array = ndarray_from_pyobj(  NPY_INT,1,nTypes_Dims,nTypes_Rank,  capi_nTypes_intent,Py_None,capi_errmess);
    if (capi_nTypes_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = diag2python_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        nTypes = (int *)(PyArray_DATA(capi_nTypes_as_array));

/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
                (*f2py_func)(&FNumber,&nVars,vName,nTypes,slen(vName));
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
        if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
        CFUNCSMESS("Building return value.\n");
        capi_buildvalue = Py_BuildValue("NN",capi_vName_as_array,capi_nTypes_as_array);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
        } /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
    }  /* if (capi_nTypes_as_array == NULL) ... else of nTypes */
    /* End of cleaning variable nTypes */
    }  /* if (capi_vName_as_array == NULL) ... else of vName */
    /* End of cleaning variable vName */
    } /*if (f2py_success) of nVars*/
    /* End of cleaning variable nVars */
    } /*if (f2py_success) of FNumber*/
    /* End of cleaning variable FNumber */
/*end of cleanupfrompyobj*/
    if (capi_buildvalue == NULL) {
/*routdebugfailure*/
    } else {
/*routdebugleave*/
    }
    CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
    return capi_buildvalue;
}
/**************************** end of getObsVarInfo ****************************/

/******************************** getVarTypes ********************************/
static char doc_f2py_rout_diag2python_diag2python_getVarTypes[] = "\
vTypes,svTypes = getVarTypes(FNumber,vName,nTypes)\n\nWrapper for ``getVarTypes``.\
\n\nParameters\n----------\n"
"FNumber : input int\n"
"vName : input string(len=15)\n"
"nTypes : input int\n"
"\nReturns\n-------\n"
"vTypes : rank-1 array('i') with bounds (nTypes)\n"
"svTypes : rank-1 array('S') with bounds (nTypes)";
/*  */
static PyObject *f2py_rout_diag2python_diag2python_getVarTypes(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           void (*f2py_func)(int*,string,int*,int*,string*,size_t,size_t)) {
    PyObject * volatile capi_buildvalue = NULL;
    volatile int f2py_success = 1;
/*decl*/

    int FNumber = 0;
    PyObject *FNumber_capi = Py_None;
    string vName = NULL;
    int slen(vName);
    PyObject *vName_capi = Py_None;
    int nTypes = 0;
    PyObject *nTypes_capi = Py_None;
    int *vTypes = NULL;
    npy_intp vTypes_Dims[1] = {-1};
    const int vTypes_Rank = 1;
    PyArrayObject *capi_vTypes_as_array = NULL;
    int capi_vTypes_intent = 0;
    string *svTypes = NULL;
    npy_intp svTypes_Dims[1] = {-1};
    const int svTypes_Rank = 1;
    PyArrayObject *capi_svTypes_as_array = NULL;
    int capi_svTypes_intent = 0;
    int slen(svTypes) = 0;
    static char *capi_kwlist[] = {"FNumber","vName","nTypes",NULL};

/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
    if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
        "OOO|:diag2python.diag2python.getVarTypes",\
        capi_kwlist,&FNumber_capi,&vName_capi,&nTypes_capi))
        return NULL;
/*frompyobj*/
    /* Processing variable FNumber */
        f2py_success = int_from_pyobj(&FNumber,FNumber_capi,"diag2python.diag2python.getVarTypes() 1st argument (FNumber) can't be converted to int");
    if (f2py_success) {
    /* Processing variable vName */
    slen(vName) = 15;
    f2py_success = string_from_pyobj(&vName,&slen(vName),"",vName_capi,"string_from_pyobj failed in converting 2nd argument`vName' of diag2python.diag2python.getVarTypes to C string");
    if (f2py_success) {
        STRINGPADN(vName, slen(vName), '\0', ' ');
    /* Processing variable nTypes */
        f2py_success = int_from_pyobj(&nTypes,nTypes_capi,"diag2python.diag2python.getVarTypes() 3rd argument (nTypes) can't be converted to int");
    if (f2py_success) {
    /* Processing variable vTypes */
    vTypes_Dims[0]=nTypes;
    capi_vTypes_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "diag2python.diag2python.diag2python.getVarTypes: failed to create array from the hidden `vTypes`";
    capi_vTypes_as_array = ndarray_from_pyobj(  NPY_INT,1,vTypes_Dims,vTypes_Rank,  capi_vTypes_intent,Py_None,capi_errmess);
    if (capi_vTypes_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = diag2python_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        vTypes = (int *)(PyArray_DATA(capi_vTypes_as_array));

    /* Processing variable svTypes */
    svTypes_Dims[0]=nTypes;
    capi_svTypes_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "diag2python.diag2python.diag2python.getVarTypes: failed to create array from the hidden `svTypes`";
    capi_svTypes_as_array = ndarray_from_pyobj(  NPY_STRING,15,svTypes_Dims,svTypes_Rank,  capi_svTypes_intent,Py_None,capi_errmess);
    if (capi_svTypes_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = diag2python_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        svTypes = (string *)(PyArray_DATA(capi_svTypes_as_array));

    slen(svTypes) = f2py_itemsize(svTypes);
/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
                (*f2py_func)(&FNumber,vName,&nTypes,vTypes,svTypes,slen(vName),slen(svTypes));
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
        if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
        CFUNCSMESS("Building return value.\n");
        capi_buildvalue = Py_BuildValue("NN",capi_vTypes_as_array,capi_svTypes_as_array);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
        } /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
    }  /* if (capi_svTypes_as_array == NULL) ... else of svTypes */
    /* End of cleaning variable svTypes */
    }  /* if (capi_vTypes_as_array == NULL) ... else of vTypes */
    /* End of cleaning variable vTypes */
    } /*if (f2py_success) of nTypes*/
    /* End of cleaning variable nTypes */
        STRINGFREE(vName);
    }  /*if (f2py_success) of vName*/
    /* End of cleaning variable vName */
    } /*if (f2py_success) of FNumber*/
    /* End of cleaning variable FNumber */
/*end of cleanupfrompyobj*/
    if (capi_buildvalue == NULL) {
/*routdebugfailure*/
    } else {
/*routdebugleave*/
    }
    CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
    return capi_buildvalue;
}
/***************************** end of getVarTypes *****************************/

/*********************************** getobs ***********************************/
static char doc_f2py_rout_diag2python_diag2python_getobs[] = "\
nobs = getobs(fnumber,oname,otype,osatid,zlevs,[n])\n\nWrapper for ``getobs``.\
\n\nParameters\n----------\n"
"fnumber : input int\n"
"oname : input string(len=-1)\n"
"otype : input int\n"
"osatid : input string(len=-1)\n"
"zlevs : input rank-1 array('f') with bounds (n)\n"
"\nOther Parameters\n----------------\n"
"n : input int, optional\n    Default: len(zlevs)\n"
"\nReturns\n-------\n"
"nobs : int";
/*  */
static PyObject *f2py_rout_diag2python_diag2python_getobs(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           void (*f2py_func)(int*,string,int*,string,float*,int*,int*,size_t,size_t)) {
    PyObject * volatile capi_buildvalue = NULL;
    volatile int f2py_success = 1;
/*decl*/

    int fnumber = 0;
    PyObject *fnumber_capi = Py_None;
    string oname = NULL;
    int slen(oname);
    PyObject *oname_capi = Py_None;
    int otype = 0;
    PyObject *otype_capi = Py_None;
    string osatid = NULL;
    int slen(osatid);
    PyObject *osatid_capi = Py_None;
    float *zlevs = NULL;
    npy_intp zlevs_Dims[1] = {-1};
    const int zlevs_Rank = 1;
    PyArrayObject *capi_zlevs_as_array = NULL;
    int capi_zlevs_intent = 0;
    PyObject *zlevs_capi = Py_None;
    int n = 0;
    PyObject *n_capi = Py_None;
    int nobs = 0;
    static char *capi_kwlist[] = {"fnumber","oname","otype","osatid","zlevs","n",NULL};

/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
    if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
        "OOOOO|O:diag2python.diag2python.getobs",\
        capi_kwlist,&fnumber_capi,&oname_capi,&otype_capi,&osatid_capi,&zlevs_capi,&n_capi))
        return NULL;
/*frompyobj*/
    /* Processing variable fnumber */
        f2py_success = int_from_pyobj(&fnumber,fnumber_capi,"diag2python.diag2python.getobs() 1st argument (fnumber) can't be converted to int");
    if (f2py_success) {
    /* Processing variable oname */
    slen(oname) = -1;
    f2py_success = string_from_pyobj(&oname,&slen(oname),"",oname_capi,"string_from_pyobj failed in converting 2nd argument`oname' of diag2python.diag2python.getobs to C string");
    if (f2py_success) {
        STRINGPADN(oname, slen(oname), '\0', ' ');
    /* Processing variable otype */
        f2py_success = int_from_pyobj(&otype,otype_capi,"diag2python.diag2python.getobs() 3rd argument (otype) can't be converted to int");
    if (f2py_success) {
    /* Processing variable osatid */
    slen(osatid) = -1;
    f2py_success = string_from_pyobj(&osatid,&slen(osatid),"",osatid_capi,"string_from_pyobj failed in converting 4th argument`osatid' of diag2python.diag2python.getobs to C string");
    if (f2py_success) {
        STRINGPADN(osatid, slen(osatid), '\0', ' ');
    /* Processing variable zlevs */
    ;
    capi_zlevs_intent |= F2PY_INTENT_IN;
    const char * capi_errmess = "diag2python.diag2python.diag2python.getobs: failed to create array from the 5th argument `zlevs`";
    capi_zlevs_as_array = ndarray_from_pyobj(  NPY_FLOAT,1,zlevs_Dims,zlevs_Rank,  capi_zlevs_intent,zlevs_capi,capi_errmess);
    if (capi_zlevs_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = diag2python_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        zlevs = (float *)(PyArray_DATA(capi_zlevs_as_array));

    /* Processing variable nobs */
    /* Processing variable n */
    if (n_capi == Py_None) n = len(zlevs); else
        f2py_success = int_from_pyobj(&n,n_capi,"diag2python.diag2python.getobs() 1st keyword (n) can't be converted to int");
    if (f2py_success) {
    CHECKSCALAR(len(zlevs)>=n,"len(zlevs)>=n","1st keyword n","getobs:n=%d",n) {
/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
                (*f2py_func)(&fnumber,oname,&otype,osatid,zlevs,&n,&nobs,slen(oname),slen(osatid));
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
        if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
        CFUNCSMESS("Building return value.\n");
        capi_buildvalue = Py_BuildValue("i",nobs);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
        } /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
    } /*CHECKSCALAR(len(zlevs)>=n)*/
    } /*if (f2py_success) of n*/
    /* End of cleaning variable n */
    /* End of cleaning variable nobs */
    if((PyObject *)capi_zlevs_as_array!=zlevs_capi) {
        Py_XDECREF(capi_zlevs_as_array); }
    }  /* if (capi_zlevs_as_array == NULL) ... else of zlevs */
    /* End of cleaning variable zlevs */
        STRINGFREE(osatid);
    }  /*if (f2py_success) of osatid*/
    /* End of cleaning variable osatid */
    } /*if (f2py_success) of otype*/
    /* End of cleaning variable otype */
        STRINGFREE(oname);
    }  /*if (f2py_success) of oname*/
    /* End of cleaning variable oname */
    } /*if (f2py_success) of fnumber*/
    /* End of cleaning variable fnumber */
/*end of cleanupfrompyobj*/
    if (capi_buildvalue == NULL) {
/*routdebugfailure*/
    } else {
/*routdebugleave*/
    }
    CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
    return capi_buildvalue;
}
/******************************* end of getobs *******************************/

/******************************** getFileType ********************************/
static char doc_f2py_rout_diag2python_diag2python_getFileType[] = "\
fileType = getFileType(FNumber)\n\nWrapper for ``getFileType``.\
\n\nParameters\n----------\n"
"FNumber : input int\n"
"\nReturns\n-------\n"
"fileType : int";
/* #declfortranroutine# */
static PyObject *f2py_rout_diag2python_diag2python_getFileType(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           void (*f2py_func)(int*,int*)) {
    PyObject * volatile capi_buildvalue = NULL;
    volatile int f2py_success = 1;
/*decl*/

    int getFileTypef2pywrap = 0;
    int FNumber = 0;
    PyObject *FNumber_capi = Py_None;
    static char *capi_kwlist[] = {"FNumber",NULL};

/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
    if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
        "O|:diag2python.diag2python.getFileType",\
        capi_kwlist,&FNumber_capi))
        return NULL;
/*frompyobj*/
    /* Processing variable FNumber */
        f2py_success = int_from_pyobj(&FNumber,FNumber_capi,"diag2python.diag2python.getFileType() 1st argument (FNumber) can't be converted to int");
    if (f2py_success) {
    /* Processing variable getFileTypef2pywrap */
/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
    (*f2py_func)(&getFileTypef2pywrap,&FNumber);
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
        if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
        CFUNCSMESS("Building return value.\n");
        capi_buildvalue = Py_BuildValue("i",getFileTypef2pywrap);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
        } /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
    /* End of cleaning variable getFileTypef2pywrap */
    } /*if (f2py_success) of FNumber*/
    /* End of cleaning variable FNumber */
/*end of cleanupfrompyobj*/
    if (capi_buildvalue == NULL) {
/*routdebugfailure*/
    } else {
/*routdebugleave*/
    }
    CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
    return capi_buildvalue;
}
/***************************** end of getFileType *****************************/

/********************************** getUndef **********************************/
static char doc_f2py_rout_diag2python_diag2python_getUndef[] = "\
undef = getUndef(FNumber)\n\nWrapper for ``getUndef``.\
\n\nParameters\n----------\n"
"FNumber : input int\n"
"\nReturns\n-------\n"
"undef : float";
/* #declfortranroutine# */
static PyObject *f2py_rout_diag2python_diag2python_getUndef(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           void (*f2py_func)(float*,int*)) {
    PyObject * volatile capi_buildvalue = NULL;
    volatile int f2py_success = 1;
/*decl*/

    float getUndeff2pywrap = 0;
    int FNumber = 0;
    PyObject *FNumber_capi = Py_None;
    static char *capi_kwlist[] = {"FNumber",NULL};

/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
    if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
        "O|:diag2python.diag2python.getUndef",\
        capi_kwlist,&FNumber_capi))
        return NULL;
/*frompyobj*/
    /* Processing variable FNumber */
        f2py_success = int_from_pyobj(&FNumber,FNumber_capi,"diag2python.diag2python.getUndef() 1st argument (FNumber) can't be converted to int");
    if (f2py_success) {
    /* Processing variable getUndeff2pywrap */
/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
    (*f2py_func)(&getUndeff2pywrap,&FNumber);
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
        if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
        CFUNCSMESS("Building return value.\n");
        capi_buildvalue = Py_BuildValue("f",getUndeff2pywrap);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
        } /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
    /* End of cleaning variable getUndeff2pywrap */
    } /*if (f2py_success) of FNumber*/
    /* End of cleaning variable FNumber */
/*end of cleanupfrompyobj*/
    if (capi_buildvalue == NULL) {
/*routdebugfailure*/
    } else {
/*routdebugleave*/
    }
    CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
    return capi_buildvalue;
}
/****************************** end of getUndef ******************************/
/*eof body*/

/******************* See f2py2e/f90mod_rules.py: buildhooks *******************/

static FortranDataDef f2py_diag2python_def[] = {
  {"chararray1d",1,{{-1}},NPY_STRING, 1},
  {"chararray2d",2,{{-1,-1}},NPY_STRING, 1},
  {"array1d",1,{{-1}},NPY_FLOAT, 1},
  {"array2d",2,{{-1,-1}},NPY_FLOAT, 1},
  {"array3d",3,{{-1,-1,-1}},NPY_FLOAT, 1},
  {"open",-1,{{-1}},0,0,NULL,(void *)f2py_rout_diag2python_diag2python_open,doc_f2py_rout_diag2python_diag2python_open},
  {"close",-1,{{-1}},0,0,NULL,(void *)f2py_rout_diag2python_diag2python_close,doc_f2py_rout_diag2python_diag2python_close},
  {"getvarinfo",-1,{{-1}},0,0,NULL,(void *)f2py_rout_diag2python_diag2python_getvarinfo,doc_f2py_rout_diag2python_diag2python_getvarinfo},
  {"getnvars",-1,{{-1}},0,0,NULL,(void *)f2py_rout_diag2python_diag2python_getnvars,doc_f2py_rout_diag2python_diag2python_getnvars},
  {"getObsVarInfo",-1,{{-1}},0,0,NULL,(void *)f2py_rout_diag2python_diag2python_getObsVarInfo,doc_f2py_rout_diag2python_diag2python_getObsVarInfo},
  {"getVarTypes",-1,{{-1}},0,0,NULL,(void *)f2py_rout_diag2python_diag2python_getVarTypes,doc_f2py_rout_diag2python_diag2python_getVarTypes},
  {"getobs",-1,{{-1}},0,0,NULL,(void *)f2py_rout_diag2python_diag2python_getobs,doc_f2py_rout_diag2python_diag2python_getobs},
  {"getFileType",-1,{{-1}},0,0,NULL,(void *)f2py_rout_diag2python_diag2python_getFileType,doc_f2py_rout_diag2python_diag2python_getFileType},
  {"getUndef",-1,{{-1}},0,0,NULL,(void *)f2py_rout_diag2python_diag2python_getUndef,doc_f2py_rout_diag2python_diag2python_getUndef},
  {NULL}
};

static void f2py_setup_diag2python(void (*chararray1d)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*chararray2d)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*array1d)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*array2d)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*array3d)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),char *open,char *close,char *getvarinfo,char *getnvars,char *getObsVarInfo,char *getVarTypes,char *getobs,char *getFileType,char *getUndef) {
  int i_f2py=0;
  f2py_diag2python_def[i_f2py++].func = chararray1d;
  f2py_diag2python_def[i_f2py++].func = chararray2d;
  f2py_diag2python_def[i_f2py++].func = array1d;
  f2py_diag2python_def[i_f2py++].func = array2d;
  f2py_diag2python_def[i_f2py++].func = array3d;
  f2py_diag2python_def[i_f2py++].data = open;
  f2py_diag2python_def[i_f2py++].data = close;
  f2py_diag2python_def[i_f2py++].data = getvarinfo;
  f2py_diag2python_def[i_f2py++].data = getnvars;
  f2py_diag2python_def[i_f2py++].data = getObsVarInfo;
  f2py_diag2python_def[i_f2py++].data = getVarTypes;
  f2py_diag2python_def[i_f2py++].data = getobs;
  f2py_diag2python_def[i_f2py++].data = getFileType;
  f2py_diag2python_def[i_f2py++].data = getUndef;
}
extern void F_FUNC(f2pyinitdiag2python,F2PYINITDIAG2PYTHON)(void (*)(void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),char *,char *,char *,char *,char *,char *,char *,char *,char *));
static void f2py_init_diag2python(void) {
  F_FUNC(f2pyinitdiag2python,F2PYINITDIAG2PYTHON)(f2py_setup_diag2python);
}

/*need_f90modhooks*/

/************** See f2py2e/rules.py: module_rules['modulebody'] **************/

/******************* See f2py2e/common_rules.py: buildhooks *******************/

/*need_commonhooks*/

/**************************** See f2py2e/rules.py ****************************/

static FortranDataDef f2py_routine_defs[] = {

/*eof routine_defs*/
    {NULL}
};

static PyMethodDef f2py_module_methods[] = {

    {NULL,NULL}
};

static struct PyModuleDef moduledef = {
    PyModuleDef_HEAD_INIT,
    "diag2python",
    NULL,
    -1,
    f2py_module_methods,
    NULL,
    NULL,
    NULL,
    NULL
};

PyMODINIT_FUNC PyInit_diag2python(void) {
    int i;
    PyObject *m,*d, *s, *tmp;
    m = diag2python_module = PyModule_Create(&moduledef);
    Py_SET_TYPE(&PyFortran_Type, &PyType_Type);
    import_array();
    if (PyErr_Occurred())
        {PyErr_SetString(PyExc_ImportError, "can't initialize module diag2python (failed to import numpy)"); return m;}
    d = PyModule_GetDict(m);
    s = PyUnicode_FromString("1.26.2");
    PyDict_SetItemString(d, "__version__", s);
    Py_DECREF(s);
    s = PyUnicode_FromString(
        "This module 'diag2python' is auto-generated with f2py (version:1.26.2).\nFunctions:\n"
"Fortran 90/95 modules:\n""  diag2python --- chararray1d,chararray2d,array1d,array2d,array3d,open(),close(),getvarinfo(),getnvars(),getObsVarInfo(),getVarTypes(),getobs(),getFileType(),getUndef()"".");
    PyDict_SetItemString(d, "__doc__", s);
    Py_DECREF(s);
    s = PyUnicode_FromString("1.26.2");
    PyDict_SetItemString(d, "__f2py_numpy_version__", s);
    Py_DECREF(s);
    diag2python_error = PyErr_NewException ("diag2python.error", NULL, NULL);
    /*
     * Store the error object inside the dict, so that it could get deallocated.
     * (in practice, this is a module, so it likely will not and cannot.)
     */
    PyDict_SetItemString(d, "_diag2python_error", diag2python_error);
    Py_DECREF(diag2python_error);
    for(i=0;f2py_routine_defs[i].name!=NULL;i++) {
        tmp = PyFortranObject_NewAsAttr(&f2py_routine_defs[i]);
        PyDict_SetItemString(d, f2py_routine_defs[i].name, tmp);
        Py_DECREF(tmp);
    }









/*eof initf2pywraphooks*/
  PyDict_SetItemString(d, "diag2python", PyFortranObject_New(f2py_diag2python_def,f2py_init_diag2python));
/*eof initf90modhooks*/

/*eof initcommonhooks*/


#ifdef F2PY_REPORT_ATEXIT
    if (! PyErr_Occurred())
        on_exit(f2py_report_on_exit,(void*)"diag2python");
#endif
    return m;
}
#ifdef __cplusplus
}
#endif
