pepys_import.core.validators package

Submodules

pepys_import.core.validators.basic_validator module

class pepys_import.core.validators.basic_validator.BasicValidator(parser_name)[source]

Bases: object

validate(object_, errors)[source]
static validate_course(course, errors, error_type)[source]

Validates the given course. It’s logic is as follows: If course is none, there is nothing to validate, return True If course exists,check if it’s between 0 and 360. If yes, return True

Parameters
  • course (Quantity) – Course of the object (In degrees)

  • errors (List) – Error List to save value error if it raises

  • error_type (String) – Type of error

Returns

True if there is no error, False otherwise

Return type

bool

static validate_heading(heading, errors, error_type)[source]

Validates the given heading. It’s logic is as follows: If heading is none, there is nothing to validate, return True If heading exists, check if it’s between 0 and 360. If yes, return True

Parameters
  • heading (Quantity) – Heading of the object (In degrees)

  • errors (List) – Error List to save value error if it raises

  • error_type (String) – Type of error

Returns

True if there is no error, False otherwise

Return type

bool

static validate_latitude(latitude, errors, error_type)[source]

Validates the given latitude. It’s logic is as follows: If latitude is none, there is nothing to validate, return True If latitude is not none, check whether it is between -90 and 90. If yes, return True

Parameters
  • latitude – Latitude of the measurement object

  • errors (List) – Error List to save value error if it raises

  • error_type (String) – Type of error

Returns

True if there is no error, False otherwise

Return type

bool

static validate_longitude(longitude, errors, error_type)[source]

Validates the given longitude. It’s logic is as follows: If longitude is none, there is nothing to validate, return True If longitude is not none, check whether it is between -180 and 180. If yes, return True

Parameters
  • longitude – Longitude of the measurement object

  • errors (List) – Error List to save value error if it raises

  • error_type (String) – Type of error

Returns

True if there is no error, False otherwise

Return type

bool

pepys_import.core.validators.constants module

pepys_import.core.validators.enhanced_validator module

class pepys_import.core.validators.enhanced_validator.EnhancedValidator[source]

Bases: object

Enhanced validator serve to verify the lat/long, in addition to the course/speed/heading

static calculate_time(curr_time, prev_time)[source]

Finds the difference between two Datetime objects, converts it to Quantity seconds

Parameters
  • curr_time (Datetime) – Timestamp of the current measurement object

  • prev_time (Datetime) – Timestamp of the previous measurement object

Returns

Time difference (In seconds)

Return type

Quantity

static course_heading_loose_match_with_location(curr_location, prev_location, heading, course, errors, error_type)[source]

Loosely matches the course and heading values with the bearing between two location points.

Parameters
  • curr_location (Location) – Point of the current location of the object

  • prev_location (Location) – Point o the previous location of the object

  • heading (Quantity) – Heading of the object (In degrees)

  • course (Quantity) – Course of the object (In degrees)

  • errors (List) – Error List to save value error if it raises

  • error_type (String) – Type of error

Returns

True if there is no error, False otherwise

Return type

bool

static speed_loose_match_with_location(curr_location, prev_location, speed, time, errors, error_type)[source]

Loosely matches the recorded speed with the calculated speed.

Parameters
  • curr_location (Location) – Point of the current location of the object

  • prev_location (Location) – Point of the previous location of the object

  • speed (Quantity) – Speed the object

  • time (Datetime) – Timestamp of the object

  • errors (List) – Error List to save value error if it raises

  • error_type (String) – Type of error

Returns

True if there is no error, False otherwise

Return type

bool

validate(current_object, errors, parser_name, prev_object=None)[source]

Module contents