Code Launcher

Code Launcher

The Code Launcher provides programmatic access to AutoMap with a simple Python interface. Write your own script to iterate over different time ranges, areas and satellites, tag the runs with individual descriptions and easily process in bulk.

Example

For this example we assume two different areas of interest (Area1, Area2) we want to classify for April 2019 and June 2019, respectively. The area of interest files need to be uploaded to your account.


for aoi in [aois]:
    for start_date, end_date in zip(start_dates, end_dates):
        parameters = dict()
        # construct parameter dictionary here
        ...
        automap_launch(parameters)

Helper Functions

You typically want to use the code launcher for launcher runs in batches. you can easily launch batches over different regions or over different time ranges.

Iterate over regions

For this example we assume two different areas of interest (Area1, Area2). The area of interest files need to be previously uploaded to your account.


for region in ['Area1.json', 'Area2.json']:
    parameters = {...}
    parameters['boundary_file'] = region
    automap_launch(parameters)
                                    
Iterate in time

The time_range function can be used to iterate over time range.


for start_date, end_date in time_range(start, end, month, offset):
    # start (int): year of start
    # end (int): year of start
    # month (int, default=12): length of each interval in month
    # offset (int, default=0): offset of the start in days
    parameters = {...}
    automap_launch(parameters)
                                    

For example, if you want to launch run covering every month for every year from 1990 to 2020 (excluded):


for start_date, end_date in time_range(1990, 2020, month=1):
    parameters = {...}
    automap_launch(parameters)
                                    

The next example shows how to launch runs covering a full year, from july to july, from 2010 to 2019. Note that month has the default value of 12, so not required in this example Also note that leap years (+29 February) not be handled here. You could write your own python code for handling this case.


for start_date, end_date in time_range(2010, 2019, offset=182):
    parameters = {...}
    automap_launch(parameters)