#!/usr/bin/env python
# coding: utf-8

from multiprocessing import Pool
import sys

from smartcarb.orbit import compute_orbit

import config

def pool_function(a):
    compute_orbit(*a)


if __name__ == '__main__':

    # orbit_numbers:
    #  - 0-412 for Sentinel-5
    #  - 0-164 for Sentinel-7_*
    name = sys.argv[1]
    start = int(sys.argv[2])
    stop = int(sys.argv[3])
    long_eq = int(sys.argv[4])

    args = []
    for long_eq in [0, 90, 180, 270]:
        args += [(name, number, long_eq, config.path_orbits) for number in range(start, stop)]

    pool = Pool(processes=config.nproc)
    pool.map(pool_function, args)

