def __init__(self, aoi, sat, instrument="AVHRR"):
     OrbitalLayer.__init__(self,aoi,sat,instrument)
     # instantiate orbital module
     
     config_file_path = ""
     try:
         config_file_path = os.environ['PYGRANULE_CONFIG_PATH']
     except KeyError:
         print "pygranule config file path missing.  Has the 'PYGRANULE_CONFIG_PATH' environment variable been set?"
     
     default_tle_file = config_file_path+"/default.tle"
     
     try:
         self.orbital = Orbital(sat,default_tle_file)
     except:
         print "Failed to open default tle file:", default_tle_file
         print "Downloading from internet:"
         try:
             self.orbital = Orbital(sat)
         except:
             raise OrbitalLayerError("Pyorbital Failed to fetch TLE from internet.")
             
     # create scan geometry - one scan line.
     if instrument == "AVHRR":
         scan_steps = np.arange(0,self.instrument_info['scan_steps'],self.instrument_info['scan_steps']/8-1)
         scan_steps[-1] = self.instrument_info['scan_steps']-1
         self.scan_geom = avhrr(1,scan_steps)
     elif instrument == "VIIRS":
         self.scan_geom = viirs(1)
Exemple #2
0
    def __init__(self, aoi, sat, instrument="AVHRR"):
        OrbitalLayer.__init__(self, aoi, sat, instrument)
        # instantiate orbital module

        config_file_path = ""
        try:
            config_file_path = os.environ['PYGRANULE_CONFIG_PATH']
        except KeyError:
            print "pygranule config file path missing.  Has the 'PYGRANULE_CONFIG_PATH' environment variable been set?"

        default_tle_file = config_file_path + "/default.tle"

        try:
            self.orbital = Orbital(sat, default_tle_file)
        except:
            print "Failed to open default tle file:", default_tle_file
            print "Downloading from internet:"
            try:
                self.orbital = Orbital(sat)
            except:
                raise OrbitalLayerError(
                    "Pyorbital Failed to fetch TLE from internet.")

        # create scan geometry - one scan line.
        if instrument == "AVHRR":
            scan_steps = np.arange(0, self.instrument_info['scan_steps'],
                                   self.instrument_info['scan_steps'] / 8 - 1)
            scan_steps[-1] = self.instrument_info['scan_steps'] - 1
            self.scan_geom = avhrr(1, scan_steps)
        elif instrument == "VIIRS":
            self.scan_geom = viirs(1)
    def test_viirs(self):
        """Test the definition of the viirs instrument
        """
        geom = viirs(1, np.array([0, 3200, 6399]))
        expected_fovs = np.array([
            np.tile(np.array([[0.98, -0., -0.98]]), [32, 1]),
            np.tile(np.array([[0., -0., 0]]), [32, 1])], dtype=np.float)

        self.assertTrue(np.allclose(geom.fovs,
                                    expected_fovs, rtol=1e-2, atol=1e-2))

        geom = viirs(2, np.array([0, 3200, 6399]))
        expected_fovs = np.array([
            np.tile(np.array([[0.98, -0., -0.98]]), [32*2, 1]),
            np.tile(np.array([[0., -0., 0]]), [32*2, 1])], dtype=np.float)

        self.assertTrue(np.allclose(geom.fovs,
                                    expected_fovs, rtol=1e-2, atol=1e-2))
Exemple #4
0
    def test_viirs(self):
        """Test the definition of the viirs instrument
        """
        geom = viirs(1, np.array([0, 3200, 6399]))
        expected_fovs = np.array([
            np.tile(np.array([[0.98, -0., -0.98]]), [32, 1]),
            np.tile(np.array([[0., -0., 0]]), [32, 1])], dtype=np.float)

        self.assertTrue(np.allclose(geom.fovs,
                                    expected_fovs, rtol=1e-2, atol=1e-2))

        geom = viirs(2, np.array([0, 3200, 6399]))
        expected_fovs = np.array([
            np.tile(np.array([[0.98, -0., -0.98]]), [32*2, 1]),
            np.tile(np.array([[0., -0., 0]]), [32*2, 1])], dtype=np.float)

        self.assertTrue(np.allclose(geom.fovs,
                                    expected_fovs, rtol=1e-2, atol=1e-2))