process

process.aws

process.L0toL1

AWS Level 0 (L0) to Level 1 (L1) data processing

process.L0toL1.addTimeShift(ds, vars_df)

Shift times based on file format and logger type (shifting only hourly averaged values, and not instantaneous variables). For raw (10 min), all values are sampled instantaneously so do not shift. For STM (1 hour), values are averaged and assigned to end-of-hour by the logger, so shift by -1 hr. For TX (time frequency depends on v2 or v3) then time is shifted depending on logger type. We use the ‘instantaneous_hourly’ boolean from variables.csv to determine if a variable is considered instantaneous at hourly samples.

This approach creates two separate sub-dataframes, one for hourly-averaged variables and another for instantaneous variables. The instantaneous dataframe should never be shifted. We apply shifting only to the hourly average dataframe, then concat the two dataframes back together.

It is possible to use pandas merge or join instead of concat, there are equivalent methods in each. In this case, we use concat throughout.

Fausto et al. 2021 specifies the convention of assigning hourly averages to start-of-hour, so we need to retain this unless clearly communicated to users.

Parameters
  • ds (xarray.Dataset) – Dataset to apply time shift to

  • vars_df (pd.DataFrame) – Metadata dataframe

Returns

ds_out – Dataset with shifted times

Return type

xarray.Dataset

process.L0toL1.decodeGPS(ds, gps_names)

Decode GPS information based on names of GPS attributes. This should be applied if gps information does not consist of float values

Parameters
  • ds (xr.Dataset) – Data set

  • gps_names (list) – Variable names for GPS information, such as “gps_lat”, “gps_lon” and “gps_alt”

Returns

ds – Data set with decoded GPS information

Return type

xr.Dataset

process.L0toL1.getPressDepth(z_pt, p, pt_antifreeze, pt_z_factor, pt_z_coef, pt_z_p_coef)

Adjust pressure depth and calculate pressure transducer depth based on pressure transducer fluid density

Parameters
  • z_pt (xr.Dataarray) – Pressure transducer height (corrected for offset)

  • p (xr.Dataarray) – Air pressure

  • pt_antifreeze (float) – Pressure transducer anti-freeze percentage for fluid density correction

  • pt_z_factor (float) – Pressure transducer factor

  • pt_z_coef (float) – Pressure transducer coefficient

  • pt_z_p_coef (float) – Pressure transducer coefficient

Returns

  • z_pt_cor (xr.Dataarray) – Pressure transducer height corrected

  • z_pt (xr.Dataarray) – Pressure transducer depth

process.L0toL1.getTiltDegrees(tilt, threshold)

Filter tilt with given threshold, and convert from voltage to degrees. Voltage-to-degrees converseion is based on the equation in 3.2.9 at https://essd.copernicus.org/articles/13/3819/2021/#section3

Parameters
  • tilt (xarray.DataArray) – Array (either ‘tilt_x’ or ‘tilt_y’), tilt values (voltage)

  • threshold (int) – Values below this threshold (-100) will not be retained.

Returns

dst.interpolate_na() – Array (either ‘tilt_x’ or ‘tilt_y’), tilt values (degrees)

Return type

xarray.DataArray

process.L0toL1.interpTemp(temp, var_configurations, max_interp=Timedelta('0 days 12:00:00'))

Clip and interpolate temperature dataset for use in corrections

Parameters
  • temp (xarray.DataArray) – Array of temperature data

  • vars_df (pandas.DataFrame) – Dataframe to retrieve attribute hi-lo values from for temperature clipping

  • max_interp (pandas.Timedelta) – Maximum time steps to interpolate across. The default is 12 hours.

Returns

temp_interp – Array of interpolatedtemperature data

Return type

xarray.DataArray

process.L0toL1.reformatGPS(pos_arr, attrs)

Correct latitude and longitude from native format to decimal degrees.

v2 stations should send “NH6429.01544”,”WH04932.86061” (NUK_L 2022) v3 stations should send coordinates as “6628.93936”,”04617.59187” (DY2) or 6430,4916 (NUK_Uv3) decodeGPS should have decoded these strings to floats in ddmm.mmmm format v1 stations however only saved decimal minutes (mm.mmmmm) as float<=60. ‘ In this case, we use the integer part of the latitude given in the config file and append the gps value after it.

Parameters
  • pos_arr (xr.Dataarray) – Array of latitude or longitude measured by the GPS

  • attrs (dict) – The global attribute ‘latitude’ or ‘longitude’ associated with the file being processed. It is the standard latitude/longitude given in the config file for that station.

