How to use the pyresample.image function in pyresample

To help you get started, we’ve selected a few pyresample examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pytroll / satpy / mpop / test_projector.py View on Github external
def unpatch_image():
    """Unpatching the pyresample.image module.
    """
    image.ImageContainer = image.OldImageContainer
    delattr(image, "OldImageContainer")
github pytroll / satpy / test / test_pp_core.py View on Github external
def unpatch_image():
    """Unpatching the pyresample.image module.
    """
    image.ImageContainer = image.OldImageContainer
    delattr(image, "OldImageContainer")
github pytroll / satpy / mpop / test_projector.py View on Github external
def unpatch_image():
    """Unpatching the pyresample.image module.
    """
    image.ImageContainer = image.OldImageContainer
    delattr(image, "OldImageContainer")
github pytroll / pyresample / test / test_image.py View on Github external
def test_image(self):
        data = numpy.fromfunction(lambda y, x: y*x*10**-6, (3712, 3712))
        msg_con = image.ImageContainerQuick(data, self.msg_area, segments=1)
        area_con = msg_con.resample(self.area_def)
        res = area_con.image_data
        cross_sum = res.sum()
        expected = 399936.39392500359
        self.assertAlmostEqual(cross_sum, expected, msg='ImageContainer resampling quick failed')
github pytroll / satpy / test / test_pp_core.py View on Github external
def unpatch_image():
    """Unpatching the pyresample.image module.
    """
    image.ImageContainer = image.OldImageContainer
    delattr(image, "OldImageContainer")
github pytroll / pyresample / test / test_image.py View on Github external
def test_nearest_resize(self):        
        data = numpy.fromfunction(lambda y, x: y*x*10**-6, (3712, 3712))
        msg_con = image.ImageContainerNearest(data, self.msg_area, 50000, segments=1)
        area_con = msg_con.resample(self.msg_area_resize)
        res = area_con.image_data
        cross_sum = res.sum()
        expected = 2212023.0175830
        self.assertAlmostEqual(cross_sum, expected, 
                                   msg='ImageContainer resampling nearest neighbour failed')
github jmozmoz / cloudmap / cloudmap / geo_dundee.py View on Github external
self.data = self.cut_borders(np.array(img))

        self.logger.debug("image size cut:  %s" % (self.data.shape,))

        x_size = self.data.shape[1]
        y_size = self.data.shape[0]
        proj_dict = {'a': '6378137.0', 'b': '6356752.3',
                     'lon_0': self.longitude,
                     'h': '35785831.0', 'proj': 'geos'}
        self.extent = 5568742.4 * 0.964
        area_extent = (-self.extent, -self.extent,
                       self.extent, self.extent)
        area = geometry.AreaDefinition('geo', 'geostat', 'geo',
                                       proj_dict, x_size,
                                       y_size, area_extent)
        dataIC = image.ImageContainerQuick(self.data, area)

        dataResampled = dataIC.resample(pc(self.outwidth,
                                           self.outheight))
        dataResampledImage = self.rescale(dataResampled.image_data)
        dataResampledImage = self.polar_clouds(dataResampledImage)
        weight = self.get_weight()

        self.logger.debug("image max: %d" % np.max(dataResampledImage))

        result = np.array([dataResampledImage, weight])
        return result
github pytroll / mpop / mpop / projector.py View on Github external
self._cache['index_array'])

            res = kd_tree.get_sample_from_neighbour_info('nn',
                                                         self.out_area.shape,
                                                         data,
                                                         valid_index,
                                                         valid_output_index,
                                                         index_array,
                                                         fill_value=None)

        elif self.mode == "quick":
            if not 'row_idx' in self._cache:
                self._cache['row_idx'] = self._file_cache['row_idx']
                self._cache['col_idx'] = self._file_cache['col_idx']
            row_idx, col_idx = self._cache['row_idx'], self._cache['col_idx']
            img = image.ImageContainer(data, self.in_area, fill_value=None)
            res = np.ma.array(img.get_array_from_linesample(row_idx, col_idx),
                              dtype=data.dtype)

        elif self.mode == "ewa":
            from pyresample.ewa import fornav
            # TODO: should be user configurable?
            rows_per_scan = None

            if 'ewa_cols' not in self._cache:
                self._cache['ewa_cols'] = self._file_cache['ewa_cols']
                self._cache['ewa_rows'] = self._file_cache['ewa_rows']
            num_valid_points, res = fornav(self._cache['ewa_cols'],
                                           self._cache['ewa_rows'],
                                           self.out_area, data,
                                           rows_per_scan=rows_per_scan)
github jmozmoz / cloudmap / cloudmap / polar.py View on Github external
self.data = np.array(im4)

        self.x_size = self.data.shape[1]
        self.y_size = self.data.shape[0]
        proj_dict = {'lon_0': self.longitude,
                     'lat_0': self.latitude,
                     'proj': 'stere',
                     'ellps': 'WGS84',
                     'units': 'm'}
        area = geometry.AreaDefinition('stere', 'stere', 'stere',
                                       proj_dict,
                                       self.x_size,
                                       self.y_size,
                                       self.extent)

        dataIC = image.ImageContainerQuick(self.data, area)
        dataResampled = dataIC.resample(pc(self.outwidth,
                                           self.outheight))
        dataResampledImage = self.rescale(dataResampled.image_data)
#        dataResampledImage = np.ones(shape=dataResampledImage.shape) * 1e-7

        weightResampledImage = self.get_weight()
#         weightIC = image.ImageContainerQuick(weight, area)
#         weightResampled = weightIC.resample(pc(self.outwidth,
#                                             self.outheight))
#         weightResampledImage = weightResampled.image_data
#         dataResampledImage = self.polar_clouds(dataResampledImage)

        self.logger.info("image max: %r" % np.max(dataResampledImage))

        result = np.array([dataResampledImage, weightResampledImage])
        return result