aerofiles.seeyou

class aerofiles.seeyou.Reader(fp=None)

A reader for the SeeYou CUP waypoint file format.

see http://download.naviter.com/docs/CUP-file-format-description.pdf

class aerofiles.seeyou.Writer(fp, encoding='utf-8', file_format=0)

A writer for SeeYou CUP files. Supports waypoints and tasks:

with open('competition.cup', 'wb') as fp:
    writer = Writer(fp)
Parameters:
  • fp – file pointer to write to

  • encoding – the encoding used for the output

  • file_format – Can be one of the SeeYouFileFormat.

write_observation_zone(num, **kw)

Write observation zone information for a taskpoint:

writer.write_task_options(
    start_time=time(12, 34, 56),
    task_time=timedelta(hours=1, minutes=45, seconds=12),
    waypoint_distance=False,
    distance_tolerance=(0.7, 'km'),
    altitude_tolerance=300.0,
)
# -> Options,NoStart=12:34:56,TaskTime=01:45:12,WpDis=False,NearDis=0.7km,NearAlt=300.0m
Parameters:
  • num – consecutive number of a waypoint (0: Start)

  • style – direction (0: Fixed value, 1: Symmetrical, 2: To next point, 3: To previous point, 4: To start point

  • radius – radius 1 in meter or as (radius, unit) tuple

  • angle – angle 1 in degrees

  • radius2 – radius 2 in meter or as (radius, unit) tuple

  • 2 (angle) – angle 2 in degrees

  • angle12 – angle 12 in degress

  • line – should be True if start or finish line

write_task(description, waypoints)

Write a task definition:

writer.write_task('500 km FAI', [
    'MEIER',
    'BRILO',
    'AILER',
    'MEIER',
])
# -> "500 km FAI","MEIER","BRILO","AILER","MEIER"

Make sure that the referenced waypoints have been written with write_waypoint() before writing the task. The task section divider will be written to automatically when write_task() is called the first time. After the first task is written write_waypoint() must not be called anymore.

Parameters:
  • description – description of the task (may be blank)

  • waypoints – list of waypoints in the task (names must match the long names of previously written waypoints)

write_task_options(**kw)

Write an options line for a task definition:

writer.write_task_options(
    start_time=time(12, 34, 56),
    task_time=timedelta(hours=1, minutes=45, seconds=12),
    waypoint_distance=False,
    distance_tolerance=(0.7, 'km'),
    altitude_tolerance=300.0,
)
# -> Options,NoStart=12:34:56,TaskTime=01:45:12,WpDis=False,NearDis=0.7km,NearAlt=300.0m
Parameters:
  • start_time – opening time of the start line as datetime.time or string

  • task_time – designated time for the task as datetime.timedelta or string

  • waypoint_distance – task distance calculation (False: use fixes, True: use waypoints)

  • distance_tolerance – distance tolerance in meters or as (distance, unit) tuple

  • altitude_tolerance – altitude tolerance in meters or as (distance, unit) tuple

  • min_distance – “uncompleted leg (False: calculate maximum distance from last observation zone)”

  • random_order – if True, then Random order of waypoints is checked

  • max_points – maximum number of points

  • before_points – number of mandatory waypoints at the beginning. 1 means start line only, 2 means start line plus first point in task sequence (Task line).

  • after_points – number of mandatory waypoints at the end. 1 means finish line only, 2 means finish line and one point before finish in task sequence (Task line).

  • bonus – bonus for crossing the finish line

write_waypoint(name, shortname, country, latitude, longitude, elevation='', style=1, runway_direction='', runway_length='', frequency='', description='', runway_width='', userdata='', pics='')

Write a waypoint:

writer.write_waypoint(
    'Meiersberg',
    'MEIER',
    'DE',
    (51 + 7.345 / 60.),
    (6 + 24.765 / 60.),
)
# -> "Meiersberg","MEIER",DE,5107.345N,00624.765E,,1,,,,
Parameters:
  • name – name of the waypoint (must not be empty)

  • shortname – short name for depending GPS devices

  • country – IANA top level domain country code (see http://www.iana.org/cctld/cctld-whois.htm)

  • latitude – latitude of the point (between -90 and 90 degrees)

  • longitude – longitude of the point (between -180 and 180 degrees)

  • elevation – elevation of the waypoint in meters or as (elevation, unit) tuple

  • style – the waypoint type (see official specification for the list of valid styles, defaults to “Normal”)

  • runway_direction – heading of the runway in degrees if the waypoint is landable

  • runway_length – length of the runway in meters or as (length, unit) tuple if the waypoint is landable

  • frequency – radio frequency of the airport

  • description – optional description of the waypoint (no length limit)

  • runway_width – width of the runway in meters or as (width, unit) tuple if the waypoint is landable

  • userdata – arbitrary string with user data (no length limit)

  • pics – list of filenames of pictures