nrgpy.read.sympro_txt module#

class nrgpy.read.sympro_txt.SymProTextRead(filename: str = '', out_file: str = '', text_timestamps: bool = False, **kwargs)[source]#

Bases: object

arrange_ch_info()[source]#

creates ch_info dataframe and ch_list array

calculate_soiling_ratio(method='IEC', T0=25, G0=1000, alpha=0.0004, I_clean_SC_0=0.9, I_soiled_SC_0=0.9)[source]#
concat_txt(txt_dir='', file_type='meas', file_filter='', filter2='', start_date='1970-01-01', end_date='2150-12-31', ch_details=False, output_txt=False, out_file='', progress_bar=True, **kwargs)[source]#

Will concatenate all text files in the txt_dir

files must match the site_filter argument. Note these are both blank by default.

Parameters:
txt_dirstr (path-like)

directory holding txt files

file_typestr

type of export (meas, event, comm, sample, etc…)

file_filterstr

text filter for txt files, like site number, etc.

filter2str

secondary text filter

start_datestr

for filtering files to concat based on date “YYYY-mm-dd”

end_datestr

for filtering files to concat based on date “YYYY-mm-dd”

ch_detailsbool

show additional info in ch_info dataframe

output_txtbool

create a txt output of data df

out_filestr

filename to write data dataframe too if output_txt = True

progress_barbool

show bar on concat [True] or list of files [False]

Returns:
ch_infoobj

pandas dataframe of ch_list (below) pulled out of file with sympro_txt_read.arrange_ch_info()

ch_listlist

list of channel info; can be converted to json w/ import json … json.dumps(fut.ch_info)

dataobj

pandas dataframe of all data

headobj

lines at the top of the txt file…, used when rebuilding timeshifted files

site_infoobj

pandas dataframe of site information

logger_snstr
ipack_snstr
logger_typestr
ipack_typestr
latitudefloat
longitudefloat
elevationint
site_numberstr
site_descriptionstr
start_datestr
txt_file_nameslist

list of files included in concatenation

Examples

Read files into nrgpy reader object >>> import nrgpy >>> reader = nrgpy.SymProTextRead() >>> reader.concat_txt(

txt_dir=’/path/to/txt/files/’, file_filter=’123456’, # site 123456 start_date=’2020-01-01’, end_date=’2020-01-31’,

)

Time elapsed: 2 s | 33 / 33 [=============================================] 100% Queue processed >>> reader.logger_sn ‘820600019’ >>> reader.ch_info

Bearing: Channel: Description: Effective Date: Height: Offset: Scale Factor: Serial Number: Type: Units:

0 50.00 1 NRG S1 2020-01-31 00:00:00 33.00 0.13900 0.09350 94120000059 Anemometer m/s 1 230.00 2 NRG S1 2020-01-31 00:00:00 0.00 0.13900 0.09350 94120000058 Anemometer m/s 2 50.00 3 NRG S1 2020-01-31 00:00:00 22.00 0.13900 0.09350 94120000057 Anemometer m/s 3 230.00 4 NRG 40C Anem 2020-01-31 00:00:00 22.00 0.35000 0.76500 179500324860 Anemometer m/s 4 50.00 5 NRG 40C Anem 2020-01-31 00:00:00 12.00 0.35000 0.76500 179500324859 Anemometer m/s 5 230.00 6 NRG S1 2020-01-31 00:00:00 12.00 0.13900 0.09350 94120000056 Anemometer m/s 6 320.00 13 NRG 200M Vane 2020-01-31 00:00:00 32.00 -1.46020 147.91100 10700000125 Vane Deg 7 320.00 14 NRG 200M Vane 2020-01-31 00:00:00 21.00 -1.46020 147.91100 10700000124 Vane Deg 8 0.00 15 NRG T60 Temp 2020-01-31 00:00:00 34.00 -40.85550 44.74360 9400000705 Analog C 9 0.00 16 NRG T60 Temp 2020-01-31 00:00:00 2.00 -40.85550 44.74360 9400000xxx Analog C 10 0.00 17 NRG RH5X Humi 2020-01-31 00:00:00 0.00 0.00000 20.00000 NaN Analog %RH 11 0.00 20 NRG BP60 Baro 2020-01-31 00:00:00 0.00 495.27700 243.91400 NaN Analog hPa 12 0.00 21 NRG BP60 Baro 2020-01-31 00:00:00 2.00 495.04400 244.23900 9396FT1937 Analog hPa

format_data_for_epe()[source]#
format_site_data()[source]#

take txt header to create oject data

insert_blank_header_rows(filename)[source]#

insert blank rows when using shift_timestamps()

ensures the resulting text file looks and feels like an original Sympro Desktop exported

make_header_for_epe()[source]#
output_txt_file(epe=False, soiling=False, standard=True, shift_timestamps=False, out_file='', **kwargs)[source]#
select_channels_for_reformat(epe=False, soiling=False)[source]#

determines which of the channel headers fit those required for post-processing for either

  1. EPE formatting

  2. soiling ratio calculation

Note that this formatting requires the the channel headers to be full (requires Local export of text files, as of 0.1.8.

nrgpy.read.sympro_txt.shift_timestamps(txt_folder: str = '', out_folder: str = '', file_filter: str = '', start_date: str = '1970-01-01', end_date: str = '2150-12-31', seconds: int = 3600)[source]#

Takes as input a folder of exported standard text files and time to shift in seconds.

Parameters:
txt_folderstr

path to folder with txt files to shift

out_folderstr

where to put the shifted files (in subfolder by default)

file_filterstr

filter for restricting file set

start_datestr

date filter “YYYY-mm-dd”

end_datestr

date filter “YYYY-mm-dd”

secondsint

time in seconds to shift timestamps (default 3600)

Returns:
obj

text files with shifted timestamps; new file names include shifted timestamp.

nrgpy.read.sympro_txt.sympro_txt_read#

alias of SymProTextRead