Tools for batch production

Running stuff

Batch run stuff.

class mpop.saturn.runner.SequentialRunner(satellite, instrument, tasklist, precompute=False)

Runs scenes in a sequential order, as opposed to parallelized running.


Batch run mpop.

run_from_data(tasklist=None, radius=None, hook=None)

Run on given data.

run_from_local_data(tasklist=None, extra_tags=None, hook=None)

Run on given local data (already projected).


Stops the runner.


Parse command line options.


Print usefull information for running the script.

Handling tasks

Tasklist class and helper function.

class mpop.saturn.tasklist.TaskList(product_file=None)

Defines a tasklist.

get_prerequisites(klass, area_id=None)

Get the channels we need to load to fulfill the tasklist according to methods defined in klass. If area is provided, account only for tasks on this area.

shape(klass, mode=set([]), original_areas=set([]), specific_composites=set([]))

Shape the given the tasklist according to the options.


Split the tasklist along the keys parameter: keys in the first part, non keys in the second.


Returns the tasklist corresponding to the satellite described in satscene, which can be a scene object, a list or a tuple. If the corresponding file could not be found, the function returns more generic tasklists (variant and name based, then only variant based), or None if no file can be found.

NB: the product files are looked for in the CONFIG_PATH directory.

Monitoring and processing incoming files

Watch files coming in a given directory.

class mpop.saturn.filewatcher.FileProcessor(file_queue, fun, refresh=None)

Execute fun on filenames provided by from file_queue. If refresh is a positive number, run fun every given number of seconds with None as argument.


Execute the given function on files from the file queue.


Stops a running process.


Terminate thread.

class mpop.saturn.filewatcher.FileWatcher(filename_template, file_queue, frequency)

Looks for new files, and queues them.


Run the file watcher.


Terminate thread.


Earth geometry

Spherical geometry module.

class mpop.saturn.assemble_segments.Arc(start, end)

An arc of the great circle between two points.


Oriented angle between two arcs.


Angle of an arc at the center of the sphere.

end = None

Says where, if two arcs defined by the current arc and the other_arc intersect. An arc is defined as the shortest tracks between two points.


Gives the two intersections of the greats circles defined by the current arc and other_arc.


Says if two arcs defined by the current arc and the other_arc intersect. An arc is defined as the shortest tracks between two points.

start = None
class mpop.saturn.assemble_segments.Coordinate(lat=None, lon=None, x__=None, y__=None, z__=None, R=1)

Point on earth in terms of lat and lon.


cross product with another vector.


Compute the cross product, and convert to cartesian coordinates (assuming radius 1).


Vincenty formula.


dot product with another vector.

lat = None
lon = None

Return the norm of the vector.


normalize the vector.

x__ = None
y__ = None
z__ = None
class mpop.saturn.assemble_segments.TestSphereGeometry(methodName='runTest')

Testing sphere geometry from this module.


Testing the angle value between two arcs.


Testing if a point is inside for other points.


Test if two arcs intersect.


Test how much two areas overlap.


Test if two areas overlap.


Get the area of the convex area defined by corners.

mpop.saturn.assemble_segments.get_first_intersection(b__, boundaries)

Get the first intersection on b__ with boundaries.

mpop.saturn.assemble_segments.get_intersections(b__, boundaries)

Get the intersections of b__ with boundaries. Returns both the intersection coordinates and the concerned boundaries.

mpop.saturn.assemble_segments.get_next_intersection(p__, b__, boundaries)

Get the next intersection from the intersection of arcs p__ and b__ along segment b__ with boundaries.

mpop.saturn.assemble_segments.min_distances(area_corners, segment_corners)

Min distances between each corner of area_corners and segment_corners.


Puts val between -pi and pi.


Puts val between 0 and 2pi.

mpop.saturn.assemble_segments.overlap_rate(swath_corners, area_corners)

Get how much a swath overlaps an area.

mpop.saturn.assemble_segments.overlaps(area_corners, segment_corners)

Are two areas overlapping ? This uses great circle arcs as area boundaries.

mpop.saturn.assemble_segments.point_inside(point, corners)

Is a point inside the 4 corners ? This uses great circle arcs as area boundaries.

mpop.saturn.assemble_segments.polygon(area_corners, segment_corners)

Get the intersection polygon between two areas.

mpop.saturn.assemble_segments.should_wait(area_corners, segment_corners, previous_segment_corners)

Are the newest cornest still inside the area ? is the last segment boundary overlapping any boundary of the area ? In this case we should wait for the next segment to arrive.