コード例 #1
0
 def test_def2yaml_converter(self):
     from pyresample import parse_area_file, convert_def_to_yaml
     from pyresample.utils import is_pyproj2
     import tempfile
     def_file = os.path.join(os.path.dirname(__file__), 'test_files',
                             'areas.cfg')
     filehandle, yaml_file = tempfile.mkstemp()
     os.close(filehandle)
     try:
         convert_def_to_yaml(def_file, yaml_file)
         areas_new = set(parse_area_file(yaml_file))
         areas = parse_area_file(def_file)
         for area in areas:
             if is_pyproj2():
                 # pyproj 2.0 adds units back in
                 # pyproj <2 doesn't
                 continue
             # initialize _proj_dict
             area.proj_dict  # noqa
             area._proj_dict.pop('units', None)
         areas_old = set(areas)
         areas_new = {area.area_id: area for area in areas_new}
         areas_old = {area.area_id: area for area in areas_old}
         self.assertEqual(areas_new, areas_old)
     finally:
         os.remove(yaml_file)
コード例 #2
0
ファイル: test_utils.py プロジェクト: dph002/pyresample
 def test_def2yaml_converter(self):
     from pyresample import parse_area_file, convert_def_to_yaml
     import tempfile
     def_file = os.path.join(os.path.dirname(__file__), 'test_files', 'areas.cfg')
     filehandle, yaml_file = tempfile.mkstemp()
     os.close(filehandle)
     try:
         convert_def_to_yaml(def_file, yaml_file)
         areas_new = set(parse_area_file(yaml_file))
         areas = parse_area_file(def_file)
         for area in areas:
             area.proj_dict.pop('units', None)
         areas_old = set(areas)
         self.assertEqual(areas_new, areas_old)
     finally:
         os.remove(yaml_file)
コード例 #3
0
ファイル: test_utils.py プロジェクト: pytroll/pyresample
 def test_def2yaml_converter(self):
     from pyresample import parse_area_file, convert_def_to_yaml
     import tempfile
     def_file = os.path.join(os.path.dirname(__file__), 'test_files', 'areas.cfg')
     filehandle, yaml_file = tempfile.mkstemp()
     os.close(filehandle)
     try:
         convert_def_to_yaml(def_file, yaml_file)
         areas_new = set(parse_area_file(yaml_file))
         areas = parse_area_file(def_file)
         for area in areas:
             area.proj_dict.pop('units', None)
         areas_old = set(areas)
         self.assertEqual(areas_new, areas_old)
     finally:
         os.remove(yaml_file)
コード例 #4
0
ファイル: test_utils.py プロジェクト: pytroll/pyresample
    def test_def2yaml_converter(self):
        import tempfile

        from pyresample import convert_def_to_yaml, parse_area_file
        def_file = os.path.join(os.path.dirname(__file__), 'test_files',
                                'areas.cfg')
        filehandle, yaml_file = tempfile.mkstemp()
        os.close(filehandle)
        try:
            convert_def_to_yaml(def_file, yaml_file)
            areas_new = set(parse_area_file(yaml_file))
            areas = parse_area_file(def_file)
            areas_old = set(areas)
            areas_new = {area.area_id: area for area in areas_new}
            areas_old = {area.area_id: area for area in areas_old}
            self.assertEqual(areas_new, areas_old)
        finally:
            os.remove(yaml_file)