Skip to main content

lc.cdf

function CDF.compare_aia_files

Compare 2 AIA files, printing out differences

Parameters

ds_base : nc.Dataset
        Base AIA file
ds_cmp : nc.Dataset
        Comparison AIA file

function CDF.verify_aia_file

Verifies AIA fields against spec.    E1948-98 is the original spec.

Parameters

ds : nc.Dataset
        AIA file
spec : str
        Spec to validate against

function CDF.write_new_cdf_file

Create a new CDF file with data from a dictionary

Parameters

cdf_filename : str
        Filename for new CDF file
cdf_dataframe
        Data to be written to CDF file
        Variable names should be the column names of the dataframe
additional_vars : dict
        Additional variables to be written to CDF file. Values can be a list or a single value
        Format should be {"variable_name": value, ...}
dimensions : dict
        Dimensions for CDF file
        Format should be {"dimension_name": dimension_length, ...}
attributes : dict
        Attributes for CDF file
        Format should be {"attribute_name": attribute_value, ...}
to_bytes : bool
        If True, return CDF file as bytes object
        If False, write CDF file to disk

function CDF.write_variable_to_cdf

Write a variable to a new netCDF file

Parameters

cdf_file : netCDF4.Dataset
        netCDF file to write to
variable_name : str
        Name of the variable to write
data : np.array
        Data to write to the variable
if_exists : str
        Flag to determine what to do if the variable already exists in the file. Options are "append", "replace", or "skip"
save_flag : bool
        Flag to save the file after writing the variable

Returns

None

function CDF.copy_cdf_data_to_new_file

Copy data from one netCDF file to another

Parameters

original_cdf_file : netCDF4.Dataset
        Original netCDF file
new_cdf_filename : str
        Name of new netCDF file
to_bytes : bool
        If True, return new netCDF file as bytes
        If False, writes to disk at file location and returns file name
variables_to_copy : list
        List of variables to copy
        If None, all variables will be copied
close_file : bool
        If True, close file after copying and return either bytes or file name
        If False, return file object
include_peak_data : bool
        If True, include peak data in new file
        If False, exclude peak data from new file

Returns

new_cdf_file : netCDF4.Dataset or bytes
        New netCDF file
        If to_bytes is True, returns new netCDF file as bytes
        If to_bytes is False, writes to disk at file location and returns file name

function CDF.append_peak_info_to_cdf

Append peak information to an existing CDF file

Parameters

existing_cdf_filename : str
        Filename for existing CDF file
peak_info : CDFPeakInfo
        DataFrame containing peak information
        Columns should be the same as the peak information columns in the CDF file
        peak_name, peak_retention_time, peak_height, peak_area
outdir : str
        Directory to write new CDF file; same as existing_cdf_filename if not specified
to_bytes : bool
        If True, return CDF file as bytes object
        If False, write CDF file to disk
create_copy : bool
        If True, create a copy of the existing CDF file and append data to the copy
        If False, append data to the existing CDF file

function CDFOutput.__init__

Initialize LCOutput object for outputting data from netCDF file in AIA format

Parameters

cdf_filename : str
        Name of the netCDF file
cdf : nc.Dataset
        netCDF file containing LC run data in AIA format
baseline : np.ndarray, optional
        Array containing baseline data

function CDFOutput.to_excel

Outputs the data from the netCDF file to an Excel file

Parameters

filename : str | None
        Name of the file to write to
        If None, the method will return a tuple of DataFrames (peak_purity, peak_stats)
mode : str
        Mode to use when writing to Excel file
        Options are "w" to overwrite the file or "a" to append to the file
assay : str
        Assay-specific information to include in the Excel file

function CDFOutput.to_html

Plot data from a netCDF file

Parameters

filename : str
        Filename for HTML file to save plot
        If None, plot will be displayed
write_mode : str
        Mode to use when writing to HTML file
        Options are "w" to overwrite the file or "a" to append to the file
num_peaks_to_plot : int
        Number of peaks to plot, can be used to excludesummary peak info from plot
show_peak_names : bool
        If True, show peak names on the plot