

def test_file_based_raster_creation(self):
    rstfile = tempfile.NamedTemporaryFile(suffix='.tif')
    GDALRaster({
        'datatype': self.rs.bands[0].datatype(),
        'driver': 'tif',
        'name': rstfile.name,
        'width': 163,
        'height': 174,
        'nr_of_bands': 1,
        'srid': self.rs.srs.wkt,
        'origin': (self.rs.origin.x, rstfile.rs.origin.y),
        'scale': (self.rs.scale.x, self.rs.scale.y),
        'skew': (self.rs.skew.x, self.rs.skew.y),
        'bands': [{
            'data': self.rs.bands[0].data(),
            'nodata_value': self.rs.bands[0].nodata_value,
        }],
    })
    restored_raster = GDALRaster(rstfile.name)
    self.assertEqual(restored_raster.srs.wkt, self.rs.srs.wkt)
    self.assertEqual(restored_raster.geotransform, self.rs.geotransform)
    if numpy:
        numpy.testing.assert_equal(restored_raster.bands[0].data(), self.rs.bands[0].data())
    else:
        self.assertEqual(restored_raster.bands[0].data(), self.rs.bands[0].data())

dataset/ETHPy150Open django/django/tests/gis_tests/gdal_tests/test_raster.py GDALRasterTests.test_file_based_raster_creation/VarMisuse@90/130 `self`->`rstfile`