Beispiel #1
0
    def test_plot_agulhas(self):
        '''
        Tests the SARWind.plot method. Remember to update the file
        basic_agulhas_ref.png if plot method is changed.

        If adding more test plots, please make sure the indices are correct
        '''
        if len(self.test_data.asar) == 0:
            raise IOError('No ASAR data - try adding some as ' \
                    'described in templates/openwind_local_archive.py' )
        w = SARWind(self.test_data.asar[0],
                    wind_direction=self.test_data.ncep4asar[0])
        w.plot(filename=os.path.join(dirname_test_plots,
                                     'agulhas_test_plot.png'),
               show=False,
               landmask=False)

        if sys.version_info < (2, 7):
            self.assertTrue(
                filecmp.cmp(
                    os.path.join(dirname_test_plots, 'agulhas_test_plot.png'),
                    os.path.join(dirname_test_plots,
                                 'agulhas_test_plot_ref.png')) in [True])
        else:
            self.assertTrue(
                filecmp.cmp(
                    os.path.join(dirname_test_plots, 'agulhas_test_plot.png'),
                    os.path.join(dirname_test_plots,
                                 'agulhas_test_plot_ref.png')))
Beispiel #2
0
 def test_plot_barents(self):
     if len(self.test_data.radarsat2)==0:
         raise IOError('No Radarsat-2 data - try adding some as ' \
                 'described in templates/openwind_local_archive.py' )
     w = SARWind(self.test_data.radarsat2[0])
     w.plot(filename=os.path.join(dirname_test_plots,
         'rs2_barents_test_plot.png'), show=False, landmask=False)
     if sys.version_info < (2, 7):
         self.assertTrue(filecmp.cmp(
             os.path.join(dirname_test_plots, 'rs2_barents_test_plot.png'),
             os.path.join(dirname_test_plots, 'rs2_barents_test_plot_ref.png'))
             in [True])
     else:
         self.assertTrue(filecmp.cmp(
             os.path.join(dirname_test_plots,'rs2_barents_test_plot.png'),
             os.path.join(dirname_test_plots,'rs2_barents_test_plot_ref.png')))
Beispiel #3
0
 def test_sarwind_using_asar_filename_ncep_nansat(self):
     if len(self.test_data.asar) == 0:
         raise IOError('No ASAR data - try adding some as ' \
                 'described in templates/openwind_local_archive.py' )
     for key in self.test_data.asar:
         mw = Nansat(self.test_data.ncep4asar[key])
         w = SARWind(self.test_data.asar[key], wind_direction=mw)
         self.assertIsInstance(w, SARWind)
Beispiel #4
0
 def test_sarwind_using_default(self):
     if len(self.test_data.radarsat2) == 0:
         raise IOError('No Radarsat-2 data - try adding some as ' \
                 'described in templates/openwind_local_archive.py' )
     for i in range(len(self.test_data.radarsat2)):
         w = SARWind(self.test_data.radarsat2[i])
     if sys.version_info < (2, 7):
         type(w) == SARWind
     else:
         self.assertIsInstance(w, SARWind)
Beispiel #5
0
 def test_sarwind_using_asar_nansat_ncep_filename(self):
     if len(self.test_data.asar) == 0:
         raise IOError('No ASAR data - try adding some as ' \
                 'described in templates/openwind_local_archive.py' )
     for i in self.test_data.asar:
         asar = Nansat(self.test_data.asar[i])
         w = SARWind(asar, wind_direction=self.test_data.ncep4asar[i])
     if sys.version_info < (2, 7):
         type(w) == SARWind
     else:
         self.assertIsInstance(w, SARWind)
Beispiel #6
0
 def test_plot_barents(self):
     if len(self.test_data.radarsat2) == 0:
         raise IOError('No Radarsat-2 data - try adding some as ' \
                 'described in templates/openwind_local_archive.py' )
     w = SARWind(self.test_data.radarsat2[0])
     w.plot(filename=os.path.join(dirname_test_plots,
                                  'rs2_barents_test_plot.png'),
            show=False,
            landmask=False)
     if sys.version_info < (2, 7):
         self.assertTrue(
             filecmp.cmp(
                 os.path.join(dirname_test_plots,
                              'rs2_barents_test_plot.png'),
                 os.path.join(dirname_test_plots,
                              'rs2_barents_test_plot_ref.png')) in [True])
     else:
         self.assertTrue(
             filecmp.cmp(
                 os.path.join(dirname_test_plots,
                              'rs2_barents_test_plot.png'),
                 os.path.join(dirname_test_plots,
                              'rs2_barents_test_plot_ref.png')))
Beispiel #7
0
    def test_plot_agulhas(self):
        '''
        Tests the SARWind.plot method. Remember to update the file
        basic_agulhas_ref.png if plot method is changed.

        If adding more test plots, please make sure the indices are correct
        '''
        if len(self.test_data.asar)==0:
            raise IOError('No ASAR data - try adding some as ' \
                    'described in templates/openwind_local_archive.py' )
        w = SARWind(self.test_data.asar[0],
                wind_direction=self.test_data.ncep4asar[0])
        w.plot(filename=os.path.join(dirname_test_plots,
            'agulhas_test_plot.png'), show=False, landmask=False)

        if sys.version_info < (2, 7):
            self.assertTrue(filecmp.cmp(
                os.path.join(dirname_test_plots,'agulhas_test_plot.png'),
                os.path.join(dirname_test_plots,'agulhas_test_plot_ref.png'))
                in [True])
        else:
            self.assertTrue(filecmp.cmp(
                os.path.join(dirname_test_plots,'agulhas_test_plot.png'),
                os.path.join(dirname_test_plots,'agulhas_test_plot_ref.png')))