Returns

pos_arr – Formatted GPS position array in decimal degree

Return type

xr.Dataarray

process.L0toL1.smoothTilt(tilt, win_size)

Smooth tilt values using a rolling window. This is translated from the previous IDL/GDL smoothing algorithm: tiltX = smooth(tiltX,7,/EDGE_MIRROR,MISSING=-999) & tiltY = smooth(tiltY,7,/EDGE_MIRROR, MISSING=-999) endif In Python, this should be dstxy = dstxy.rolling(time=7, win_type=’boxcar’, center=True).mean() But the EDGE_MIRROR makes it a bit more complicated

Parameters
  • tilt (xarray.DataArray) – Array (either ‘tilt_x’ or ‘tilt_y’), tilt values (can be in degrees or voltage)

  • win_size (int) – Window size to use in pandas ‘rolling’ method. e.g. a value of 7 spans 70 minutes using 10 minute data.

Returns

tdf_rolling – The numpy array is the tilt values, smoothed with a rolling mean

Return type

tuple, as: (str, numpy.ndarray)

process.L0toL1.toL1(L0, vars_df, T_0=273.15, tilt_threshold=-100)

Process one Level 0 (L0) product to Level 1

Parameters
  • L0 (xarray.Dataset) – Level 0 dataset

  • vars_df (pd.DataFrame) – Metadata dataframe

  • T_0 (int) – Air temperature for sonic ranger adjustment

  • tilt_threshold (int) – Tilt-o-meter threshold for valid measurements

Returns

ds – Level 1 dataset

Return type

xarray.Dataset

process.L1toL2

AWS Level 1 (L1) to Level 2 (L2) data processing

process.L1toL2.toL2(L1: Dataset, vars_df: DataFrame, data_flags_dir: Path, data_adjustments_dir: Path, T_0=273.15, ews=1013.246, ei0=6.1071, emissivity=0.97) Dataset

Process one Level 1 (L1) product to Level 2. In this step we do:

  • manual flagging and adjustments

  • automated QC: persistence, percentile

  • custom filter: gps_alt filter, NaN t_rad removed from dlr & ulr

  • smoothing of tilt and rot

  • calculation of rh with regards to ice in subfreezin conditions

  • calculation of cloud coverage

  • correction of dsr and usr for tilt

  • filtering of dsr based on a theoritical TOA irradiance and grazing light

  • calculation of albedo

  • calculation of directional wind speed

Parameters
  • L1 (xarray.Dataset) – Level 1 dataset

  • vars_df (pd.DataFrame) – Metadata dataframe

  • T_0 (float) – Ice point temperature in K. The default is 273.15.

  • ews (float) – Saturation pressure (normal atmosphere) at steam point temperature. The default is 1013.246.

  • ei0 (float) – Saturation pressure (normal atmosphere) at ice-point temperature. The default is 6.1071.

  • eps_overcast (int) – Cloud overcast. The default is 1..

  • eps_clear (float) – Cloud clear. The default is 9.36508e-6.

  • emissivity (float) – Emissivity. The default is 0.97.

Returns

ds – Level 2 dataset

Return type

xarray.Dataset

process.L2toL3

AWS Level 2 (L2) to Level 3 (L3) data processing

process.L2toL3.calculate_specific_humidity(T_0, T_100, T_h, p_h, rh_h_wrt_ice_or_water, es_0=6.1071, es_100=1013.246, eps=0.622)

Calculate specific humidity :param T_0: Steam point temperature. Default is 273.15. :type T_0: float :param T_100: Steam point temperature in Kelvin :type T_100: float :param T_h: Air temperature :type T_h: xarray.DataArray :param p_h: Air pressure :type p_h: xarray.DataArray :param rh_h_wrt_ice_or_water: Relative humidity corrected :type rh_h_wrt_ice_or_water: xarray.DataArray :param es_0: Saturation vapour pressure at the melting point (hPa) :type es_0: float :param es_100: Saturation vapour pressure at steam point temperature (hPa) :type es_100: float :param eps: ratio of molar masses of vapor and dry air (0.622) :type eps: int

Returns

Specific humidity data array

Return type

xarray.DataArray

process.L2toL3.calculate_tubulent_heat_fluxes(T_0, T_h, Tsurf_h, WS_h, z_WS, z_T, q_h, p_h, kappa=0.4, WS_lim=1.0, z_0=0.001, g=9.82, es_0=6.1071, eps=0.622, gamma=16.0, L_sub=2830000.0, L_dif_max=0.01, c_pd=1005.0, aa=0.7, bb=0.75, cc=5.0, dd=0.35, R_d=287.05)

