""" :Author: Daniel Mohr :Email: daniel.mohr@dlr.de :Date: 2021-02-15 (last change). :License: GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007. """
""" :Author: Daniel Mohr :Email: daniel.mohr@dlr.de :Date: 2021-02-15 (last change).
Checks the give file for the format netCDF. It uses the CF Checker: https://github.com/cedadev/cf-checker
:param file: file to analyse """ # pylint: disable=no-member,bad-option-value,import-outside-toplevel # Climate and Forecasts (CF) Metadata Convention is used convention = rootgrp.Conventions # should be the same as data_model # data_model describes the netCDF data model version: # NETCDF3_CLASSIC, NETCDF4, NETCDF4_CLASSIC, NETCDF3_64BIT_OFFSET or # NETCDF3_64BIT_DATA # check for Climate and Forecasts (CF) Metadata Convention inst = cfchecker.cfchecks.CFChecker( uploader=None, useFileName='yes', badc=None, coards=None, cfRegionNamesXML=cfchecker.cfchecks.REGIONNAMES, cfStandardNamesXML=cfchecker.cfchecks.STANDARDNAME, cfAreaTypesXML=cfchecker.cfchecks.AREATYPES, cacheDir=tempfile.gettempdir(), cacheTables=False, # True for many files cacheTime=24*3600, # 1 day as hard coded in cfchecker.cfchecks version=convention, debug=False, silent=True) inst.checker(file) totals = inst.get_total_counts() checker_name = 'CF Checker Version ' + cfchecker.cfchecks.__version__ result[checker_name] = dict() result[checker_name]['created'] = time.time() result[checker_name]['error'] = totals["FATAL"] + totals["ERROR"] result[checker_name]['warning'] = totals["WARN"] if output_format != 'human_readable': result[checker_name]['result'] = inst.all_results |