checksit.readers.cdl
Reader for CDL files and netCDF files.
Functions
|
Get the output of a shell command. |
|
Read a CDL file or netCDF file and parse it into a CDLParser object. |
Classes
|
Parse a CDL file or netCDF file into dictionaries. |
- class checksit.readers.cdl.CDLParser(inpt: str, verbose: bool = False)[source]
Parse a CDL file or netCDF file into dictionaries.
Extract information from netCDF files or CDL files into a dictionaries for attributes, variables and dimensions. NetCDF files are first converted to CDL using ncdump.
- inpt
The input file path or CDL content.
- verbose
Print verbose output during parsing.
- cdl
The CDL content of the input file.
- dimensions
The dimensions of the netCDF file.
- variables
The variables of the netCDF file.
- global_attrs
The global attributes of the netCDF file.
- fmt_errors
A list of format errors found during parsing.
- to_dict() Dict[str, Dict[str, str] | Dict[str, Dict[str, str]] | str | List[str]][source]
Return the parsed CDL content as a dictionary.
- Returns:
- A dictionary of the parsed CDL content, with keys “dimensions”,
”variables”, “global_attributes” and “inpt”, where “inpt” is the input file path or CDL content.
- checksit.readers.cdl.get_output(cmd: str) str[source]
Get the output of a shell command.
- Parameters:
cmd – The shell command to run.
- Returns:
The output of the shell command.
- checksit.readers.cdl.read(fpath: str, verbose: bool = False) CDLParser[source]
Read a CDL file or netCDF file and parse it into a CDLParser object.
- Parameters:
fpath – The file path to read.
verbose – Print verbose output during parsing.
- Returns:
A CDLParser object containing the parsed CDL content.