Calculate latent and sensible heat flux using the bulk calculation method

Parameters
  • T_0 (int) – Freezing point temperature

  • T_h (xarray.DataArray) – Air temperature

  • Tsurf_h (xarray.DataArray) – Surface temperature

  • rho_atm (float) – Atmopsheric density

  • WS_h (xarray.DataArray) – Wind speed

  • z_WS (float) – Height of anemometer

  • z_T (float) – Height of thermometer

  • q_h (xarray.DataArray) – Specific humidity

  • p_h (xarray.DataArray) – Air pressure

  • kappa (int) – Von Karman constant (0.35-0.42). Default is 0.4.

  • WS_lim (int) – Default is 1.

  • z_0 (int) – Aerodynamic surface roughness length for momention, assumed constant for all ice/snow surfaces. Default is 0.001.

  • g (int) – Gravitational acceleration (m/s2). Default is 9.82.

  • es_0 (int) – Saturation vapour pressure at the melting point (hPa). Default is 6.1071.

  • eps (int) – Ratio of molar masses of vapor and dry air (0.622).

  • gamma (int) – Flux profile correction (Paulson & Dyer). Default is 16..

  • L_sub (int) – Latent heat of sublimation (J/kg). Default is 2.83e6.

  • L_dif_max (int) – Default is 0.01.

  • c_pd (int) – Specific heat of dry air (J/kg/K). Default is 1005..

  • aa (int) – Flux profile correction constants (Holtslag & De Bruin ‘88). Default is 0.7.

  • bb (int) – Flux profile correction constants (Holtslag & De Bruin ‘88). Default is 0.75.

  • cc (int) – Flux profile correction constants (Holtslag & De Bruin ‘88). Default is 5.

  • dd (int) – Flux profile correction constants (Holtslag & De Bruin ‘88). Default is 0.35.

  • R_d (int) – Gas constant of dry air. Default is 287.05.

Returns

  • SHF_h (xarray.DataArray) – Sensible heat flux

  • LHF_h (xarray.DataArray) – Latent heat flux

process.L2toL3.calculate_viscosity(T_h, T_0, rho_atm)

Calculate kinematic viscosity of air

Parameters
  • T_h (xarray.DataArray) – Air temperature

  • T_0 (float) – Steam point temperature

  • rho_atm (xarray.DataArray) – Surface temperature

Returns

Kinematic viscosity

Return type

xarray.DataArray

process.L2toL3.combine_surface_height(df, site_type, threshold_ablation=-0.0002)

Combines the data from three sensor: the two sonic rangers and the pressure transducer, to recreate the surface height, the ice surface height and the snow depth through the years. For the accumulation sites, it is only the average of the two sonic rangers (after manual adjustments to correct maintenance shifts). For the ablation sites, first an ablation period is estimated each year (either the period when z_pt_cor decreases or JJA if no better estimate) then different adjustmnents are conducted to stitch the three time series together: z_ice_surface (adjusted from z_pt_cor) or if unvailable, z_surf_2 (adjusted from z_stake) are used in the ablation period while an average of z_surf_1 and z_surf_2 are used otherwise, after they are being adjusted to z_ice_surf at the end of the ablation season.

Parameters
  • df (pandas.dataframe) – Dataframe with datetime index and variables z_surf_1, z_surf_2 and z_ice_surf

  • site_type (str) – Either ‘accumulation’ or ‘ablation’

  • threshold_ablation (float) – Threshold to which a z_pt_cor hourly decrease is compared. If the decrease is higher, then there is ablation.

process.L2toL3.get_thermistor_depth(df_in, site, station_config)

Calculates the depth of the thermistors through time based on their installation depth (collected in a google sheet) and on the change of surface height: instruments getting buried under new snow or surfacing due to ablation. There is a potential for additional filtering of thermistor data for surfaced (or just noisy) thermistors, but that is currently deactivated because slow.

Parameters
  • df_in (pandas:dataframe) – dataframe containing the ice/firn temperature t_i_* as well as the combined surface height z_surf_combined

  • site (str) – stid, so that maintenance date and sensor installation depths can be found in database

  • station_config (dict) –

    potentially containing the key string_maintenance with station_config[“string_maintenance”] being a list of dictionaries containing maintenance information in the format: [

    {“date”: “2007-08-20”, “installation_depth”: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 6.0, 6.0]}, {“date”: “2008-07-17”, “installation_depth”: [1.2, 2.2, 3.2, 4.2, 5.2, 6.2, 7.2, 10.2]} # Add more entries as needed

    ]

