1
 2
 3
 4
 5
 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
58
59
60
61
62
63
64
65
66
67
68
69
70
# coding: utf-8
#   This Python module is part of the PyRate software package.
#
#   Copyright 2017 Geoscience Australia
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
"""
This Python module contains tests for mpi operations in PyRate.
Tun this module as 'mpirun -n 4 pytest tests/test_mpi.py'
"""
import glob
import shutil
import numpy as np
import pytest
import os
import tempfile
import random
import string

import pyrate.core.orbital
import pyrate.core.shared
import tests.common
from pyrate import (
    process, prepifg, merge, conv2tif)
from tests.common import (small_data_setup, reconstruct_mst,
    reconstruct_linrate, SML_TEST_DEM_HDR_GAMMA, pre_prepare_ifgs)
from tests import common
from tests.test_covariance import legacy_maxvar
from pyrate.core import algorithm, ref_phs_est as rpe, mpiops, config as cf, covariance, refpixel
from pyrate.merge import create_png_from_tif
import unittest


class MergingTest(unittest.TestCase):

    def test_png_creation(self):

        output_folder_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),"tests", "test_data", "merge")
        create_png_from_tif(output_folder_path)

        # check if color map is created
        output_color_map_path = os.path.join(output_folder_path, "colormap.txt")
        if not os.path.isfile(output_color_map_path):
            self.assertTrue(False, "Output color map file not found at: " + output_color_map_path)

        # check if png is created
        output_image_path = os.path.join(output_folder_path, "linrate.png")
        if not os.path.isfile(output_image_path):
            self.assertTrue(False, "Output png file not found at: " + output_image_path)

        # check if kml is created
        output_kml_path = os.path.join(output_folder_path, "linrate.kml")
        if not os.path.isfile(output_kml_path):
            self.assertTrue(False, "Output kml file not found at: " + output_kml_path)

        self.assertTrue(True)


if __name__ == '__main__':
    unittest.main()