Skip to content

fusion module

run_fusion(stations, path, method, noise)

The library is based on geodetic observations stored in the form of text files. Maintenance of the specific structure for all input files is necessary to ensure the successful completion of the integration procedure.

Important remarks: 1. The integration procedure can include a single station folder (e.g., stations = ["ID01"]) stored in the path, a list of stations (e.g., stations = ["ID01", "ID02", "POINT_5"]) or ALL of them (stations = "ALL"). 2. For each particular station's folder, it is necessary to store the geodetic data in the ASCII files (see Input). 3. Every ASCII file stored in the station's folder will be included in the integration procedure with respect to the chosen method ("forward" or "forward-backward"). 4. The noise level expressed as acceleration in mm/day^2^ should by assigned by user in the empirical way. 5. In the library, the zero-mean acceleration model is introduced as the system noise matrix (Teunissen, 2009).

Teunissen, P. (2009). Dynamic data processing: Recursive least-squares.

Parameters:

Name Type Description Default
stations list or str

List of station names or "ALL" to process all stations found in the specified path.

required
path str

Path to the directory containing station data.

required
method str

Fusion method. Options are "forward" or "forward-backward".

required
noise float

Noise level of the integration system [mm/day^2].

required

Raises:

Type Description
ValueError

If an invalid method is provided.

Returns:

Name Type Description
integration_results dict

DataIntegration objects

Source code in multidefusion\fusion.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
def run_fusion(stations, path, method, noise):
    """
    The library is based on geodetic observations stored in the form of text files. Maintenance of the specific structure for all input files is necessary to ensure the successful completion of the integration procedure. 

    Important remarks:
    1. The integration procedure can include a single station folder (e.g., stations = ["ID01"]) stored in the path, a list of stations (e.g., stations = ["ID01", "ID02", "POINT_5"]) or ALL of them (stations = "ALL").
    2. For each particular station's folder, it is necessary to store the geodetic data in the ASCII files (see [Input](https://damiantondas.github.io/multidefusion/input/)).
    3. Every ASCII file stored in the station's folder will be included in the integration procedure with respect to the chosen method ("forward" or "forward-backward").
    4. The noise level expressed as acceleration in mm/day^2^ should by assigned by user in the empirical way.
    5. In the library, the zero-mean acceleration model is introduced as the system noise matrix (Teunissen, 2009).

    Teunissen, P. (2009). Dynamic data processing: Recursive least-squares.

    Args:
        stations (list or str): List of station names or "ALL" to process all stations found in the specified path.
        path (str): Path to the directory containing station data.
        method (str): Fusion method. Options are "forward" or "forward-backward".
        noise (float): Noise level of the integration system [mm/day^2].

    Raises:
        ValueError: If an invalid method is provided.

    Returns:
        integration_results (dict): DataIntegration objects
    """
    port = 8049
    integration_results = {}
    if stations == "ALL":
        stations = [f.name for f in os.scandir(path) if f.is_dir()]
    for station in stations:
        print(f"\n___________________________________________________________\nFusion started for station: {station}\n")
        print(f"Kalman {method} integration procedure in progress.")
        port +=1
        integration = DataIntegration(station_name=station, path=path, noise=noise, port=port)
        integration.connect_data()
        try:
            if method == "forward":
                integration.kalman_forward()
            elif method == "forward-backward":
                integration.kalman_forward_backward() 
            else:
                raise ValueError(f"Invalid method '{method}'. Please enter 'forward' or 'forward-backward'.")
            integration.compute_mean_LOS_orbit()
            integration_results[station] = integration

            fig = Figures(integration)
            fig.create_displacement_plot()

        except ValueError as e:
            print(e)

    return integration_results