openghg_inversions.hbmcmc.hbmcmc_output#
Functions for configuring HBMCMC inversion output files.
- openghg_inversions.hbmcmc.hbmcmc_output.check_and_create_folder(outputpath: str | Path) None#
Check folder exists and create if not.
- Parameters:
outputpath – Path of folder to check exists.
- openghg_inversions.hbmcmc.hbmcmc_output.copy_config_file(config_file: str, param: dict | None = None, **command_line) None#
Create a copy of the inputs used to run MCMC code.
Based on the input config file and any additional parameters specified on the command line.
Writes output file to same location as MCMC output (output filename based on define_output_filename() function with ‘.ini’ extension).
Values to create the output filename and location are either extracted from the config_file directly or from the input param dictionary if specified.
Any additional command line arguments can be specified as keyword arguments. e.g. start_date=”2018-01-01”, end_date=”2019-01-01”
- Parameters:
config_file – Input configuration file name. Should be an .ini file.
param – Optional param dictionary used directly in input to MCMC code. Just included as a convenience so config_file doesn’t have to be read twice but should be the same inputs contained within the configuration file unless they have been superceeded by command line arguments.
**command_line – Any additional keyword arguments from the command line input.
- openghg_inversions.hbmcmc.hbmcmc_output.define_output_filename(outputpath: str | Path, species: str, domain: str, outputname: str, start_date: str, ext: str = '.nc') str#
Create output file name to write results to.
Output filename based on the format: ‘outputpath’/’species’_’domain’_’outputname’_’start_date’’ext’ e.g. /home/user/output/CH4_EUROPE_test_2014-01-01.nc
- Parameters:
outputpath – Directory where to save outputfile.
species – Atmospheric trace gas species of interest (e.g. ‘co2’).
domain – Name of modelling domain used (e.g. ‘EUROPE’).
outputname – Additional str to include in filename (e.g. ‘Test’).
start_date – Start date of inversion in format YYYY-MM-DD.
ext – File extension. Defaults to .nc.
- Returns:
Fullpath with filename of output file.
- Return type: