ctdclient.model.near_real_time_publication module

ctdclient.model.near_real_time_publication.instantiate_near_real_time_target(*args, frequency_of_action='23:59:00', **kwargs)[source]
Return type:

NearRealTimeTarget

class ctdclient.model.near_real_time_publication.NRTList(*args, **kwargs)[source]

Bases: UserList

update_nrt_data(clear_data=True)[source]
create_nrt_instance(path)[source]
get_template(template_path=PosixPath('/workspace/CTD-Software/CTD-Client/resources/templates/nrt_template.toml'))[source]
toggle_activity(nrt)[source]
kill_processes()[source]
delete_nrt(nrt)[source]
class ctdclient.model.near_real_time_publication.NearRealTimeTarget(recipient_address, target_file_suffix, target_file_directory='', geo_filter='', email_info={}, file_path='', active=False, **kwargs)[source]

Bases: object

Stores information for near-real-time distribution of latest CTD data files. Can work in two modes: email or rsync/copy. Will distinguish between these by checking ‘recipient_adress’ for an ‘@’.

abstractmethod toggle_activity()[source]
abstractmethod run()[source]

Will move the recent files to the target location.

create_email_message(target_files, to_address='', from_address='', subject='', body='')[source]

Creates an email with target files attached.

create_email_draft(msg, file_path='')[source]

Creates an email .eml draft file, that can be opened by common email programs.

Return type:

Path

open_draft_msg(file_path)[source]

Open an .eml file using the default email program.

run_email_logic(files_to_attach, run_manually=False)[source]
send_email(msg)[source]

Sends the email message using the given smtp server configuration.

copy_files(target_file)[source]

Copies target files to given location.

get_target_files(target_file=PosixPath('.'))[source]

Creates a list of paths to files that are meant to be published.

Return type:

list[Path]

deg_min_to_deg_decimal(value)[source]
Return type:

float

geographic_filter(coordinate_pair, polygon_data_to_check_against='')[source]

Checks, whether we are inside of a certain polygon. The polygon will usually be the EEZ of a certain country. Does support all data formats that geopandas can handle.

Return type:

bool

time_filter(file)[source]

Ensure, that file has been modified in the last 24 hours.

Return type:

bool

class ctdclient.model.near_real_time_publication.DailyPublication(*args, time_to_run_at='23:59:30', single_run=False, **kwargs)[source]

Bases: NearRealTimeTarget

action()[source]
start()[source]
stop()[source]
toggle_activity()[source]
ctdclient.model.near_real_time_publication.timer(time_to_run_at, function, single_run)[source]
class ctdclient.model.near_real_time_publication.EachProcessingPublication(*args, **kwargs)[source]

Bases: NearRealTimeTarget

toggle_activity()[source]
run(target=PosixPath('.'))[source]

Will move the recent files to the target location.