process.L2toL3.gps_coordinate_postprocessing(ds, var, station_config={})
process.L2toL3.hampel(vals_orig, k=168, t0=15)

vals: pandas series of values from which to remove outliers k: size of window (including the sample; 7 is equal to 3 on either side of value)

process.L2toL3.interpolate_temperature(dates, depth_cor, temp, depth=10, min_diff_to_depth=2, kind='quadratic')

Calculates the depth of the thermistors through time based on their installation depth (collected in a google sheet) and on the change of surface height: instruments getting buried under new snow or surfacing due to ablation. There is a potential for additional filtering of thermistor data for surfaced (or just noisy) thermistors, but that is currently deactivated because slow.

Parameters
  • dates (numpy.array) – array of datetime64

  • depth_cor (numpy.ndarray) – matrix of depths

  • temp (numpy.ndarray) – matrix of temperatures

  • depth (float) – constant depth at which (depth_cor, temp) should be interpolated.

  • min_diff_to_depth (float) – maximum difference allowed between the available depht and the target depth for the interpolation to be done.

  • kind (str) – type of interpolation from scipy.interpolate.interp1d

process.L2toL3.piecewise_smoothing_and_interpolation(data_series, breaks)

Smoothes, inter- or extrapolate the GPS observations. The processing is done piecewise so that each period between station relocations are done separately (no smoothing of the jump due to relocation). Piecewise linear regression is then used to smooth the available observations. Then this smoothed curve is interpolated linearly over internal gaps. Eventually, this interpolated curve is extrapolated linearly for timestamps before the first valid measurement and after the last valid measurement.

Parameters
  • data_series (pandas.Series) – Series of observed latitude, longitude or elevation with datetime index.

  • breaks (list) – List of timestamps of station relocation. First and last item should be None so that they can be used in slice(breaks[i], breaks[i+1])

Returns

Smoothed and interpolated values corresponding to the input series.

Return type

np.ndarray

process.L2toL3.process_surface_height(ds, data_adjustments_dir, station_config={})

Process surface height data for different site types and create surface height variables.

Parameters

ds (xarray.Dataset) – The dataset containing various measurements and attributes including ‘site_type’ which determines the type of site (e.g., ‘ablation’, ‘accumulation’, ‘bedrock’) and other relevant data variables such as ‘z_boom_u’, ‘z_stake’, ‘z_pt_cor’, etc.

Returns

The dataset with additional processed surface height variables: ‘z_surf_1’, ‘z_surf_2’, ‘z_ice_surf’, ‘z_surf_combined’, ‘snow_height’, and possibly depth variables derived from temperature measurements.

Return type

xarray.Dataset

process.L2toL3.toL3(L2, data_adjustments_dir: Path, station_config={}, T_0=273.15)

Process one Level 2 (L2) product to Level 3 (L3) meaning calculating all derived variables:

  • Turbulent fluxes

  • smoothed and inter/extrapolated GPS coordinates

  • continuous surface height, ice surface height, snow height

  • thermistor depths

Parameters
  • L2 (xarray:Dataset) – L2 AWS data

  • station_config (Dict) – Dictionary containing the information necessary for the processing of L3 variables (relocation dates for coordinates processing, or thermistor string maintenance date for the thermistors depth)

  • T_0 (int) – Freezing point temperature. Default is 273.15.

postprocess

postprocess.csv2bufr

qc

qc.persistence

qc.persistence.count_consecutive_persistent_values(data: Series, max_diff: float) Series
qc.persistence.find_persistent_regions(data: Series, min_repeats: int, max_diff: float) Series

Algorithm that ensures values can stay the same within the outliers_mask

qc.persistence.get_duration_consecutive_true(series: Series) Series

From a boolean series, calculates the duration, in hours, of the periods with concecutive true values.

The first value will be set to NaN, as it is not possible to calculate the duration of a single value.

Examples

>>> get_duration_consecutive_true(pd.Series([False, True, False, False, True, True, True, False, True]))
pd.Series([np.nan, 1, 0, 0, 1, 2, 3, 0, 1])
Parameters

pd.Series – Boolean pandas Series or DataFrame

Returns

Integer pandas Series or DataFrame with values representing the number of connective true values.

