Skip to content

Commit

Permalink
Merge pull request #672 from PCMDI/670_fixed_py310_prepare_file_check
Browse files Browse the repository at this point in the history
Fix PrePARE for Python 3.10 builds
  • Loading branch information
mauzey1 authored Aug 29, 2022
2 parents 7cb3f2a + 9702f4a commit c805fe0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 7 additions & 4 deletions LibCV/pywrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,21 @@ def check_sourceID(table_id):
return(ierr)


def check_filename(table_id, var_name, calendar, timeunits, infile):
def check_filename(table_id, var_id, calendar, timeunits, infile):
'''
Validate filename with timestamp for current variable and file
Usage:
cmip6_cv.check_filename(table_id, var_id)
cmip6_cv.check_filename(table_id, var_id, calendar, timeunits, infile)
Where:
table_id is the table id returned by load_table()
var_name is the variable name
var_id is the variable id returned by setup_variable()
calendar is the calendar type used by the file (ex. 360_day)
timeunits is the time unit type used by the file (ex. days since 1850-01-01)
infile is the name of the file
Return 0 on success
'''
ierr = _cmip6_cv.check_filename(table_id, var_name,
ierr = _cmip6_cv.check_filename(table_id, var_id,
calendar, timeunits, infile)
return(ierr)

Expand Down
8 changes: 2 additions & 6 deletions Src/_controlvocabulary.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ static PyObject *PyCV_checkFilename(PyObject * self, PyObject * args)
char *szInTimeCalendar;
char *szInTimeUnits;
char *infile;
int nTimeCalLen;
int nTimeUnitsLen;
int ninfile;
int ierr;

cmor_is_setup();

if (!PyArg_ParseTuple(args, "iis#s#s#", &ntable, &varid,
&szInTimeCalendar, &nTimeCalLen,
&szInTimeUnits, &nTimeUnitsLen, &infile, &ninfile)) {
if (!PyArg_ParseTuple(args, "iisss", &ntable, &varid,
&szInTimeCalendar, &szInTimeUnits, &infile)) {
return (Py_BuildValue("i", -1));
}

Expand Down

0 comments on commit c805fe0

Please sign in to comment.