Exemple #1
0
    def extractTracks(self, index, lon, lat):
        """
        Extract tracks that only *start* within the pre-defined domain.
        The function returns the indices of the tracks that begin within
        the domain.
        """
        outIndex = []
        flag = 0
        for i in xrange(len(index)):
            if index[i] == 1:
                # A new track:
                if (stats.between(lon[i], self.domain['xMin'], self.domain['xMax']) &
                        stats.between(lat[i], self.domain['yMin'], self.domain['yMax'])):
                    # We have a track starting within the spatial domain:
                    outIndex.append(i)
                    flag = 1
                else:
                    flag = 0
            else:
                if flag == 1:
                    outIndex.append(i)
                else:
                    pass

        return outIndex
Exemple #2
0
    def extractTracks(self, index, lon, lat):
        """
        Extract tracks that only *start* within the pre-defined domain.
        The function returns the indices of the tracks that begin within
        the domain.

        :param index: indicator of initial positions of TCs (1 = new TC,
                      0 = continuation of previous TC).
        :param lon: longitudes of TC positions
        :param lat: latitudes of TC positions

        :type index: `numpy.ndarray`
        :type lon: `numpy.ndarray`
        :type lat: `numpy.ndarray`

        :returns: indices corresponding to all points of all tracks that
                  form within the model domain
        :rtype: `numpy.ndarray`

        """
        outIndex = []
        flag = 0
        for i in xrange(len(index)):
            if index[i] == 1:
                # A new track:
                if (stats.between(lon[i], self.domain['xMin'],
                                  self.domain['xMax'])
                        & stats.between(lat[i], self.domain['yMin'],
                                        self.domain['yMax'])):
                    # We have a track starting within the spatial domain:
                    outIndex.append(i)
                    flag = 1
                else:
                    flag = 0
            else:
                if flag == 1:
                    outIndex.append(i)
                else:
                    pass

        return outIndex
Exemple #3
0
    def extractTracks(self, index, lon, lat):
        """
        Extract tracks that only *start* within the pre-defined domain.
        The function returns the indices of the tracks that begin within
        the domain.

        :param index: indicator of initial positions of TCs (1 = new TC,
                      0 = continuation of previous TC).
        :param lon: longitudes of TC positions
        :param lat: latitudes of TC positions

        :type index: `numpy.ndarray`
        :type lon: `numpy.ndarray`
        :type lat: `numpy.ndarray`

        :returns: indices corresponding to all points of all tracks that
                  form within the model domain
        :rtype: `numpy.ndarray`
        
        """
        outIndex = []
        flag = 0
        for i in xrange(len(index)):
            if index[i] == 1:
                # A new track:
                if (stats.between(lon[i], self.domain['xMin'], self.domain['xMax']) &
                        stats.between(lat[i], self.domain['yMin'], self.domain['yMax'])):
                    # We have a track starting within the spatial domain:
                    outIndex.append(i)
                    flag = 1
                else:
                    flag = 0
            else:
                if flag == 1:
                    outIndex.append(i)
                else:
                    pass

        return outIndex