Output Management Module
The output management module handles saving and exporting analysis results in various formats.
Main Functions
- src.output_management.manage_output(args, infile, method)[source]
Manages the output directories and file names for results and figures.
Parameters: - args: Parsed command-line arguments. - infile: The input file name. - method: The method used for calculations.
Returns: - Tuple containing paths for results subdirectory, figures subdirectory, and the output file name.
- src.output_management.backup_file(source_path, destination_directory)[source]
Copies a file to a destination directory for backup purposes.
Parameters: - source_path: Path to the source file. - destination_directory: Directory where the file will be copied.
- src.output_management.save_results_netcdf(out_nc, results_subdirectory, outfile_name, app_logger)[source]
Saves the calculation results to a NetCDF file.
Parameters: - MovingObj: The object containing calculation results. - stored_terms: List of terms to be saved. - results_subdirectory: Directory where results will be saved. - outfile_name: Base name for the output file. - app_logger: Logger for outputting information and error messages.
- src.output_management.save_results_csv(results_df_dictionary, results_subdirectory, app_logger)[source]
Saves the calculation results to CSV files for each term.
Parameters: - results_df_dictionary: Dictionary of pandas DataFrames for each term. - results_subdirectory: Directory where results will be saved. - app_logger: Logger for outputting information and error messages.
- src.output_management.save_output_track(output_track_attributes, args, results_subdirectory, figures_subdirectory, outfile_name, app_logger)[source]
Saves track data to a CSV file and generates track and min/max zeta height plots.
Parameters: - output_track_attributes: Dictionary containing track attributes. - args: Command-line arguments or parameters specifying calculation options. - results_subdirectory: Directory where the track CSV will be saved. - figures_subdirectory: Directory where figures will be saved. - outfile_name: Base name for the output track file. - app_logger: Logger for outputting information and error messages.
Key Features
CSV output generation
NetCDF file creation
Result formatting
Metadata preservation
File organization
Data compression
Output Formats
CSV Files
Budget results exported as comma-separated values:
Time series data
Statistical summaries
Parameter tables
Processing logs
NetCDF Files
Structured output preserving:
Original coordinate systems
Variable attributes
Processing history
Dimensional relationships
Directory Structure
Organized output directory:
Results by domain type
Timestamped analysis runs
Parameter-specific subdirectories
Summary files
Usage Examples
from src.output_management import save_results, export_csv
# Save complete results
save_results(budget_results, output_dir='Results/')
# Export specific data to CSV
export_csv(heat_budget_data, 'heat_budget_results.csv')