compass.landice.ismip7.remap.netcdf_file_is_valid
- compass.landice.ismip7.remap.netcdf_file_is_valid(path, varname=None, require_time=False, logger=None)[source]
Return True if
pathexists, opens cleanly, containsvarnameand (optionally) atimecoordinate, and its last time record can actually be read. Used to detect incomplete intermediate files left by an interrupted (timed-out) run so they can be regenerated instead of silently reused. The last-record read catches a file whose header is complete but whose data section was truncated mid-write (which opens cleanly but fails later at concatenation).- Parameters:
path (str) – Path to the NetCDF file to check
varname (str, optional) – Variable name to verify is present; if None, only checks file opens
require_time (bool, optional) – Whether to require a
timecoordinate/variablelogger (logging.Logger, optional) – Logger for status messages (logs incomplete-file info if provided)
- Returns:
bool – True if the file is valid and complete; False otherwise