Output API

Module for handling crunching output tracking

This module handles checking whether a file has already been crunched and if its source files have been updated since it was last crunched.

class netcdf_scm.output.OutputFileDatabase(out_dir)[source]

Bases: object

Holds a list of output files which have been written.

Also keeps track of the source files used to create each output file.

contains_file(filepath)[source]

Return whether a filepath exists in the database

Parameters

filepath (str) – Filepath to check (use absolute paths to be safe)

Returns

If the file is in the database, True, otherwise False

Return type

bool

dump()[source]

Rewrite the entire file

load_from_file()[source]

Load database from self.out_dir

Returns

Handle to the loaded filepath

Return type

io.TextIOWrapper

Raises

ValueError – The loaded file contains more than one entry for a given filename

register(out_fname, info)[source]

Register a filepath with info in the database

Parameters
  • out_fname (str) – Filepath to register

  • info (dict) – out_fname’s metadata