Return type

pd.Series

qc.persistence.persistence_qc(ds: Dataset, variable_thresholds: Optional[Mapping] = None) Dataset

Detect and filter data points that seems to be persistent within a certain period.

TODO: It could be nice to have a reference to the logger or description of the behaviour here. The AWS logger program is know to return the last successfully read value if it fails reading from the sensor.

Parameters
  • ds (xr.Dataset) – Level 1 datset

  • variable_thresholds (Mapping) – Define threshold dict to hold limit values, and the difference values. Limit values indicate how much a variable has to change to the previous value period is how many hours a value can stay the same without being set to NaN * are used to calculate and define all limits, which are then applied to *_u, *_l and *_i

Returns

ds_out – Level 1 dataset with difference outliers set to NaN

Return type

xr.Dataset

get

get.get

AWS data retrieval module

class get.get.TestGet(methodName='runTest')

Bases: TestCase

testGetCLI()

Test get_promice_data

testURL()

Test URL retrieval

get.get.aws_data(aws_name)

Return PROMICE and GC-Net AWS L3 v3 hourly observations

Returns

df – AWS observations dataframe

Return type

pandas.DataFrame

get.get.aws_names()

Return PROMICE and GC-Net AWS names that can be used in get.aws_data() fetching

get.get.lookup_table(base_dois, server='https://dataverse.geus.dk')

Fetch dictionary of data files and download URLs from a DOI entry in the GEUS Dataverse

Parameters
  • base_dois (list) – List of DOIs to search

  • server (str, optional) – DOI server. The default is “https://dataverse.geus.dk

get.get.watson_discharge(t='hour')

Return PROMICE hourly Watson river discharge

Parameters

t (str) – Temporal resolution of the data - “hour”, “day” or “year”

Returns

df – Watson river discharge dataframe

Return type

pandas.DataFrame

tx

tx.tx

AWS Level 0 (L0) data transmission fetching module

class tx.tx.EmailMessage(email_msg, sender_name)

Bases: SbdMessage

Email message object

checkEmail(email_msg)

Check if email is Message object

checkSender(sender_name)

Check email message from field matches sender name or names

getEmailBody()

Get email message body

getEmailInfo()

Parse message in email object

getIMEI()

Get modem identifier from email subject string

tx.tx.GFP2toDEC(Bytes)

Two-bit decoder

Parameters

Bytes (list) – List of two values

Returns

Decoded value

Return type

float

tx.tx.GLI4toDEC(Bytes)

Four-bit decoder

Parameters

Bytes (list) – List of four values

Returns

Decoded value

Return type

float

class tx.tx.L0tx(email_msg, format_file=None, type_file=None, sender_name=['sbdservice', 'ice@geus.dk', 'emailrelay@konectgds.com'], UnixEpochOffset=0, CRbasicEpochOffset=631152000)

Bases: EmailMessage, PayloadFormat

L0 tranmission data object

check2BitNAN(msg, type_letter, letter_flag=['g', 'n', 'e'], nan_value=8191)

Check if byte is a 2-bit NAN. This occurs when the GPS data is not available and the logger sends a 2-bytes NAN instead of a 4-bytes value

checkByte(b)

Check byte format against payload formatter object

checkLength()
checkPayload()

Check message payload

getByteValue(ValueBytesCount, BinaryMessage, idx)

Get values from byte range in binary message

getDataLine()

Get data line from transmission message

Returns

Dataline string if found

Return type

str or None

getFirstByte()

Get first byte in payload

getFormat()

Get binary format type from first byte in payload

Returns

  • bval (int or None) – Format value

  • bfor (str or None) – Format string characters

  • bname (str or None) – Format name

  • blength (int or None) – Expected format length

  • bidx (int) – Format index

  • bool – Valid format flag

isDiagnostics(DataLine)

Flag if message is diagnostics

isObservations(DataLine)

Flag if message is observations

isSummer(DataLine)

Flag if message is summer message

isWatsonObservation(DataLine)

Flag if message is Watson River measurement

isWithInstance(DataLine)

Flag if message is with instance

updateByteCounter(value)

Update byte counter for decoding message

writeEntry(entry, i)

Write out comma-formatted data entry from message

class tx.tx.PayloadFormat(format_file=None, type_file=None)

Bases: object

Payload formatter object

readFile(in_file)

Read lines from file

Parameters

in_file (str) – Input file path

Returns

lines – List of file line contents

Return type

list

readFormatter(in_file, delimiter=',')

