/usr/lib/python2.7/dist-packages/rasterio/profiles.py is in python-rasterio 0.36.0-2build5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | """Raster dataset profiles."""
from rasterio.dtypes import uint8
class Profile:
"""Base class for Rasterio dataset profiles.
Subclasses will declare a format driver and driver-specific
creation options.
"""
driver = None
defaults = {}
def __call__(self, **kwargs):
"""Return a mapping of keyword args for writing a new datasets.
Example:
profile = SomeProfile()
with rasterio.open('foo.tif', 'w', **profile()) as dst:
# Write data ...
"""
if kwargs.get('driver', self.driver) != self.driver:
raise ValueError(
"Overriding this profile's driver is not allowed.")
profile = self.defaults.copy()
profile.update(**kwargs)
profile['driver'] = self.driver
return profile
class DefaultGTiffProfile(Profile):
"""A tiled, band-interleaved, LZW-compressed, 8-bit GTiff profile."""
driver = 'GTiff'
defaults = {
'interleave': 'band',
'tiled': True,
'blockxsize': 256,
'blockysize': 256,
'compress': 'lzw',
'nodata': 0,
'dtype': uint8
}
default_gtiff_profile = DefaultGTiffProfile()
|