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.
-
run_from_cmd
(hook=None)¶ 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).
-
stop
()¶ Stops the runner.
-
-
mpop.saturn.runner.
parse_options
()¶ Parse command line options.
-
mpop.saturn.runner.
usage
(scriptname)¶ 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
(*keys)¶ Split the tasklist along the keys parameter: keys in the first part, non keys in the second.
-
-
mpop.saturn.tasklist.
get_product_list
(satscene)¶ 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.
-
run
()¶ Execute the given function on files from the file queue.
-
stop
()¶ Stops a running process.
-
terminate
()¶ Terminate thread.
-
Earth geometry¶
Spherical geometry module.
-
class
mpop.saturn.assemble_segments.
Arc
(start, end)¶ An arc of the great circle between two points.
-
angle
(other_arc)¶ Oriented angle between two arcs.
-
center_angle
()¶ Angle of an arc at the center of the sphere.
-
end
= None¶
-
intersection
(other_arc)¶ 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.
-
intersections
(other_arc)¶ Gives the two intersections of the greats circles defined by the current arc and other_arc.
-
intersects
(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
(point)¶ cross product with another vector.
-
cross2cart
(point)¶ Compute the cross product, and convert to cartesian coordinates (assuming radius 1).
-
distance
(point)¶ Vincenty formula.
-
dot
(point)¶ dot product with another vector.
-
lat
= None¶
-
lon
= None¶
-
norm
()¶ Return the norm of the vector.
-
normalize
()¶ normalize the vector.
-
x__
= None¶
-
y__
= None¶
-
z__
= None¶
-
-
class
mpop.saturn.assemble_segments.
TestSphereGeometry
(methodName='runTest')¶ Testing sphere geometry from this module.
-
test_angle
()¶ Testing the angle value between two arcs.
-
test_inside
()¶ Testing if a point is inside for other points.
-
test_intersects
()¶ Test if two arcs intersect.
-
test_overlap_rate
()¶ Test how much two areas overlap.
-
test_overlaps
()¶ Test if two areas overlap.
-
-
mpop.saturn.assemble_segments.
get_area
(corners)¶ 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.
-
mpop.saturn.assemble_segments.
modpi
(val)¶ Puts val between -pi and pi.
-
mpop.saturn.assemble_segments.
modpi2
(val)¶ 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.