nrgpy.utils.utilities module#

nrgpy.utils.utilities.affirm_directory(directory)[source]#

create directory if not exists

print status to terminal

nrgpy.utils.utilities.check_platform()[source]#

determine which operating system python is running on

nrgpy.utils.utilities.count_files(directory, filters, extension, show_files=False, **kwargs)[source]#

counts the number of files in the first level of a directory

Parameters
directorystr

path of directory to be checked

filtersstr

filter present in file to be checked

extensionstr

secondary filter

show_filesbool, optional

if set to True, prints file name

start_timeint

seconds; if set, use as reference; only count if file is newer than start_time

nrgpy.utils.utilities.create_spd_filename_from_cloud_export(filename)[source]#
nrgpy.utils.utilities.data_months(start_date, end_date, output='string')[source]#

returns list of months for a date range in YYYY-mm-dd format

Parameters
start_datestr or datetime

YYYY-mm-dd formatted date or datetime object

end_datestr or datetime

must be same formatting as start_date or god help you

outputstr

“string” or “datetime”; specify date types you want returned.

Returns
list
nrgpy.utils.utilities.date_check(start_date, end_date, string)[source]#

returns true if string date is between dates

Parameters
start_datestr

“YYYY-mm-dd”

end_datestr

“YYYY-mm-dd”

stringstr

string including date to check

nrgpy.utils.utilities.draw_progress_bar(index, total, start_time, barLen=45, header='Time elapsed', label='')[source]#

simple text progress bar

nrgpy.utils.utilities.fix_export_siteid_filename(filepath, site_number)[source]#

Change out NRG Cloud site id with padded site number

nrgpy.utils.utilities.is_sympro_running()[source]#

checks pid list for instance of sympro running

nrgpy.utils.utilities.linux_folder_path(folder_path)[source]#

assert folder_path ending with ‘/’

nrgpy.utils.utilities.load(site_number='', serial_number='', filename='')[source]#

recall a reader from a pickle file by site number or filename

Parameters
site_numberstr

6-digit site number of stored reader OR spidar serial number

filenamestr

full or relative path of pickle file

Returns
object

contents of pickle file

nrgpy.utils.utilities.rename_cloud_export_like_spd(filepath)[source]#

rename nrg cloud export files with SPD formatting

class nrgpy.utils.utilities.renamer[source]#

Bases: object

for replacing duplicate column names after transpose

nrgpy.utils.utilities.save(reader, filename='')[source]#

save reader as a Python pickle file, to be recalled later

nrgpy.utils.utilities.set_start_stop(reader, with_time=False)[source]#
nrgpy.utils.utilities.windows_folder_path(folder_path)[source]#

convert ‘/’ to ‘' in folder_path and assert ending in ‘'