Exemple #1
0
    def frToTEC(self, date, corners, lookAngle, lookDirection, fc):
        """
        Given a list of geodetic coordinates, a list of lookAngles and a list of lookDirections,
        calculate the average value of the B-field in the radar line-of-sight. Look angles are
        calculated in degrees from the nadir and look directions are calculated in degrees from
        the perpendicular to the flight direction.

        @param date (\a datetime.datetime) the date on which to calculate the B-field
        @param corners (\a list) a list of Location.Coordinate objects specifying the corners of the radar image
        @param lookAngle (\a list) a list of the look angles (in degrees) to each corner of the radar image
        @param lookDirection (\a list) a list of the look directions (in degrees) to each corner of the radar image
        @param fc (\a float) the radar carrier frequency in Hz
        @return (\a float) the mean value of the B-field in the look direction of the radar in gauss
        """
        kdotb = []
        # Calculate the integrated B vector for each of the four corners of the interferogram
        # Need to get the date from any of the Frame objects associated with one of the polarities
        for i, coordinate in enumerate(corners):
            k = self._calculateLookVector(lookAngle[i], lookDirection[i])
            kdotb.append(self._integrateBVector(date, coordinate, k))

        # Use this value to convert from Faraday rotation to TEC
        meankdotb = MM.mean(kdotb)
        self.logger.info("Creating TEC Map")
        self._scaleFRToTEC(meankdotb, fc)

        # Create a resource file for the TEC output file
        rsc = ResourceFile(self.tecOutput + '.rsc')
        rsc.write('WIDTH', self.samples)
        rsc.write('FILE_LENGTH', self.lines)
        rsc.write('MEAN_K_DOT_B', meankdotb)
        rsc.write('LOOK_DIRECTION', lookDirection[0])
        for i in range(len(corners)):
            lattag = 'LAT_CORNER_' + str((i + 1))
            lontag = 'LON_CORNER_' + str((i + 1))
            looktag = 'LOOK_ANGLE_' + str((i + 1))
            rsc.write(lattag, corners[i].getLatitude())
            rsc.write(lontag, corners[i].getLongitude())
            rsc.write(looktag, lookAngle[i])
        rsc.close()

        return meankdotb
Exemple #2
0
    def _integrateBVector(self, date, coordinate, k):
        """
        Integrate the B-field estimates through the ionosphere at the specified date and location

        @param date (\a datetime.datetime) date at which to calculate the B-field
        @param coordinate (\a isceobj.Location.Coordinate) the coordinate at which to calculate the B-field.
        @param k (\a list) the look vector of the radar
        @return (\a float) the integrated value of the B-field at the specified date and location in gauss
        """

        kdotb = []
        n_altitude = int((self.top - self.bottom) / self.step) + 1
        altitude = [self.bottom + i * self.step for i in range(n_altitude)]
        for h in altitude:
            coordinate.setHeight(h)
            bvector = self._calculateBVector(date, coordinate)
            kdotb.append(MM.dotProduct(k, bvector))

        meankdotb = MM.mean(kdotb)

        return meankdotb
 def testMean(self):
     ans = 2
     mean = MM.mean(self.V)
     self.assertAlmostEquals(mean, ans)