Read payload formatter from file. Outputted dictionary set as key[number]: [expected_length, format_characters, description]. Flag column (info[4]) used to signify if entry should be written to output

Parameters
  • in_file (str) – Input file path

  • delimiter (str, optional) – File delimiter. The default is “,”

Returns

payload_fmt – Payload format information

Return type

dict

readPkgFile(fname)

Read lines from internal package file

Parameters

fname (str) – Package file name

Returns

lines – List of file line contents

Return type

list

readType(in_file, delimiter=',')

Read payload type setter from file. Outputted dictionary set as key[type_letter]: number_of_bytes

Parameters
  • in_file (str) – Input file path

  • delimiter (str, optional) – File delimiter. The default is “,”

Returns

payload_typ – Payload type information

Return type

dict

tx.tx.RAWtoSTR(Bytes)

Byte-to-string decoder

Parameters

Bytes (list) – List of values

Return type

Decoded string characters

class tx.tx.SbdMessage(content, attach, imei)

Bases: object

SBD transmission message object

checkAttachment(attach)

Check if attachment is present in email.message.Message object

checkAttachmentName(attach_file)

Check if attachment is .sbd file

getKeyValue(content, seps, key, integer=True)

Get attribute from email via keyword

getLocation(content, seps=' ', key='Unit Location')

Get latitude longitude unit location from email message

getPayloadFromEmail(attach, message_size)

Get Sbd payload from email object

getPayloadFromFile(attach)

Read Sbd payload from .sbd file

getStatus(content, seps1=': ', seps2=' ', key='Session Status')

Get session status from email message

class tx.tx.TestTX(methodName='runTest')

Bases: TestCase

testCLIl0tx()

Test get_l0tx CLI

testCLImsg()

Test get_msg CLI

testCLIwatson()

Test get_watsontx CLI

testEmailMessage()

Test EmailMessage object initialisation from .msg file

testL0tx()

Test L0tx object initialisation

testPayloadFormat()

Test PayloadFormat object initialisation

tx.tx.addTail(in_file, out_dir, aws_name, header_names='', lines_limit=100)

Generate tails file from L0tx file

Parameters
  • in_file (str) – Input L0tx file

  • out_dir (str) – Output directory for tails file

  • aws_name (str) – AWS name

  • header_names (str, optional) – Header names. The default is ‘’.

  • lines_limit (int, optional) – Number of lines to append to tails file. The default is 100.

tx.tx.findDuplicates(lines)

Find duplicates lines in list of strings

Parameters

lines (list) – List of strings

Returns

unique_lines – List of unique strings

Return type

list

tx.tx.findLine(content, key)

Find keyword in line

Parameters
  • content (str) – String to find keyword in

  • key (str) – Keyword to find in string

Returns

line – Line that keyword appears on

Return type

str

tx.tx.getMail(mail_server, last_uid=1)

Retrieve new mail

Parameters
  • mail_server (imaplib.IMAP_SSL) – Mail server object

  • last_uid (int, optional) – Mail uid to start retrieval from. The default is 1.

Yields
  • str – Mail uid

  • str – Mail message

tx.tx.isModified(filename, time_threshold=1)

Return flag denoting if file is modified within a certain timeframe

Parameters
  • filename (str) – File path

  • time_threshold (int) – Time threshold (provided in hours)

Returns

Flag denoting if modified (True) or not (False)

Return type

bool

tx.tx.loadMsg(fname)

Load .msg email file into format compatible with EmailMessage and SbdMessage objects

Parameters

fname (str) – File path to .msg file

Returns

Email message object

Return type

email.message.Message

tx.tx.parseValue(line, seps)

Parse last value from line according to separating characters

Parameters
  • line (str) – String to split

  • sep (str) – Separator characters to split line by

Returns

value – Value extracted from line

Return type

str

tx.tx.readSBD(sbd_file)

Read encoded .sbd transmission file

Parameters

sbd_file (str) – Filepath to encoded .sbd file

Returns

data – Transmission message byte object

Return type

bytes

tx.tx.saveMsg(msg, fname)

Save email message object to .msg file

Parameters
  • msg (email.message.Message) – Email object to save to file

  • fname (str) – File path to outputted .msg file

tx.tx.sortLines(in_file, out_file, replace_unsorted=True)

Sort lines in text file

Parameters
  • in_file (str) – Input file path

  • out_file (str) – Output file path

  • replace_unsorted (bool, optional) – Flag to replace unsorted files with sorted files. The default is True.