partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | Client.get_stream | :py:func:`asyncio.coroutine`
Create :py:class:`aioftp.DataConnectionThrottleStreamIO` for straight
read/write io.
:param command_args: arguments for :py:meth:`aioftp.Client.command`
:param conn_type: connection type ("I", "A", "E", "L")
:type conn_type: :py:class:`str`
... | aioftp/client.py | async def get_stream(self, *command_args, conn_type="I", offset=0):
"""
:py:func:`asyncio.coroutine`
Create :py:class:`aioftp.DataConnectionThrottleStreamIO` for straight
read/write io.
:param command_args: arguments for :py:meth:`aioftp.Client.command`
:param conn_typ... | async def get_stream(self, *command_args, conn_type="I", offset=0):
"""
:py:func:`asyncio.coroutine`
Create :py:class:`aioftp.DataConnectionThrottleStreamIO` for straight
read/write io.
:param command_args: arguments for :py:meth:`aioftp.Client.command`
:param conn_typ... | [
":",
"py",
":",
"func",
":",
"asyncio",
".",
"coroutine"
] | aio-libs/aioftp | python | https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L1088-L1116 | [
"async",
"def",
"get_stream",
"(",
"self",
",",
"*",
"command_args",
",",
"conn_type",
"=",
"\"I\"",
",",
"offset",
"=",
"0",
")",
":",
"reader",
",",
"writer",
"=",
"await",
"self",
".",
"get_passive_connection",
"(",
"conn_type",
")",
"if",
"offset",
"... | b45395b1aba41301b898040acade7010e6878a08 |
valid | jenks_breaks | Compute jenks natural breaks on a sequence of `values`, given `nb_class`,
the number of desired class.
Parameters
----------
values : array-like
The Iterable sequence of numbers (integer/float) to be used.
nb_class : int
The desired number of class (as some other functions requests
... | jenkspy/core.py | def jenks_breaks(values, nb_class):
"""
Compute jenks natural breaks on a sequence of `values`, given `nb_class`,
the number of desired class.
Parameters
----------
values : array-like
The Iterable sequence of numbers (integer/float) to be used.
nb_class : int
The desired nu... | def jenks_breaks(values, nb_class):
"""
Compute jenks natural breaks on a sequence of `values`, given `nb_class`,
the number of desired class.
Parameters
----------
values : array-like
The Iterable sequence of numbers (integer/float) to be used.
nb_class : int
The desired nu... | [
"Compute",
"jenks",
"natural",
"breaks",
"on",
"a",
"sequence",
"of",
"values",
"given",
"nb_class",
"the",
"number",
"of",
"desired",
"class",
"."
] | mthh/jenkspy | python | https://github.com/mthh/jenkspy/blob/f57c0149e1d4dfd2369270ace55981fcf55f699b/jenkspy/core.py#L15-L72 | [
"def",
"jenks_breaks",
"(",
"values",
",",
"nb_class",
")",
":",
"if",
"not",
"isinstance",
"(",
"values",
",",
"Iterable",
")",
"or",
"isinstance",
"(",
"values",
",",
"(",
"str",
",",
"bytes",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"A sequence of ... | f57c0149e1d4dfd2369270ace55981fcf55f699b |
valid | GtkPixbufWrapper.grab_to_file | http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html.
only "jpeg" or "png" | pyscreenshot/plugins/gtkpixbuf.py | def grab_to_file(self, filename, bbox=None):
"""http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html.
only "jpeg" or "png"
"""
w = self.gtk.gdk.get_default_root_window()
# Capture the whole screen.
if bbox is None:
sz = w.get_size()
pb = self.gtk.g... | def grab_to_file(self, filename, bbox=None):
"""http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html.
only "jpeg" or "png"
"""
w = self.gtk.gdk.get_default_root_window()
# Capture the whole screen.
if bbox is None:
sz = w.get_size()
pb = self.gtk.g... | [
"http",
":",
"//",
"www",
".",
"pygtk",
".",
"org",
"/",
"docs",
"/",
"pygtk",
"/",
"class",
"-",
"gdkpixbuf",
".",
"html",
"."
] | ponty/pyscreenshot | python | https://github.com/ponty/pyscreenshot/blob/51010195cbb5361dcd4b414ff132b87244c9e1cb/pyscreenshot/plugins/gtkpixbuf.py#L30-L56 | [
"def",
"grab_to_file",
"(",
"self",
",",
"filename",
",",
"bbox",
"=",
"None",
")",
":",
"w",
"=",
"self",
".",
"gtk",
".",
"gdk",
".",
"get_default_root_window",
"(",
")",
"# Capture the whole screen.",
"if",
"bbox",
"is",
"None",
":",
"sz",
"=",
... | 51010195cbb5361dcd4b414ff132b87244c9e1cb |
valid | Gdk3PixbufWrapper.grab | Grabs an image directly to a buffer.
:param bbox: Optional tuple or list containing (x1, y1, x2, y2) coordinates
of sub-region to capture.
:return: PIL RGB image
:raises: ValueError, if image data does not have 3 channels (RGB), each with 8
bits.
:rtype: Image | pyscreenshot/plugins/gdk3pixbuf.py | def grab(self, bbox=None):
"""Grabs an image directly to a buffer.
:param bbox: Optional tuple or list containing (x1, y1, x2, y2) coordinates
of sub-region to capture.
:return: PIL RGB image
:raises: ValueError, if image data does not have 3 channels (RGB), each with 8
... | def grab(self, bbox=None):
"""Grabs an image directly to a buffer.
:param bbox: Optional tuple or list containing (x1, y1, x2, y2) coordinates
of sub-region to capture.
:return: PIL RGB image
:raises: ValueError, if image data does not have 3 channels (RGB), each with 8
... | [
"Grabs",
"an",
"image",
"directly",
"to",
"a",
"buffer",
"."
] | ponty/pyscreenshot | python | https://github.com/ponty/pyscreenshot/blob/51010195cbb5361dcd4b414ff132b87244c9e1cb/pyscreenshot/plugins/gdk3pixbuf.py#L33-L63 | [
"def",
"grab",
"(",
"self",
",",
"bbox",
"=",
"None",
")",
":",
"w",
"=",
"Gdk",
".",
"get_default_root_window",
"(",
")",
"if",
"bbox",
"is",
"not",
"None",
":",
"g",
"=",
"[",
"bbox",
"[",
"0",
"]",
",",
"bbox",
"[",
"1",
"]",
",",
"bbox",
... | 51010195cbb5361dcd4b414ff132b87244c9e1cb |
valid | grab | Copy the contents of the screen to PIL image memory.
:param bbox: optional bounding box (x1,y1,x2,y2)
:param childprocess: pyscreenshot can cause an error,
if it is used on more different virtual displays
and back-end is not in different process.
Some back-ends are always di... | pyscreenshot/__init__.py | def grab(bbox=None, childprocess=None, backend=None):
"""Copy the contents of the screen to PIL image memory.
:param bbox: optional bounding box (x1,y1,x2,y2)
:param childprocess: pyscreenshot can cause an error,
if it is used on more different virtual displays
and back-end is not i... | def grab(bbox=None, childprocess=None, backend=None):
"""Copy the contents of the screen to PIL image memory.
:param bbox: optional bounding box (x1,y1,x2,y2)
:param childprocess: pyscreenshot can cause an error,
if it is used on more different virtual displays
and back-end is not i... | [
"Copy",
"the",
"contents",
"of",
"the",
"screen",
"to",
"PIL",
"image",
"memory",
"."
] | ponty/pyscreenshot | python | https://github.com/ponty/pyscreenshot/blob/51010195cbb5361dcd4b414ff132b87244c9e1cb/pyscreenshot/__init__.py#L51-L67 | [
"def",
"grab",
"(",
"bbox",
"=",
"None",
",",
"childprocess",
"=",
"None",
",",
"backend",
"=",
"None",
")",
":",
"if",
"childprocess",
"is",
"None",
":",
"childprocess",
"=",
"childprocess_default_value",
"(",
")",
"return",
"_grab",
"(",
"to_file",
"=",
... | 51010195cbb5361dcd4b414ff132b87244c9e1cb |
valid | grab_to_file | Copy the contents of the screen to a file. Internal function! Use
PIL.Image.save() for saving image to file.
:param filename: file for saving
:param childprocess: see :py:func:`grab`
:param backend: see :py:func:`grab` | pyscreenshot/__init__.py | def grab_to_file(filename, childprocess=None, backend=None):
"""Copy the contents of the screen to a file. Internal function! Use
PIL.Image.save() for saving image to file.
:param filename: file for saving
:param childprocess: see :py:func:`grab`
:param backend: see :py:func:`grab`
"""
if c... | def grab_to_file(filename, childprocess=None, backend=None):
"""Copy the contents of the screen to a file. Internal function! Use
PIL.Image.save() for saving image to file.
:param filename: file for saving
:param childprocess: see :py:func:`grab`
:param backend: see :py:func:`grab`
"""
if c... | [
"Copy",
"the",
"contents",
"of",
"the",
"screen",
"to",
"a",
"file",
".",
"Internal",
"function!",
"Use",
"PIL",
".",
"Image",
".",
"save",
"()",
"for",
"saving",
"image",
"to",
"file",
"."
] | ponty/pyscreenshot | python | https://github.com/ponty/pyscreenshot/blob/51010195cbb5361dcd4b414ff132b87244c9e1cb/pyscreenshot/__init__.py#L70-L81 | [
"def",
"grab_to_file",
"(",
"filename",
",",
"childprocess",
"=",
"None",
",",
"backend",
"=",
"None",
")",
":",
"if",
"childprocess",
"is",
"None",
":",
"childprocess",
"=",
"childprocess_default_value",
"(",
")",
"return",
"_grab",
"(",
"to_file",
"=",
"Tr... | 51010195cbb5361dcd4b414ff132b87244c9e1cb |
valid | backend_version | Back-end version.
:param backend: back-end (examples:scrot, wx,..)
:param childprocess: see :py:func:`grab`
:return: version as string | pyscreenshot/__init__.py | def backend_version(backend, childprocess=None):
"""Back-end version.
:param backend: back-end (examples:scrot, wx,..)
:param childprocess: see :py:func:`grab`
:return: version as string
"""
if childprocess is None:
childprocess = childprocess_default_value()
if not childprocess:
... | def backend_version(backend, childprocess=None):
"""Back-end version.
:param backend: back-end (examples:scrot, wx,..)
:param childprocess: see :py:func:`grab`
:return: version as string
"""
if childprocess is None:
childprocess = childprocess_default_value()
if not childprocess:
... | [
"Back",
"-",
"end",
"version",
"."
] | ponty/pyscreenshot | python | https://github.com/ponty/pyscreenshot/blob/51010195cbb5361dcd4b414ff132b87244c9e1cb/pyscreenshot/__init__.py#L103-L115 | [
"def",
"backend_version",
"(",
"backend",
",",
"childprocess",
"=",
"None",
")",
":",
"if",
"childprocess",
"is",
"None",
":",
"childprocess",
"=",
"childprocess_default_value",
"(",
")",
"if",
"not",
"childprocess",
":",
"return",
"_backend_version",
"(",
"back... | 51010195cbb5361dcd4b414ff132b87244c9e1cb |
valid | OutputData.write | Write data from process tiles into PNG file(s).
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid`` | mapchete/formats/default/png_hillshade.py | def write(self, process_tile, data):
"""
Write data from process tiles into PNG file(s).
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
"""
data = self._prepare_array(data)
if data.mask.all():
... | def write(self, process_tile, data):
"""
Write data from process tiles into PNG file(s).
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
"""
data = self._prepare_array(data)
if data.mask.all():
... | [
"Write",
"data",
"from",
"process",
"tiles",
"into",
"PNG",
"file",
"(",
"s",
")",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/png_hillshade.py#L99-L128 | [
"def",
"write",
"(",
"self",
",",
"process_tile",
",",
"data",
")",
":",
"data",
"=",
"self",
".",
"_prepare_array",
"(",
"data",
")",
"if",
"data",
".",
"mask",
".",
"all",
"(",
")",
":",
"logger",
".",
"debug",
"(",
"\"data empty, nothing to write\"",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.read | Read existing process output.
Parameters
----------
output_tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
process output : ``BufferedTile`` with appended data | mapchete/formats/default/png_hillshade.py | def read(self, output_tile, **kwargs):
"""
Read existing process output.
Parameters
----------
output_tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
process output : ``BufferedTile`` with appended data
... | def read(self, output_tile, **kwargs):
"""
Read existing process output.
Parameters
----------
output_tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
process output : ``BufferedTile`` with appended data
... | [
"Read",
"existing",
"process",
"output",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/png_hillshade.py#L130-L151 | [
"def",
"read",
"(",
"self",
",",
"output_tile",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"ma",
".",
"masked_values",
"(",
"read_raster_no_crs",
"(",
"self",
".",
"get_path",
"(",
"output_tile",
")",
",",
"indexes",
"=",
"(",
"4",
"if",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.profile | Create a metadata dictionary for rasterio.
Parameters
----------
tile : ``BufferedTile``
Returns
-------
metadata : dictionary
output profile dictionary used for rasterio. | mapchete/formats/default/png_hillshade.py | def profile(self, tile=None):
"""
Create a metadata dictionary for rasterio.
Parameters
----------
tile : ``BufferedTile``
Returns
-------
metadata : dictionary
output profile dictionary used for rasterio.
"""
dst_metadata = d... | def profile(self, tile=None):
"""
Create a metadata dictionary for rasterio.
Parameters
----------
tile : ``BufferedTile``
Returns
-------
metadata : dictionary
output profile dictionary used for rasterio.
"""
dst_metadata = d... | [
"Create",
"a",
"metadata",
"dictionary",
"for",
"rasterio",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/png_hillshade.py#L168-L189 | [
"def",
"profile",
"(",
"self",
",",
"tile",
"=",
"None",
")",
":",
"dst_metadata",
"=",
"dict",
"(",
"self",
".",
"_profile",
")",
"if",
"tile",
"is",
"not",
"None",
":",
"dst_metadata",
".",
"update",
"(",
"width",
"=",
"tile",
".",
"width",
",",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | open | Open a Mapchete process.
Parameters
----------
config : MapcheteConfig object, config dict or path to mapchete file
Mapchete process configuration
mode : string
* ``memory``: Generate process output on demand without reading
pre-existing data or writing new data.
* ``r... | mapchete/_core.py | def open(
config, mode="continue", zoom=None, bounds=None, single_input_file=None,
with_cache=False, debug=False
):
"""
Open a Mapchete process.
Parameters
----------
config : MapcheteConfig object, config dict or path to mapchete file
Mapchete process configuration
mode : strin... | def open(
config, mode="continue", zoom=None, bounds=None, single_input_file=None,
with_cache=False, debug=False
):
"""
Open a Mapchete process.
Parameters
----------
config : MapcheteConfig object, config dict or path to mapchete file
Mapchete process configuration
mode : strin... | [
"Open",
"a",
"Mapchete",
"process",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L28-L63 | [
"def",
"open",
"(",
"config",
",",
"mode",
"=",
"\"continue\"",
",",
"zoom",
"=",
"None",
",",
"bounds",
"=",
"None",
",",
"single_input_file",
"=",
"None",
",",
"with_cache",
"=",
"False",
",",
"debug",
"=",
"False",
")",
":",
"return",
"Mapchete",
"(... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | count_tiles | Count number of tiles intersecting with geometry.
Parameters
----------
geometry : shapely geometry
pyramid : TilePyramid
minzoom : int
maxzoom : int
init_zoom : int
Returns
-------
number of tiles | mapchete/_core.py | def count_tiles(geometry, pyramid, minzoom, maxzoom, init_zoom=0):
"""
Count number of tiles intersecting with geometry.
Parameters
----------
geometry : shapely geometry
pyramid : TilePyramid
minzoom : int
maxzoom : int
init_zoom : int
Returns
-------
number of tiles
... | def count_tiles(geometry, pyramid, minzoom, maxzoom, init_zoom=0):
"""
Count number of tiles intersecting with geometry.
Parameters
----------
geometry : shapely geometry
pyramid : TilePyramid
minzoom : int
maxzoom : int
init_zoom : int
Returns
-------
number of tiles
... | [
"Count",
"number",
"of",
"tiles",
"intersecting",
"with",
"geometry",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L805-L839 | [
"def",
"count_tiles",
"(",
"geometry",
",",
"pyramid",
",",
"minzoom",
",",
"maxzoom",
",",
"init_zoom",
"=",
"0",
")",
":",
"if",
"not",
"0",
"<=",
"init_zoom",
"<=",
"minzoom",
"<=",
"maxzoom",
":",
"raise",
"ValueError",
"(",
"\"invalid zoom levels given\... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _get_zoom_level | Determine zoom levels. | mapchete/_core.py | def _get_zoom_level(zoom, process):
"""Determine zoom levels."""
if zoom is None:
return reversed(process.config.zoom_levels)
if isinstance(zoom, int):
return [zoom]
elif len(zoom) == 2:
return reversed(range(min(zoom), max(zoom)+1))
elif len(zoom) == 1:
return zoom | def _get_zoom_level(zoom, process):
"""Determine zoom levels."""
if zoom is None:
return reversed(process.config.zoom_levels)
if isinstance(zoom, int):
return [zoom]
elif len(zoom) == 2:
return reversed(range(min(zoom), max(zoom)+1))
elif len(zoom) == 1:
return zoom | [
"Determine",
"zoom",
"levels",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L923-L932 | [
"def",
"_get_zoom_level",
"(",
"zoom",
",",
"process",
")",
":",
"if",
"zoom",
"is",
"None",
":",
"return",
"reversed",
"(",
"process",
".",
"config",
".",
"zoom_levels",
")",
"if",
"isinstance",
"(",
"zoom",
",",
"int",
")",
":",
"return",
"[",
"zoom"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _process_worker | Worker function running the process. | mapchete/_core.py | def _process_worker(process, process_tile):
"""Worker function running the process."""
logger.debug((process_tile.id, "running on %s" % current_process().name))
# skip execution if overwrite is disabled and tile exists
if (
process.config.mode == "continue" and
process.config.output.til... | def _process_worker(process, process_tile):
"""Worker function running the process."""
logger.debug((process_tile.id, "running on %s" % current_process().name))
# skip execution if overwrite is disabled and tile exists
if (
process.config.mode == "continue" and
process.config.output.til... | [
"Worker",
"function",
"running",
"the",
"process",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L935-L969 | [
"def",
"_process_worker",
"(",
"process",
",",
"process_tile",
")",
":",
"logger",
".",
"debug",
"(",
"(",
"process_tile",
".",
"id",
",",
"\"running on %s\"",
"%",
"current_process",
"(",
")",
".",
"name",
")",
")",
"# skip execution if overwrite is disabled and ... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | Mapchete.get_process_tiles | Yield process tiles.
Tiles intersecting with the input data bounding boxes as well as
process bounds, if provided, are considered process tiles. This is to
avoid iterating through empty tiles.
Parameters
----------
zoom : integer
zoom level process tiles sho... | mapchete/_core.py | def get_process_tiles(self, zoom=None):
"""
Yield process tiles.
Tiles intersecting with the input data bounding boxes as well as
process bounds, if provided, are considered process tiles. This is to
avoid iterating through empty tiles.
Parameters
----------
... | def get_process_tiles(self, zoom=None):
"""
Yield process tiles.
Tiles intersecting with the input data bounding boxes as well as
process bounds, if provided, are considered process tiles. This is to
avoid iterating through empty tiles.
Parameters
----------
... | [
"Yield",
"process",
"tiles",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L113-L141 | [
"def",
"get_process_tiles",
"(",
"self",
",",
"zoom",
"=",
"None",
")",
":",
"if",
"zoom",
"or",
"zoom",
"==",
"0",
":",
"for",
"tile",
"in",
"self",
".",
"config",
".",
"process_pyramid",
".",
"tiles_from_geom",
"(",
"self",
".",
"config",
".",
"area_... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | Mapchete.batch_process | Process a large batch of tiles.
Parameters
----------
process : MapcheteProcess
process to be run
zoom : list or int
either single zoom level or list of minimum and maximum zoom level;
None processes all (default: None)
tile : tuple
... | mapchete/_core.py | def batch_process(
self, zoom=None, tile=None, multi=cpu_count(), max_chunksize=1
):
"""
Process a large batch of tiles.
Parameters
----------
process : MapcheteProcess
process to be run
zoom : list or int
either single zoom level or l... | def batch_process(
self, zoom=None, tile=None, multi=cpu_count(), max_chunksize=1
):
"""
Process a large batch of tiles.
Parameters
----------
process : MapcheteProcess
process to be run
zoom : list or int
either single zoom level or l... | [
"Process",
"a",
"large",
"batch",
"of",
"tiles",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L143-L165 | [
"def",
"batch_process",
"(",
"self",
",",
"zoom",
"=",
"None",
",",
"tile",
"=",
"None",
",",
"multi",
"=",
"cpu_count",
"(",
")",
",",
"max_chunksize",
"=",
"1",
")",
":",
"list",
"(",
"self",
".",
"batch_processor",
"(",
"zoom",
",",
"tile",
",",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | Mapchete.batch_processor | Process a large batch of tiles and yield report messages per tile.
Parameters
----------
zoom : list or int
either single zoom level or list of minimum and maximum zoom level;
None processes all (default: None)
tile : tuple
zoom, row and column of til... | mapchete/_core.py | def batch_processor(
self, zoom=None, tile=None, multi=cpu_count(), max_chunksize=1
):
"""
Process a large batch of tiles and yield report messages per tile.
Parameters
----------
zoom : list or int
either single zoom level or list of minimum and maximum ... | def batch_processor(
self, zoom=None, tile=None, multi=cpu_count(), max_chunksize=1
):
"""
Process a large batch of tiles and yield report messages per tile.
Parameters
----------
zoom : list or int
either single zoom level or list of minimum and maximum ... | [
"Process",
"a",
"large",
"batch",
"of",
"tiles",
"and",
"yield",
"report",
"messages",
"per",
"tile",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L167-L204 | [
"def",
"batch_processor",
"(",
"self",
",",
"zoom",
"=",
"None",
",",
"tile",
"=",
"None",
",",
"multi",
"=",
"cpu_count",
"(",
")",
",",
"max_chunksize",
"=",
"1",
")",
":",
"if",
"zoom",
"and",
"tile",
":",
"raise",
"ValueError",
"(",
"\"use either z... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | Mapchete.count_tiles | Count number of tiles intersecting with geometry.
Parameters
----------
geometry : shapely geometry
pyramid : TilePyramid
minzoom : int
maxzoom : int
init_zoom : int
Returns
-------
number of tiles | mapchete/_core.py | def count_tiles(self, minzoom, maxzoom, init_zoom=0):
"""
Count number of tiles intersecting with geometry.
Parameters
----------
geometry : shapely geometry
pyramid : TilePyramid
minzoom : int
maxzoom : int
init_zoom : int
Returns
... | def count_tiles(self, minzoom, maxzoom, init_zoom=0):
"""
Count number of tiles intersecting with geometry.
Parameters
----------
geometry : shapely geometry
pyramid : TilePyramid
minzoom : int
maxzoom : int
init_zoom : int
Returns
... | [
"Count",
"number",
"of",
"tiles",
"intersecting",
"with",
"geometry",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L206-L227 | [
"def",
"count_tiles",
"(",
"self",
",",
"minzoom",
",",
"maxzoom",
",",
"init_zoom",
"=",
"0",
")",
":",
"if",
"(",
"minzoom",
",",
"maxzoom",
")",
"not",
"in",
"self",
".",
"_count_tiles_cache",
":",
"self",
".",
"_count_tiles_cache",
"[",
"(",
"minzoom... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | Mapchete.execute | Run the Mapchete process.
Execute, write and return data.
Parameters
----------
process_tile : Tile or tile index tuple
Member of the process tile pyramid (not necessarily the output
pyramid, if output has a different metatiling setting)
Returns
... | mapchete/_core.py | def execute(self, process_tile, raise_nodata=False):
"""
Run the Mapchete process.
Execute, write and return data.
Parameters
----------
process_tile : Tile or tile index tuple
Member of the process tile pyramid (not necessarily the output
pyrami... | def execute(self, process_tile, raise_nodata=False):
"""
Run the Mapchete process.
Execute, write and return data.
Parameters
----------
process_tile : Tile or tile index tuple
Member of the process tile pyramid (not necessarily the output
pyrami... | [
"Run",
"the",
"Mapchete",
"process",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L229-L258 | [
"def",
"execute",
"(",
"self",
",",
"process_tile",
",",
"raise_nodata",
"=",
"False",
")",
":",
"if",
"self",
".",
"config",
".",
"mode",
"not",
"in",
"[",
"\"memory\"",
",",
"\"continue\"",
",",
"\"overwrite\"",
"]",
":",
"raise",
"ValueError",
"(",
"\... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | Mapchete.read | Read from written process output.
Parameters
----------
output_tile : BufferedTile or tile index tuple
Member of the output tile pyramid (not necessarily the process
pyramid, if output has a different metatiling setting)
Returns
-------
data : Nu... | mapchete/_core.py | def read(self, output_tile):
"""
Read from written process output.
Parameters
----------
output_tile : BufferedTile or tile index tuple
Member of the output tile pyramid (not necessarily the process
pyramid, if output has a different metatiling setting)
... | def read(self, output_tile):
"""
Read from written process output.
Parameters
----------
output_tile : BufferedTile or tile index tuple
Member of the output tile pyramid (not necessarily the process
pyramid, if output has a different metatiling setting)
... | [
"Read",
"from",
"written",
"process",
"output",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L260-L284 | [
"def",
"read",
"(",
"self",
",",
"output_tile",
")",
":",
"if",
"self",
".",
"config",
".",
"mode",
"not",
"in",
"[",
"\"readonly\"",
",",
"\"continue\"",
",",
"\"overwrite\"",
"]",
":",
"raise",
"ValueError",
"(",
"\"process mode must be readonly, continue or o... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | Mapchete.write | Write data into output format.
Parameters
----------
process_tile : BufferedTile or tile index tuple
process tile
data : NumPy array or features
data to be written | mapchete/_core.py | def write(self, process_tile, data):
"""
Write data into output format.
Parameters
----------
process_tile : BufferedTile or tile index tuple
process tile
data : NumPy array or features
data to be written
"""
if isinstance(process_... | def write(self, process_tile, data):
"""
Write data into output format.
Parameters
----------
process_tile : BufferedTile or tile index tuple
process tile
data : NumPy array or features
data to be written
"""
if isinstance(process_... | [
"Write",
"data",
"into",
"output",
"format",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L286-L337 | [
"def",
"write",
"(",
"self",
",",
"process_tile",
",",
"data",
")",
":",
"if",
"isinstance",
"(",
"process_tile",
",",
"tuple",
")",
":",
"process_tile",
"=",
"self",
".",
"config",
".",
"process_pyramid",
".",
"tile",
"(",
"*",
"process_tile",
")",
"eli... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | Mapchete.get_raw_output | Get output raw data.
This function won't work with multiprocessing, as it uses the
``threading.Lock()`` class.
Parameters
----------
tile : tuple, Tile or BufferedTile
If a tile index is given, a tile from the output pyramid will be
assumed. Tile cannot ... | mapchete/_core.py | def get_raw_output(self, tile, _baselevel_readonly=False):
"""
Get output raw data.
This function won't work with multiprocessing, as it uses the
``threading.Lock()`` class.
Parameters
----------
tile : tuple, Tile or BufferedTile
If a tile index is ... | def get_raw_output(self, tile, _baselevel_readonly=False):
"""
Get output raw data.
This function won't work with multiprocessing, as it uses the
``threading.Lock()`` class.
Parameters
----------
tile : tuple, Tile or BufferedTile
If a tile index is ... | [
"Get",
"output",
"raw",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L339-L406 | [
"def",
"get_raw_output",
"(",
"self",
",",
"tile",
",",
"_baselevel_readonly",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"tile",
",",
"(",
"BufferedTile",
",",
"tuple",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"'tile' must be a tuple or Buffer... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | Mapchete._extract | Extract data from tile. | mapchete/_core.py | def _extract(self, in_tile=None, in_data=None, out_tile=None):
"""Extract data from tile."""
return self.config.output.extract_subset(
input_data_tiles=[(in_tile, in_data)],
out_tile=out_tile
) | def _extract(self, in_tile=None, in_data=None, out_tile=None):
"""Extract data from tile."""
return self.config.output.extract_subset(
input_data_tiles=[(in_tile, in_data)],
out_tile=out_tile
) | [
"Extract",
"data",
"from",
"tile",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L457-L462 | [
"def",
"_extract",
"(",
"self",
",",
"in_tile",
"=",
"None",
",",
"in_data",
"=",
"None",
",",
"out_tile",
"=",
"None",
")",
":",
"return",
"self",
".",
"config",
".",
"output",
".",
"extract_subset",
"(",
"input_data_tiles",
"=",
"[",
"(",
"in_tile",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteProcess.read | Read existing output data from a previous run.
Returns
-------
process output : NumPy array (raster) or feature iterator (vector) | mapchete/_core.py | def read(self, **kwargs):
"""
Read existing output data from a previous run.
Returns
-------
process output : NumPy array (raster) or feature iterator (vector)
"""
if self.tile.pixelbuffer > self.config.output.pixelbuffer:
output_tiles = list(self.con... | def read(self, **kwargs):
"""
Read existing output data from a previous run.
Returns
-------
process output : NumPy array (raster) or feature iterator (vector)
"""
if self.tile.pixelbuffer > self.config.output.pixelbuffer:
output_tiles = list(self.con... | [
"Read",
"existing",
"output",
"data",
"from",
"a",
"previous",
"run",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L620-L640 | [
"def",
"read",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"tile",
".",
"pixelbuffer",
">",
"self",
".",
"config",
".",
"output",
".",
"pixelbuffer",
":",
"output_tiles",
"=",
"list",
"(",
"self",
".",
"config",
".",
"output_py... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteProcess.open | Open input data.
Parameters
----------
input_id : string
input identifier from configuration file or file path
kwargs : driver specific parameters (e.g. resampling)
Returns
-------
tiled input data : InputTile
reprojected input data withi... | mapchete/_core.py | def open(self, input_id, **kwargs):
"""
Open input data.
Parameters
----------
input_id : string
input identifier from configuration file or file path
kwargs : driver specific parameters (e.g. resampling)
Returns
-------
tiled input d... | def open(self, input_id, **kwargs):
"""
Open input data.
Parameters
----------
input_id : string
input identifier from configuration file or file path
kwargs : driver specific parameters (e.g. resampling)
Returns
-------
tiled input d... | [
"Open",
"input",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L642-L661 | [
"def",
"open",
"(",
"self",
",",
"input_id",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"input_id",
",",
"str",
")",
":",
"return",
"input_id",
".",
"open",
"(",
"self",
".",
"tile",
",",
"*",
"*",
"kwargs",
")",
"if",
"in... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteProcess.hillshade | Calculate hillshading from elevation data.
Parameters
----------
elevation : array
input elevation data
azimuth : float
horizontal angle of light source (315: North-West)
altitude : float
vertical angle of light source (90 would result in slop... | mapchete/_core.py | def hillshade(
self, elevation, azimuth=315.0, altitude=45.0, z=1.0, scale=1.0
):
"""
Calculate hillshading from elevation data.
Parameters
----------
elevation : array
input elevation data
azimuth : float
horizontal angle of light sou... | def hillshade(
self, elevation, azimuth=315.0, altitude=45.0, z=1.0, scale=1.0
):
"""
Calculate hillshading from elevation data.
Parameters
----------
elevation : array
input elevation data
azimuth : float
horizontal angle of light sou... | [
"Calculate",
"hillshading",
"from",
"elevation",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L663-L688 | [
"def",
"hillshade",
"(",
"self",
",",
"elevation",
",",
"azimuth",
"=",
"315.0",
",",
"altitude",
"=",
"45.0",
",",
"z",
"=",
"1.0",
",",
"scale",
"=",
"1.0",
")",
":",
"return",
"commons_hillshade",
".",
"hillshade",
"(",
"elevation",
",",
"self",
","... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteProcess.contours | Extract contour lines from elevation data.
Parameters
----------
elevation : array
input elevation data
interval : integer
elevation value interval when drawing contour lines
field : string
output field name containing elevation value
... | mapchete/_core.py | def contours(
self, elevation, interval=100, field='elev', base=0
):
"""
Extract contour lines from elevation data.
Parameters
----------
elevation : array
input elevation data
interval : integer
elevation value interval when drawing c... | def contours(
self, elevation, interval=100, field='elev', base=0
):
"""
Extract contour lines from elevation data.
Parameters
----------
elevation : array
input elevation data
interval : integer
elevation value interval when drawing c... | [
"Extract",
"contour",
"lines",
"from",
"elevation",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L690-L713 | [
"def",
"contours",
"(",
"self",
",",
"elevation",
",",
"interval",
"=",
"100",
",",
"field",
"=",
"'elev'",
",",
"base",
"=",
"0",
")",
":",
"return",
"commons_contours",
".",
"extract_contours",
"(",
"elevation",
",",
"self",
".",
"tile",
",",
"interval... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteProcess.clip | Clip array by geometry.
Parameters
----------
array : array
raster data to be clipped
geometries : iterable
geometries used to clip source array
inverted : bool
invert clipping (default: False)
clip_buffer : int
buffer (in ... | mapchete/_core.py | def clip(
self, array, geometries, inverted=False, clip_buffer=0
):
"""
Clip array by geometry.
Parameters
----------
array : array
raster data to be clipped
geometries : iterable
geometries used to clip source array
inverted :... | def clip(
self, array, geometries, inverted=False, clip_buffer=0
):
"""
Clip array by geometry.
Parameters
----------
array : array
raster data to be clipped
geometries : iterable
geometries used to clip source array
inverted :... | [
"Clip",
"array",
"by",
"geometry",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/_core.py#L715-L738 | [
"def",
"clip",
"(",
"self",
",",
"array",
",",
"geometries",
",",
"inverted",
"=",
"False",
",",
"clip_buffer",
"=",
"0",
")",
":",
"return",
"commons_clip",
".",
"clip_array_with_vector",
"(",
"array",
",",
"self",
".",
"tile",
".",
"affine",
",",
"geom... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | clip_array_with_vector | Clip input array with a vector list.
Parameters
----------
array : array
input raster data
array_affine : Affine
Affine object describing the raster's geolocation
geometries : iterable
iterable of dictionaries, where every entry has a 'geometry' and
'properties' key.... | mapchete/commons/clip.py | def clip_array_with_vector(
array, array_affine, geometries, inverted=False, clip_buffer=0
):
"""
Clip input array with a vector list.
Parameters
----------
array : array
input raster data
array_affine : Affine
Affine object describing the raster's geolocation
geometries... | def clip_array_with_vector(
array, array_affine, geometries, inverted=False, clip_buffer=0
):
"""
Clip input array with a vector list.
Parameters
----------
array : array
input raster data
array_affine : Affine
Affine object describing the raster's geolocation
geometries... | [
"Clip",
"input",
"array",
"with",
"a",
"vector",
"list",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/commons/clip.py#L10-L68 | [
"def",
"clip_array_with_vector",
"(",
"array",
",",
"array_affine",
",",
"geometries",
",",
"inverted",
"=",
"False",
",",
"clip_buffer",
"=",
"0",
")",
":",
"# buffer input geometries and clean up",
"buffered_geometries",
"=",
"[",
"]",
"for",
"feature",
"in",
"g... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | pyramid | Create tile pyramid out of input raster. | mapchete/cli/default/pyramid.py | def pyramid(
input_raster,
output_dir,
pyramid_type=None,
output_format=None,
resampling_method=None,
scale_method=None,
zoom=None,
bounds=None,
overwrite=False,
debug=False
):
"""Create tile pyramid out of input raster."""
bounds = bounds if bounds else None
options ... | def pyramid(
input_raster,
output_dir,
pyramid_type=None,
output_format=None,
resampling_method=None,
scale_method=None,
zoom=None,
bounds=None,
overwrite=False,
debug=False
):
"""Create tile pyramid out of input raster."""
bounds = bounds if bounds else None
options ... | [
"Create",
"tile",
"pyramid",
"out",
"of",
"input",
"raster",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/cli/default/pyramid.py#L39-L62 | [
"def",
"pyramid",
"(",
"input_raster",
",",
"output_dir",
",",
"pyramid_type",
"=",
"None",
",",
"output_format",
"=",
"None",
",",
"resampling_method",
"=",
"None",
",",
"scale_method",
"=",
"None",
",",
"zoom",
"=",
"None",
",",
"bounds",
"=",
"None",
",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | raster2pyramid | Create a tile pyramid out of an input raster dataset. | mapchete/cli/default/pyramid.py | def raster2pyramid(input_file, output_dir, options):
"""Create a tile pyramid out of an input raster dataset."""
pyramid_type = options["pyramid_type"]
scale_method = options["scale_method"]
output_format = options["output_format"]
resampling = options["resampling"]
zoom = options["zoom"]
bo... | def raster2pyramid(input_file, output_dir, options):
"""Create a tile pyramid out of an input raster dataset."""
pyramid_type = options["pyramid_type"]
scale_method = options["scale_method"]
output_format = options["output_format"]
resampling = options["resampling"]
zoom = options["zoom"]
bo... | [
"Create",
"a",
"tile",
"pyramid",
"out",
"of",
"an",
"input",
"raster",
"dataset",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/cli/default/pyramid.py#L65-L131 | [
"def",
"raster2pyramid",
"(",
"input_file",
",",
"output_dir",
",",
"options",
")",
":",
"pyramid_type",
"=",
"options",
"[",
"\"pyramid_type\"",
"]",
"scale_method",
"=",
"options",
"[",
"\"scale_method\"",
"]",
"output_format",
"=",
"options",
"[",
"\"output_for... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _get_zoom | Determine minimum and maximum zoomlevel. | mapchete/cli/default/pyramid.py | def _get_zoom(zoom, input_raster, pyramid_type):
"""Determine minimum and maximum zoomlevel."""
if not zoom:
minzoom = 1
maxzoom = get_best_zoom_level(input_raster, pyramid_type)
elif len(zoom) == 1:
minzoom = zoom[0]
maxzoom = zoom[0]
elif len(zoom) == 2:
if zoom... | def _get_zoom(zoom, input_raster, pyramid_type):
"""Determine minimum and maximum zoomlevel."""
if not zoom:
minzoom = 1
maxzoom = get_best_zoom_level(input_raster, pyramid_type)
elif len(zoom) == 1:
minzoom = zoom[0]
maxzoom = zoom[0]
elif len(zoom) == 2:
if zoom... | [
"Determine",
"minimum",
"and",
"maximum",
"zoomlevel",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/cli/default/pyramid.py#L134-L149 | [
"def",
"_get_zoom",
"(",
"zoom",
",",
"input_raster",
",",
"pyramid_type",
")",
":",
"if",
"not",
"zoom",
":",
"minzoom",
"=",
"1",
"maxzoom",
"=",
"get_best_zoom_level",
"(",
"input_raster",
",",
"pyramid_type",
")",
"elif",
"len",
"(",
"zoom",
")",
"==",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | validate_values | Validate whether value is found in config and has the right type.
Parameters
----------
config : dict
configuration dictionary
values : list
list of (str, type) tuples of values and value types expected in config
Returns
-------
True if config is valid.
Raises
----... | mapchete/config.py | def validate_values(config, values):
"""
Validate whether value is found in config and has the right type.
Parameters
----------
config : dict
configuration dictionary
values : list
list of (str, type) tuples of values and value types expected in config
Returns
-------
... | def validate_values(config, values):
"""
Validate whether value is found in config and has the right type.
Parameters
----------
config : dict
configuration dictionary
values : list
list of (str, type) tuples of values and value types expected in config
Returns
-------
... | [
"Validate",
"whether",
"value",
"is",
"found",
"in",
"config",
"and",
"has",
"the",
"right",
"type",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L578-L604 | [
"def",
"validate_values",
"(",
"config",
",",
"values",
")",
":",
"if",
"not",
"isinstance",
"(",
"config",
",",
"dict",
")",
":",
"raise",
"TypeError",
"(",
"\"config must be a dictionary\"",
")",
"for",
"value",
",",
"vtype",
"in",
"values",
":",
"if",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | get_hash | Return hash of x. | mapchete/config.py | def get_hash(x):
"""Return hash of x."""
if isinstance(x, str):
return hash(x)
elif isinstance(x, dict):
return hash(yaml.dump(x)) | def get_hash(x):
"""Return hash of x."""
if isinstance(x, str):
return hash(x)
elif isinstance(x, dict):
return hash(yaml.dump(x)) | [
"Return",
"hash",
"of",
"x",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L607-L612 | [
"def",
"get_hash",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"str",
")",
":",
"return",
"hash",
"(",
"x",
")",
"elif",
"isinstance",
"(",
"x",
",",
"dict",
")",
":",
"return",
"hash",
"(",
"yaml",
".",
"dump",
"(",
"x",
")",
")"
] | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | get_zoom_levels | Validate and return zoom levels. | mapchete/config.py | def get_zoom_levels(process_zoom_levels=None, init_zoom_levels=None):
"""Validate and return zoom levels."""
process_zoom_levels = _validate_zooms(process_zoom_levels)
if init_zoom_levels is None:
return process_zoom_levels
else:
init_zoom_levels = _validate_zooms(init_zoom_levels)
... | def get_zoom_levels(process_zoom_levels=None, init_zoom_levels=None):
"""Validate and return zoom levels."""
process_zoom_levels = _validate_zooms(process_zoom_levels)
if init_zoom_levels is None:
return process_zoom_levels
else:
init_zoom_levels = _validate_zooms(init_zoom_levels)
... | [
"Validate",
"and",
"return",
"zoom",
"levels",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L615-L625 | [
"def",
"get_zoom_levels",
"(",
"process_zoom_levels",
"=",
"None",
",",
"init_zoom_levels",
"=",
"None",
")",
":",
"process_zoom_levels",
"=",
"_validate_zooms",
"(",
"process_zoom_levels",
")",
"if",
"init_zoom_levels",
"is",
"None",
":",
"return",
"process_zoom_leve... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | snap_bounds | Snaps bounds to tiles boundaries of specific zoom level.
Parameters
----------
bounds : bounds to be snapped
pyramid : TilePyramid
zoom : int
Returns
-------
Bounds(left, bottom, right, top) | mapchete/config.py | def snap_bounds(bounds=None, pyramid=None, zoom=None):
"""
Snaps bounds to tiles boundaries of specific zoom level.
Parameters
----------
bounds : bounds to be snapped
pyramid : TilePyramid
zoom : int
Returns
-------
Bounds(left, bottom, right, top)
"""
if not isinstanc... | def snap_bounds(bounds=None, pyramid=None, zoom=None):
"""
Snaps bounds to tiles boundaries of specific zoom level.
Parameters
----------
bounds : bounds to be snapped
pyramid : TilePyramid
zoom : int
Returns
-------
Bounds(left, bottom, right, top)
"""
if not isinstanc... | [
"Snaps",
"bounds",
"to",
"tiles",
"boundaries",
"of",
"specific",
"zoom",
"level",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L628-L652 | [
"def",
"snap_bounds",
"(",
"bounds",
"=",
"None",
",",
"pyramid",
"=",
"None",
",",
"zoom",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"bounds",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"bounds must be eit... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | clip_bounds | Clips bounds by clip.
Parameters
----------
bounds : bounds to be clipped
clip : clip bounds
Returns
-------
Bounds(left, bottom, right, top) | mapchete/config.py | def clip_bounds(bounds=None, clip=None):
"""
Clips bounds by clip.
Parameters
----------
bounds : bounds to be clipped
clip : clip bounds
Returns
-------
Bounds(left, bottom, right, top)
"""
bounds = Bounds(*bounds)
clip = Bounds(*clip)
return Bounds(
max(bo... | def clip_bounds(bounds=None, clip=None):
"""
Clips bounds by clip.
Parameters
----------
bounds : bounds to be clipped
clip : clip bounds
Returns
-------
Bounds(left, bottom, right, top)
"""
bounds = Bounds(*bounds)
clip = Bounds(*clip)
return Bounds(
max(bo... | [
"Clips",
"bounds",
"by",
"clip",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L655-L675 | [
"def",
"clip_bounds",
"(",
"bounds",
"=",
"None",
",",
"clip",
"=",
"None",
")",
":",
"bounds",
"=",
"Bounds",
"(",
"*",
"bounds",
")",
"clip",
"=",
"Bounds",
"(",
"*",
"clip",
")",
"return",
"Bounds",
"(",
"max",
"(",
"bounds",
".",
"left",
",",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | raw_conf_process_pyramid | Loads the process pyramid of a raw configuration.
Parameters
----------
raw_conf : dict
Raw mapchete configuration as dictionary.
Returns
-------
BufferedTilePyramid | mapchete/config.py | def raw_conf_process_pyramid(raw_conf):
"""
Loads the process pyramid of a raw configuration.
Parameters
----------
raw_conf : dict
Raw mapchete configuration as dictionary.
Returns
-------
BufferedTilePyramid
"""
return BufferedTilePyramid(
raw_conf["pyramid"][... | def raw_conf_process_pyramid(raw_conf):
"""
Loads the process pyramid of a raw configuration.
Parameters
----------
raw_conf : dict
Raw mapchete configuration as dictionary.
Returns
-------
BufferedTilePyramid
"""
return BufferedTilePyramid(
raw_conf["pyramid"][... | [
"Loads",
"the",
"process",
"pyramid",
"of",
"a",
"raw",
"configuration",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L694-L711 | [
"def",
"raw_conf_process_pyramid",
"(",
"raw_conf",
")",
":",
"return",
"BufferedTilePyramid",
"(",
"raw_conf",
"[",
"\"pyramid\"",
"]",
"[",
"\"grid\"",
"]",
",",
"metatiling",
"=",
"raw_conf",
"[",
"\"pyramid\"",
"]",
".",
"get",
"(",
"\"metatiling\"",
",",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | bounds_from_opts | Loads the process pyramid of a raw configuration.
Parameters
----------
raw_conf : dict
Raw mapchete configuration as dictionary.
Returns
-------
BufferedTilePyramid | mapchete/config.py | def bounds_from_opts(
wkt_geometry=None, point=None, bounds=None, zoom=None, raw_conf=None
):
"""
Loads the process pyramid of a raw configuration.
Parameters
----------
raw_conf : dict
Raw mapchete configuration as dictionary.
Returns
-------
BufferedTilePyramid
"""
... | def bounds_from_opts(
wkt_geometry=None, point=None, bounds=None, zoom=None, raw_conf=None
):
"""
Loads the process pyramid of a raw configuration.
Parameters
----------
raw_conf : dict
Raw mapchete configuration as dictionary.
Returns
-------
BufferedTilePyramid
"""
... | [
"Loads",
"the",
"process",
"pyramid",
"of",
"a",
"raw",
"configuration",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L714-L740 | [
"def",
"bounds_from_opts",
"(",
"wkt_geometry",
"=",
"None",
",",
"point",
"=",
"None",
",",
"bounds",
"=",
"None",
",",
"zoom",
"=",
"None",
",",
"raw_conf",
"=",
"None",
")",
":",
"if",
"wkt_geometry",
":",
"return",
"wkt",
".",
"loads",
"(",
"wkt_ge... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _validate_zooms | Return a list of zoom levels.
Following inputs are converted:
- int --> [int]
- dict{min, max} --> range(min, max + 1)
- [int] --> [int]
- [int, int] --> range(smaller int, bigger int + 1) | mapchete/config.py | def _validate_zooms(zooms):
"""
Return a list of zoom levels.
Following inputs are converted:
- int --> [int]
- dict{min, max} --> range(min, max + 1)
- [int] --> [int]
- [int, int] --> range(smaller int, bigger int + 1)
"""
if isinstance(zooms, dict):
if any([a not in zooms... | def _validate_zooms(zooms):
"""
Return a list of zoom levels.
Following inputs are converted:
- int --> [int]
- dict{min, max} --> range(min, max + 1)
- [int] --> [int]
- [int, int] --> range(smaller int, bigger int + 1)
"""
if isinstance(zooms, dict):
if any([a not in zooms... | [
"Return",
"a",
"list",
"of",
"zoom",
"levels",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L785-L813 | [
"def",
"_validate_zooms",
"(",
"zooms",
")",
":",
"if",
"isinstance",
"(",
"zooms",
",",
"dict",
")",
":",
"if",
"any",
"(",
"[",
"a",
"not",
"in",
"zooms",
"for",
"a",
"in",
"[",
"\"min\"",
",",
"\"max\"",
"]",
"]",
")",
":",
"raise",
"MapcheteCon... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _raw_at_zoom | Return parameter dictionary per zoom level. | mapchete/config.py | def _raw_at_zoom(config, zooms):
"""Return parameter dictionary per zoom level."""
params_per_zoom = {}
for zoom in zooms:
params = {}
for name, element in config.items():
if name not in _RESERVED_PARAMETERS:
out_element = _element_at_zoom(name, element, zoom)
... | def _raw_at_zoom(config, zooms):
"""Return parameter dictionary per zoom level."""
params_per_zoom = {}
for zoom in zooms:
params = {}
for name, element in config.items():
if name not in _RESERVED_PARAMETERS:
out_element = _element_at_zoom(name, element, zoom)
... | [
"Return",
"parameter",
"dictionary",
"per",
"zoom",
"level",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L833-L844 | [
"def",
"_raw_at_zoom",
"(",
"config",
",",
"zooms",
")",
":",
"params_per_zoom",
"=",
"{",
"}",
"for",
"zoom",
"in",
"zooms",
":",
"params",
"=",
"{",
"}",
"for",
"name",
",",
"element",
"in",
"config",
".",
"items",
"(",
")",
":",
"if",
"name",
"n... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _element_at_zoom | Return the element filtered by zoom level.
- An input integer or float gets returned as is.
- An input string is checked whether it starts with "zoom". Then, the
provided zoom level gets parsed and compared with the actual zoom
level. If zoom levels match, the element gets returned.... | mapchete/config.py | def _element_at_zoom(name, element, zoom):
"""
Return the element filtered by zoom level.
- An input integer or float gets returned as is.
- An input string is checked whether it starts with "zoom". Then, the
provided zoom level gets parsed and compared with the actual zoom
... | def _element_at_zoom(name, element, zoom):
"""
Return the element filtered by zoom level.
- An input integer or float gets returned as is.
- An input string is checked whether it starts with "zoom". Then, the
provided zoom level gets parsed and compared with the actual zoom
... | [
"Return",
"the",
"element",
"filtered",
"by",
"zoom",
"level",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L847-L894 | [
"def",
"_element_at_zoom",
"(",
"name",
",",
"element",
",",
"zoom",
")",
":",
"# If element is a dictionary, analyze subitems.",
"if",
"isinstance",
"(",
"element",
",",
"dict",
")",
":",
"if",
"\"format\"",
"in",
"element",
":",
"# we have an input or output driver ... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _filter_by_zoom | Return element only if zoom condition matches with config string. | mapchete/config.py | def _filter_by_zoom(element=None, conf_string=None, zoom=None):
"""Return element only if zoom condition matches with config string."""
for op_str, op_func in [
# order of operators is important:
# prematurely return in cases of "<=" or ">=", otherwise
# _strip_zoom() cannot parse config... | def _filter_by_zoom(element=None, conf_string=None, zoom=None):
"""Return element only if zoom condition matches with config string."""
for op_str, op_func in [
# order of operators is important:
# prematurely return in cases of "<=" or ">=", otherwise
# _strip_zoom() cannot parse config... | [
"Return",
"element",
"only",
"if",
"zoom",
"condition",
"matches",
"with",
"config",
"string",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L897-L911 | [
"def",
"_filter_by_zoom",
"(",
"element",
"=",
"None",
",",
"conf_string",
"=",
"None",
",",
"zoom",
"=",
"None",
")",
":",
"for",
"op_str",
",",
"op_func",
"in",
"[",
"# order of operators is important:",
"# prematurely return in cases of \"<=\" or \">=\", otherwise",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _strip_zoom | Return zoom level as integer or throw error. | mapchete/config.py | def _strip_zoom(input_string, strip_string):
"""Return zoom level as integer or throw error."""
try:
return int(input_string.strip(strip_string))
except Exception as e:
raise MapcheteConfigError("zoom level could not be determined: %s" % e) | def _strip_zoom(input_string, strip_string):
"""Return zoom level as integer or throw error."""
try:
return int(input_string.strip(strip_string))
except Exception as e:
raise MapcheteConfigError("zoom level could not be determined: %s" % e) | [
"Return",
"zoom",
"level",
"as",
"integer",
"or",
"throw",
"error",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L914-L919 | [
"def",
"_strip_zoom",
"(",
"input_string",
",",
"strip_string",
")",
":",
"try",
":",
"return",
"int",
"(",
"input_string",
".",
"strip",
"(",
"strip_string",
")",
")",
"except",
"Exception",
"as",
"e",
":",
"raise",
"MapcheteConfigError",
"(",
"\"zoom level c... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _flatten_tree | Flatten dict tree into dictionary where keys are paths of old dict. | mapchete/config.py | def _flatten_tree(tree, old_path=None):
"""Flatten dict tree into dictionary where keys are paths of old dict."""
flat_tree = []
for key, value in tree.items():
new_path = "/".join([old_path, key]) if old_path else key
if isinstance(value, dict) and "format" not in value:
flat_tr... | def _flatten_tree(tree, old_path=None):
"""Flatten dict tree into dictionary where keys are paths of old dict."""
flat_tree = []
for key, value in tree.items():
new_path = "/".join([old_path, key]) if old_path else key
if isinstance(value, dict) and "format" not in value:
flat_tr... | [
"Flatten",
"dict",
"tree",
"into",
"dictionary",
"where",
"keys",
"are",
"paths",
"of",
"old",
"dict",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L922-L931 | [
"def",
"_flatten_tree",
"(",
"tree",
",",
"old_path",
"=",
"None",
")",
":",
"flat_tree",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"tree",
".",
"items",
"(",
")",
":",
"new_path",
"=",
"\"/\"",
".",
"join",
"(",
"[",
"old_path",
",",
"key",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _unflatten_tree | Reverse tree flattening. | mapchete/config.py | def _unflatten_tree(flat):
"""Reverse tree flattening."""
tree = {}
for key, value in flat.items():
path = key.split("/")
# we are at the end of a branch
if len(path) == 1:
tree[key] = value
# there are more branches
else:
# create new dict
... | def _unflatten_tree(flat):
"""Reverse tree flattening."""
tree = {}
for key, value in flat.items():
path = key.split("/")
# we are at the end of a branch
if len(path) == 1:
tree[key] = value
# there are more branches
else:
# create new dict
... | [
"Reverse",
"tree",
"flattening",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L934-L954 | [
"def",
"_unflatten_tree",
"(",
"flat",
")",
":",
"tree",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"flat",
".",
"items",
"(",
")",
":",
"path",
"=",
"key",
".",
"split",
"(",
"\"/\"",
")",
"# we are at the end of a branch",
"if",
"len",
"(",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteConfig.bounds | Process bounds as defined in the configuration. | mapchete/config.py | def bounds(self):
"""Process bounds as defined in the configuration."""
if self._raw["bounds"] is None:
return self.process_pyramid.bounds
else:
return Bounds(*_validate_bounds(self._raw["bounds"])) | def bounds(self):
"""Process bounds as defined in the configuration."""
if self._raw["bounds"] is None:
return self.process_pyramid.bounds
else:
return Bounds(*_validate_bounds(self._raw["bounds"])) | [
"Process",
"bounds",
"as",
"defined",
"in",
"the",
"configuration",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L227-L232 | [
"def",
"bounds",
"(",
"self",
")",
":",
"if",
"self",
".",
"_raw",
"[",
"\"bounds\"",
"]",
"is",
"None",
":",
"return",
"self",
".",
"process_pyramid",
".",
"bounds",
"else",
":",
"return",
"Bounds",
"(",
"*",
"_validate_bounds",
"(",
"self",
".",
"_ra... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteConfig.init_bounds | Process bounds this process is currently initialized with.
This gets triggered by using the ``init_bounds`` kwarg. If not set, it will
be equal to self.bounds. | mapchete/config.py | def init_bounds(self):
"""
Process bounds this process is currently initialized with.
This gets triggered by using the ``init_bounds`` kwarg. If not set, it will
be equal to self.bounds.
"""
if self._raw["init_bounds"] is None:
return self.bounds
else... | def init_bounds(self):
"""
Process bounds this process is currently initialized with.
This gets triggered by using the ``init_bounds`` kwarg. If not set, it will
be equal to self.bounds.
"""
if self._raw["init_bounds"] is None:
return self.bounds
else... | [
"Process",
"bounds",
"this",
"process",
"is",
"currently",
"initialized",
"with",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L235-L245 | [
"def",
"init_bounds",
"(",
"self",
")",
":",
"if",
"self",
".",
"_raw",
"[",
"\"init_bounds\"",
"]",
"is",
"None",
":",
"return",
"self",
".",
"bounds",
"else",
":",
"return",
"Bounds",
"(",
"*",
"_validate_bounds",
"(",
"self",
".",
"_raw",
"[",
"\"in... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteConfig.effective_bounds | Effective process bounds required to initialize inputs.
Process bounds sometimes have to be larger, because all intersecting process
tiles have to be covered as well. | mapchete/config.py | def effective_bounds(self):
"""
Effective process bounds required to initialize inputs.
Process bounds sometimes have to be larger, because all intersecting process
tiles have to be covered as well.
"""
return snap_bounds(
bounds=clip_bounds(bounds=self.init_... | def effective_bounds(self):
"""
Effective process bounds required to initialize inputs.
Process bounds sometimes have to be larger, because all intersecting process
tiles have to be covered as well.
"""
return snap_bounds(
bounds=clip_bounds(bounds=self.init_... | [
"Effective",
"process",
"bounds",
"required",
"to",
"initialize",
"inputs",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L248-L263 | [
"def",
"effective_bounds",
"(",
"self",
")",
":",
"return",
"snap_bounds",
"(",
"bounds",
"=",
"clip_bounds",
"(",
"bounds",
"=",
"self",
".",
"init_bounds",
",",
"clip",
"=",
"self",
".",
"process_pyramid",
".",
"bounds",
")",
",",
"pyramid",
"=",
"self",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteConfig.output | Output object of driver. | mapchete/config.py | def output(self):
"""Output object of driver."""
output_params = dict(
self._raw["output"],
grid=self.output_pyramid.grid,
pixelbuffer=self.output_pyramid.pixelbuffer,
metatiling=self.output_pyramid.metatiling
)
if "path" in output_params:
... | def output(self):
"""Output object of driver."""
output_params = dict(
self._raw["output"],
grid=self.output_pyramid.grid,
pixelbuffer=self.output_pyramid.pixelbuffer,
metatiling=self.output_pyramid.metatiling
)
if "path" in output_params:
... | [
"Output",
"object",
"of",
"driver",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L266-L298 | [
"def",
"output",
"(",
"self",
")",
":",
"output_params",
"=",
"dict",
"(",
"self",
".",
"_raw",
"[",
"\"output\"",
"]",
",",
"grid",
"=",
"self",
".",
"output_pyramid",
".",
"grid",
",",
"pixelbuffer",
"=",
"self",
".",
"output_pyramid",
".",
"pixelbuffe... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteConfig.input | Input items used for process stored in a dictionary.
Keys are the hashes of the input parameters, values the respective
InputData classes. | mapchete/config.py | def input(self):
"""
Input items used for process stored in a dictionary.
Keys are the hashes of the input parameters, values the respective
InputData classes.
"""
# the delimiters are used by some input drivers
delimiters = dict(
zoom=self.init_zoom_... | def input(self):
"""
Input items used for process stored in a dictionary.
Keys are the hashes of the input parameters, values the respective
InputData classes.
"""
# the delimiters are used by some input drivers
delimiters = dict(
zoom=self.init_zoom_... | [
"Input",
"items",
"used",
"for",
"process",
"stored",
"in",
"a",
"dictionary",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L301-L371 | [
"def",
"input",
"(",
"self",
")",
":",
"# the delimiters are used by some input drivers",
"delimiters",
"=",
"dict",
"(",
"zoom",
"=",
"self",
".",
"init_zoom_levels",
",",
"bounds",
"=",
"self",
".",
"init_bounds",
",",
"process_bounds",
"=",
"self",
".",
"boun... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteConfig.baselevels | Optional baselevels configuration.
baselevels:
min: <zoom>
max: <zoom>
lower: <resampling method>
higher: <resampling method> | mapchete/config.py | def baselevels(self):
"""
Optional baselevels configuration.
baselevels:
min: <zoom>
max: <zoom>
lower: <resampling method>
higher: <resampling method>
"""
if "baselevels" not in self._raw:
return {}
baselevels ... | def baselevels(self):
"""
Optional baselevels configuration.
baselevels:
min: <zoom>
max: <zoom>
lower: <resampling method>
higher: <resampling method>
"""
if "baselevels" not in self._raw:
return {}
baselevels ... | [
"Optional",
"baselevels",
"configuration",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L374-L414 | [
"def",
"baselevels",
"(",
"self",
")",
":",
"if",
"\"baselevels\"",
"not",
"in",
"self",
".",
"_raw",
":",
"return",
"{",
"}",
"baselevels",
"=",
"self",
".",
"_raw",
"[",
"\"baselevels\"",
"]",
"minmax",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteConfig.params_at_zoom | Return configuration parameters snapshot for zoom as dictionary.
Parameters
----------
zoom : int
zoom level
Returns
-------
configuration snapshot : dictionary
zoom level dependent process configuration | mapchete/config.py | def params_at_zoom(self, zoom):
"""
Return configuration parameters snapshot for zoom as dictionary.
Parameters
----------
zoom : int
zoom level
Returns
-------
configuration snapshot : dictionary
zoom level dependent process configur... | def params_at_zoom(self, zoom):
"""
Return configuration parameters snapshot for zoom as dictionary.
Parameters
----------
zoom : int
zoom level
Returns
-------
configuration snapshot : dictionary
zoom level dependent process configur... | [
"Return",
"configuration",
"parameters",
"snapshot",
"for",
"zoom",
"as",
"dictionary",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L433-L461 | [
"def",
"params_at_zoom",
"(",
"self",
",",
"zoom",
")",
":",
"if",
"zoom",
"not",
"in",
"self",
".",
"init_zoom_levels",
":",
"raise",
"ValueError",
"(",
"\"zoom level not available with current configuration\"",
")",
"out",
"=",
"dict",
"(",
"self",
".",
"_para... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteConfig.area_at_zoom | Return process bounding box for zoom level.
Parameters
----------
zoom : int or None
if None, the union of all zoom level areas is returned
Returns
-------
process area : shapely geometry | mapchete/config.py | def area_at_zoom(self, zoom=None):
"""
Return process bounding box for zoom level.
Parameters
----------
zoom : int or None
if None, the union of all zoom level areas is returned
Returns
-------
process area : shapely geometry
"""
... | def area_at_zoom(self, zoom=None):
"""
Return process bounding box for zoom level.
Parameters
----------
zoom : int or None
if None, the union of all zoom level areas is returned
Returns
-------
process area : shapely geometry
"""
... | [
"Return",
"process",
"bounding",
"box",
"for",
"zoom",
"level",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L463-L487 | [
"def",
"area_at_zoom",
"(",
"self",
",",
"zoom",
"=",
"None",
")",
":",
"if",
"zoom",
"is",
"None",
":",
"if",
"not",
"self",
".",
"_cache_full_process_area",
":",
"logger",
".",
"debug",
"(",
"\"calculate process area ...\"",
")",
"self",
".",
"_cache_full_... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteConfig.bounds_at_zoom | Return process bounds for zoom level.
Parameters
----------
zoom : integer or list
Returns
-------
process bounds : tuple
left, bottom, right, top | mapchete/config.py | def bounds_at_zoom(self, zoom=None):
"""
Return process bounds for zoom level.
Parameters
----------
zoom : integer or list
Returns
-------
process bounds : tuple
left, bottom, right, top
"""
return () if self.area_at_zoom(zoo... | def bounds_at_zoom(self, zoom=None):
"""
Return process bounds for zoom level.
Parameters
----------
zoom : integer or list
Returns
-------
process bounds : tuple
left, bottom, right, top
"""
return () if self.area_at_zoom(zoo... | [
"Return",
"process",
"bounds",
"for",
"zoom",
"level",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L507-L521 | [
"def",
"bounds_at_zoom",
"(",
"self",
",",
"zoom",
"=",
"None",
")",
":",
"return",
"(",
")",
"if",
"self",
".",
"area_at_zoom",
"(",
"zoom",
")",
".",
"is_empty",
"else",
"Bounds",
"(",
"*",
"self",
".",
"area_at_zoom",
"(",
"zoom",
")",
".",
"bound... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | MapcheteConfig.process_file | Deprecated. | mapchete/config.py | def process_file(self):
"""Deprecated."""
warnings.warn(DeprecationWarning("'self.process_file' is deprecated"))
return os.path.join(self._raw["config_dir"], self._raw["process"]) | def process_file(self):
"""Deprecated."""
warnings.warn(DeprecationWarning("'self.process_file' is deprecated"))
return os.path.join(self._raw["config_dir"], self._raw["process"]) | [
"Deprecated",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L557-L560 | [
"def",
"process_file",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"DeprecationWarning",
"(",
"\"'self.process_file' is deprecated\"",
")",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_raw",
"[",
"\"config_dir\"",
"]",
",",
"se... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | zoom_index_gen | Generate indexes for given zoom level.
Parameters
----------
mp : Mapchete object
process output to be indexed
out_dir : path
optionally override process output directory
zoom : int
zoom level to be processed
geojson : bool
generate GeoJSON index (default: False)... | mapchete/index.py | def zoom_index_gen(
mp=None,
out_dir=None,
zoom=None,
geojson=False,
gpkg=False,
shapefile=False,
txt=False,
vrt=False,
fieldname="location",
basepath=None,
for_gdal=True,
threading=False,
):
"""
Generate indexes for given zoom level.
Parameters
---------... | def zoom_index_gen(
mp=None,
out_dir=None,
zoom=None,
geojson=False,
gpkg=False,
shapefile=False,
txt=False,
vrt=False,
fieldname="location",
basepath=None,
for_gdal=True,
threading=False,
):
"""
Generate indexes for given zoom level.
Parameters
---------... | [
"Generate",
"indexes",
"for",
"given",
"zoom",
"level",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/index.py#L51-L185 | [
"def",
"zoom_index_gen",
"(",
"mp",
"=",
"None",
",",
"out_dir",
"=",
"None",
",",
"zoom",
"=",
"None",
",",
"geojson",
"=",
"False",
",",
"gpkg",
"=",
"False",
",",
"shapefile",
"=",
"False",
",",
"txt",
"=",
"False",
",",
"vrt",
"=",
"False",
","... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | get_segmentize_value | Return the recommended segmentation value in input file units.
It is calculated by multiplyling raster pixel size with tile shape in
pixels.
Parameters
----------
input_file : str
location of a file readable by rasterio
tile_pyramied : ``TilePyramid`` or ``BufferedTilePyramid``
... | mapchete/formats/default/raster_file.py | def get_segmentize_value(input_file=None, tile_pyramid=None):
"""
Return the recommended segmentation value in input file units.
It is calculated by multiplyling raster pixel size with tile shape in
pixels.
Parameters
----------
input_file : str
location of a file readable by raste... | def get_segmentize_value(input_file=None, tile_pyramid=None):
"""
Return the recommended segmentation value in input file units.
It is calculated by multiplyling raster pixel size with tile shape in
pixels.
Parameters
----------
input_file : str
location of a file readable by raste... | [
"Return",
"the",
"recommended",
"segmentation",
"value",
"in",
"input",
"file",
"units",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/raster_file.py#L204-L224 | [
"def",
"get_segmentize_value",
"(",
"input_file",
"=",
"None",
",",
"tile_pyramid",
"=",
"None",
")",
":",
"warnings",
".",
"warn",
"(",
"DeprecationWarning",
"(",
"\"get_segmentize_value() has moved to mapchete.io\"",
")",
")",
"return",
"io",
".",
"get_segmentize_va... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputData.profile | Return raster metadata. | mapchete/formats/default/raster_file.py | def profile(self):
"""Return raster metadata."""
with rasterio.open(self.path, "r") as src:
return deepcopy(src.meta) | def profile(self):
"""Return raster metadata."""
with rasterio.open(self.path, "r") as src:
return deepcopy(src.meta) | [
"Return",
"raster",
"metadata",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/raster_file.py#L70-L73 | [
"def",
"profile",
"(",
"self",
")",
":",
"with",
"rasterio",
".",
"open",
"(",
"self",
".",
"path",
",",
"\"r\"",
")",
"as",
"src",
":",
"return",
"deepcopy",
"(",
"src",
".",
"meta",
")"
] | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputData.bbox | Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object | mapchete/formats/default/raster_file.py | def bbox(self, out_crs=None):
"""
Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object... | def bbox(self, out_crs=None):
"""
Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object... | [
"Return",
"data",
"bounding",
"box",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/raster_file.py#L90-L119 | [
"def",
"bbox",
"(",
"self",
",",
"out_crs",
"=",
"None",
")",
":",
"out_crs",
"=",
"self",
".",
"pyramid",
".",
"crs",
"if",
"out_crs",
"is",
"None",
"else",
"out_crs",
"with",
"rasterio",
".",
"open",
"(",
"self",
".",
"path",
")",
"as",
"inp",
":... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputTile.read | Read reprojected & resampled input data.
Returns
-------
data : array | mapchete/formats/default/raster_file.py | def read(self, indexes=None, **kwargs):
"""
Read reprojected & resampled input data.
Returns
-------
data : array
"""
return read_raster_window(
self.raster_file.path,
self.tile,
indexes=self._get_band_indexes(indexes),
... | def read(self, indexes=None, **kwargs):
"""
Read reprojected & resampled input data.
Returns
-------
data : array
"""
return read_raster_window(
self.raster_file.path,
self.tile,
indexes=self._get_band_indexes(indexes),
... | [
"Read",
"reprojected",
"&",
"resampled",
"input",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/raster_file.py#L164-L178 | [
"def",
"read",
"(",
"self",
",",
"indexes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"read_raster_window",
"(",
"self",
".",
"raster_file",
".",
"path",
",",
"self",
".",
"tile",
",",
"indexes",
"=",
"self",
".",
"_get_band_indexes",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputTile.is_empty | Check if there is data within this tile.
Returns
-------
is empty : bool | mapchete/formats/default/raster_file.py | def is_empty(self, indexes=None):
"""
Check if there is data within this tile.
Returns
-------
is empty : bool
"""
# empty if tile does not intersect with file bounding box
return not self.tile.bbox.intersects(
self.raster_file.bbox(out_crs=se... | def is_empty(self, indexes=None):
"""
Check if there is data within this tile.
Returns
-------
is empty : bool
"""
# empty if tile does not intersect with file bounding box
return not self.tile.bbox.intersects(
self.raster_file.bbox(out_crs=se... | [
"Check",
"if",
"there",
"is",
"data",
"within",
"this",
"tile",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/raster_file.py#L180-L191 | [
"def",
"is_empty",
"(",
"self",
",",
"indexes",
"=",
"None",
")",
":",
"# empty if tile does not intersect with file bounding box",
"return",
"not",
"self",
".",
"tile",
".",
"bbox",
".",
"intersects",
"(",
"self",
".",
"raster_file",
".",
"bbox",
"(",
"out_crs"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputTile._get_band_indexes | Return valid band indexes. | mapchete/formats/default/raster_file.py | def _get_band_indexes(self, indexes=None):
"""Return valid band indexes."""
if indexes:
if isinstance(indexes, list):
return indexes
else:
return [indexes]
else:
return range(1, self.raster_file.profile["count"] + 1) | def _get_band_indexes(self, indexes=None):
"""Return valid band indexes."""
if indexes:
if isinstance(indexes, list):
return indexes
else:
return [indexes]
else:
return range(1, self.raster_file.profile["count"] + 1) | [
"Return",
"valid",
"band",
"indexes",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/raster_file.py#L193-L201 | [
"def",
"_get_band_indexes",
"(",
"self",
",",
"indexes",
"=",
"None",
")",
":",
"if",
"indexes",
":",
"if",
"isinstance",
"(",
"indexes",
",",
"list",
")",
":",
"return",
"indexes",
"else",
":",
"return",
"[",
"indexes",
"]",
"else",
":",
"return",
"ra... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | execute | Example process for testing.
Inputs:
-------
file1
raster file
Parameters:
-----------
Output:
-------
np.ndarray | mapchete/processes/examples/example_process.py | def execute(mp):
"""
Example process for testing.
Inputs:
-------
file1
raster file
Parameters:
-----------
Output:
-------
np.ndarray
"""
# Reading and writing data works like this:
with mp.open("file1", resampling="bilinear") as raster_file:
if ra... | def execute(mp):
"""
Example process for testing.
Inputs:
-------
file1
raster file
Parameters:
-----------
Output:
-------
np.ndarray
"""
# Reading and writing data works like this:
with mp.open("file1", resampling="bilinear") as raster_file:
if ra... | [
"Example",
"process",
"for",
"testing",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/processes/examples/example_process.py#L4-L27 | [
"def",
"execute",
"(",
"mp",
")",
":",
"# Reading and writing data works like this:",
"with",
"mp",
".",
"open",
"(",
"\"file1\"",
",",
"resampling",
"=",
"\"bilinear\"",
")",
"as",
"raster_file",
":",
"if",
"raster_file",
".",
"is_empty",
"(",
")",
":",
"retu... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.read | Read existing process output.
Parameters
----------
output_tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
process output : list | mapchete/formats/default/geojson.py | def read(self, output_tile, **kwargs):
"""
Read existing process output.
Parameters
----------
output_tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
process output : list
"""
path = self.get_p... | def read(self, output_tile, **kwargs):
"""
Read existing process output.
Parameters
----------
output_tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
process output : list
"""
path = self.get_p... | [
"Read",
"existing",
"process",
"output",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/geojson.py#L84-L106 | [
"def",
"read",
"(",
"self",
",",
"output_tile",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"self",
".",
"get_path",
"(",
"output_tile",
")",
"try",
":",
"with",
"fiona",
".",
"open",
"(",
"path",
",",
"\"r\"",
")",
"as",
"src",
":",
"return",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.write | Write data from process tiles into GeoJSON file(s).
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid`` | mapchete/formats/default/geojson.py | def write(self, process_tile, data):
"""
Write data from process tiles into GeoJSON file(s).
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
"""
if data is None or len(data) == 0:
return
... | def write(self, process_tile, data):
"""
Write data from process tiles into GeoJSON file(s).
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
"""
if data is None or len(data) == 0:
return
... | [
"Write",
"data",
"from",
"process",
"tiles",
"into",
"GeoJSON",
"file",
"(",
"s",
")",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/geojson.py#L108-L143 | [
"def",
"write",
"(",
"self",
",",
"process_tile",
",",
"data",
")",
":",
"if",
"data",
"is",
"None",
"or",
"len",
"(",
"data",
")",
"==",
"0",
":",
"return",
"if",
"not",
"isinstance",
"(",
"data",
",",
"(",
"list",
",",
"types",
".",
"GeneratorTyp... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.is_valid_with_config | Check if output format is valid with other process parameters.
Parameters
----------
config : dictionary
output configuration parameters
Returns
-------
is_valid : bool | mapchete/formats/default/geojson.py | def is_valid_with_config(self, config):
"""
Check if output format is valid with other process parameters.
Parameters
----------
config : dictionary
output configuration parameters
Returns
-------
is_valid : bool
"""
validate_... | def is_valid_with_config(self, config):
"""
Check if output format is valid with other process parameters.
Parameters
----------
config : dictionary
output configuration parameters
Returns
-------
is_valid : bool
"""
validate_... | [
"Check",
"if",
"output",
"format",
"is",
"valid",
"with",
"other",
"process",
"parameters",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/geojson.py#L145-L165 | [
"def",
"is_valid_with_config",
"(",
"self",
",",
"config",
")",
":",
"validate_values",
"(",
"config",
",",
"[",
"(",
"\"schema\"",
",",
"dict",
")",
",",
"(",
"\"path\"",
",",
"str",
")",
"]",
")",
"validate_values",
"(",
"config",
"[",
"\"schema\"",
"]... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputTile.read | Read data from process output.
Parameters
----------
validity_check : bool
run geometry validity check (default: True)
no_neighbors : bool
don't include neighbor tiles if there is a pixelbuffer (default:
False)
Returns
-------
... | mapchete/formats/default/geojson.py | def read(self, validity_check=True, no_neighbors=False, **kwargs):
"""
Read data from process output.
Parameters
----------
validity_check : bool
run geometry validity check (default: True)
no_neighbors : bool
don't include neighbor tiles if there... | def read(self, validity_check=True, no_neighbors=False, **kwargs):
"""
Read data from process output.
Parameters
----------
validity_check : bool
run geometry validity check (default: True)
no_neighbors : bool
don't include neighbor tiles if there... | [
"Read",
"data",
"from",
"process",
"output",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/geojson.py#L229-L248 | [
"def",
"read",
"(",
"self",
",",
"validity_check",
"=",
"True",
",",
"no_neighbors",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"no_neighbors",
":",
"raise",
"NotImplementedError",
"(",
")",
"return",
"self",
".",
"_from_cache",
"(",
"validity_... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | execute | Execute a Mapchete process. | mapchete/cli/default/execute.py | def execute(
mapchete_files,
zoom=None,
bounds=None,
point=None,
wkt_geometry=None,
tile=None,
overwrite=False,
multi=None,
input_file=None,
logfile=None,
verbose=False,
no_pbar=False,
debug=False,
max_chunksize=None,
vrt=False,
idx_out_dir=None
):
"""... | def execute(
mapchete_files,
zoom=None,
bounds=None,
point=None,
wkt_geometry=None,
tile=None,
overwrite=False,
multi=None,
input_file=None,
logfile=None,
verbose=False,
no_pbar=False,
debug=False,
max_chunksize=None,
vrt=False,
idx_out_dir=None
):
"""... | [
"Execute",
"a",
"Mapchete",
"process",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/cli/default/execute.py#L40-L178 | [
"def",
"execute",
"(",
"mapchete_files",
",",
"zoom",
"=",
"None",
",",
"bounds",
"=",
"None",
",",
"point",
"=",
"None",
",",
"wkt_geometry",
"=",
"None",
",",
"tile",
"=",
"None",
",",
"overwrite",
"=",
"False",
",",
"multi",
"=",
"None",
",",
"inp... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | available_output_formats | Return all available output formats.
Returns
-------
formats : list
all available output formats | mapchete/formats/__init__.py | def available_output_formats():
"""
Return all available output formats.
Returns
-------
formats : list
all available output formats
"""
output_formats = []
for v in pkg_resources.iter_entry_points(DRIVERS_ENTRY_POINT):
driver_ = v.load()
if hasattr(driver_, "MET... | def available_output_formats():
"""
Return all available output formats.
Returns
-------
formats : list
all available output formats
"""
output_formats = []
for v in pkg_resources.iter_entry_points(DRIVERS_ENTRY_POINT):
driver_ = v.load()
if hasattr(driver_, "MET... | [
"Return",
"all",
"available",
"output",
"formats",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/__init__.py#L59-L75 | [
"def",
"available_output_formats",
"(",
")",
":",
"output_formats",
"=",
"[",
"]",
"for",
"v",
"in",
"pkg_resources",
".",
"iter_entry_points",
"(",
"DRIVERS_ENTRY_POINT",
")",
":",
"driver_",
"=",
"v",
".",
"load",
"(",
")",
"if",
"hasattr",
"(",
"driver_",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | available_input_formats | Return all available input formats.
Returns
-------
formats : list
all available input formats | mapchete/formats/__init__.py | def available_input_formats():
"""
Return all available input formats.
Returns
-------
formats : list
all available input formats
"""
input_formats = []
for v in pkg_resources.iter_entry_points(DRIVERS_ENTRY_POINT):
logger.debug("driver found: %s", v)
driver_ = v... | def available_input_formats():
"""
Return all available input formats.
Returns
-------
formats : list
all available input formats
"""
input_formats = []
for v in pkg_resources.iter_entry_points(DRIVERS_ENTRY_POINT):
logger.debug("driver found: %s", v)
driver_ = v... | [
"Return",
"all",
"available",
"input",
"formats",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/__init__.py#L78-L93 | [
"def",
"available_input_formats",
"(",
")",
":",
"input_formats",
"=",
"[",
"]",
"for",
"v",
"in",
"pkg_resources",
".",
"iter_entry_points",
"(",
"DRIVERS_ENTRY_POINT",
")",
":",
"logger",
".",
"debug",
"(",
"\"driver found: %s\"",
",",
"v",
")",
"driver_",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | load_output_writer | Return output class of driver.
Returns
-------
output : ``OutputData``
output writer object | mapchete/formats/__init__.py | def load_output_writer(output_params, readonly=False):
"""
Return output class of driver.
Returns
-------
output : ``OutputData``
output writer object
"""
if not isinstance(output_params, dict):
raise TypeError("output_params must be a dictionary")
driver_name = output_p... | def load_output_writer(output_params, readonly=False):
"""
Return output class of driver.
Returns
-------
output : ``OutputData``
output writer object
"""
if not isinstance(output_params, dict):
raise TypeError("output_params must be a dictionary")
driver_name = output_p... | [
"Return",
"output",
"class",
"of",
"driver",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/__init__.py#L96-L116 | [
"def",
"load_output_writer",
"(",
"output_params",
",",
"readonly",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"output_params",
",",
"dict",
")",
":",
"raise",
"TypeError",
"(",
"\"output_params must be a dictionary\"",
")",
"driver_name",
"=",
"outpu... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | load_input_reader | Return input class of driver.
Returns
-------
input_params : ``InputData``
input parameters | mapchete/formats/__init__.py | def load_input_reader(input_params, readonly=False):
"""
Return input class of driver.
Returns
-------
input_params : ``InputData``
input parameters
"""
logger.debug("find input reader with params %s", input_params)
if not isinstance(input_params, dict):
raise TypeError(... | def load_input_reader(input_params, readonly=False):
"""
Return input class of driver.
Returns
-------
input_params : ``InputData``
input parameters
"""
logger.debug("find input reader with params %s", input_params)
if not isinstance(input_params, dict):
raise TypeError(... | [
"Return",
"input",
"class",
"of",
"driver",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/__init__.py#L119-L148 | [
"def",
"load_input_reader",
"(",
"input_params",
",",
"readonly",
"=",
"False",
")",
":",
"logger",
".",
"debug",
"(",
"\"find input reader with params %s\"",
",",
"input_params",
")",
"if",
"not",
"isinstance",
"(",
"input_params",
",",
"dict",
")",
":",
"raise... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | driver_from_file | Guess driver from file extension.
Returns
-------
driver : string
driver name | mapchete/formats/__init__.py | def driver_from_file(input_file):
"""
Guess driver from file extension.
Returns
-------
driver : string
driver name
"""
file_ext = os.path.splitext(input_file)[1].split(".")[1]
if file_ext not in _file_ext_to_driver():
raise MapcheteDriverError(
"no driver co... | def driver_from_file(input_file):
"""
Guess driver from file extension.
Returns
-------
driver : string
driver name
"""
file_ext = os.path.splitext(input_file)[1].split(".")[1]
if file_ext not in _file_ext_to_driver():
raise MapcheteDriverError(
"no driver co... | [
"Guess",
"driver",
"from",
"file",
"extension",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/__init__.py#L151-L172 | [
"def",
"driver_from_file",
"(",
"input_file",
")",
":",
"file_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"input_file",
")",
"[",
"1",
"]",
".",
"split",
"(",
"\".\"",
")",
"[",
"1",
"]",
"if",
"file_ext",
"not",
"in",
"_file_ext_to_driver",
"(... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | write_output_metadata | Dump output JSON and verify parameters if output metadata exist. | mapchete/formats/__init__.py | def write_output_metadata(output_params):
"""Dump output JSON and verify parameters if output metadata exist."""
if "path" in output_params:
metadata_path = os.path.join(output_params["path"], "metadata.json")
logger.debug("check for output %s", metadata_path)
try:
existing_p... | def write_output_metadata(output_params):
"""Dump output JSON and verify parameters if output metadata exist."""
if "path" in output_params:
metadata_path = os.path.join(output_params["path"], "metadata.json")
logger.debug("check for output %s", metadata_path)
try:
existing_p... | [
"Dump",
"output",
"JSON",
"and",
"verify",
"parameters",
"if",
"output",
"metadata",
"exist",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/__init__.py#L226-L259 | [
"def",
"write_output_metadata",
"(",
"output_params",
")",
":",
"if",
"\"path\"",
"in",
"output_params",
":",
"metadata_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"output_params",
"[",
"\"path\"",
"]",
",",
"\"metadata.json\"",
")",
"logger",
".",
"debug... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | formats | List input and/or output formats. | mapchete/cli/default/formats.py | def formats(input_formats, output_formats, debug=False):
"""List input and/or output formats."""
if input_formats == output_formats:
show_inputs, show_outputs = True, True
else:
show_inputs, show_outputs = input_formats, output_formats
if show_inputs:
click.echo("input formats:"... | def formats(input_formats, output_formats, debug=False):
"""List input and/or output formats."""
if input_formats == output_formats:
show_inputs, show_outputs = True, True
else:
show_inputs, show_outputs = input_formats, output_formats
if show_inputs:
click.echo("input formats:"... | [
"List",
"input",
"and",
"/",
"or",
"output",
"formats",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/cli/default/formats.py#L13-L27 | [
"def",
"formats",
"(",
"input_formats",
",",
"output_formats",
",",
"debug",
"=",
"False",
")",
":",
"if",
"input_formats",
"==",
"output_formats",
":",
"show_inputs",
",",
"show_outputs",
"=",
"True",
",",
"True",
"else",
":",
"show_inputs",
",",
"show_output... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputData.open | Return InputTile object.
Parameters
----------
tile : ``Tile``
tile_directory_zoom : None
If set, data will be read from exactly this zoom level
matching_method : str ('gdal' or 'min') (default: 'gdal')
gdal: Uses GDAL's standard method. Here, the target ... | mapchete/formats/default/tile_directory.py | def open(
self,
tile,
tile_directory_zoom=None,
matching_method="gdal",
matching_max_zoom=None,
matching_precision=8,
fallback_to_higher_zoom=False,
resampling="nearest",
**kwargs
):
"""
Return InputTile object.
Paramet... | def open(
self,
tile,
tile_directory_zoom=None,
matching_method="gdal",
matching_max_zoom=None,
matching_precision=8,
fallback_to_higher_zoom=False,
resampling="nearest",
**kwargs
):
"""
Return InputTile object.
Paramet... | [
"Return",
"InputTile",
"object",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/tile_directory.py#L131-L224 | [
"def",
"open",
"(",
"self",
",",
"tile",
",",
"tile_directory_zoom",
"=",
"None",
",",
"matching_method",
"=",
"\"gdal\"",
",",
"matching_max_zoom",
"=",
"None",
",",
"matching_precision",
"=",
"8",
",",
"fallback_to_higher_zoom",
"=",
"False",
",",
"resampling"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputData.bbox | Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object | mapchete/formats/default/tile_directory.py | def bbox(self, out_crs=None):
"""
Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object... | def bbox(self, out_crs=None):
"""
Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object... | [
"Return",
"data",
"bounding",
"box",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/tile_directory.py#L226-L244 | [
"def",
"bbox",
"(",
"self",
",",
"out_crs",
"=",
"None",
")",
":",
"return",
"reproject_geometry",
"(",
"box",
"(",
"*",
"self",
".",
"_bounds",
")",
",",
"src_crs",
"=",
"self",
".",
"td_pyramid",
".",
"crs",
",",
"dst_crs",
"=",
"self",
".",
"pyram... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputTile.read | Read reprojected & resampled input data.
Parameters
----------
validity_check : bool
vector file: also run checks if reprojected geometry is valid,
otherwise throw RuntimeError (default: True)
indexes : list or int
raster file: a list of band numbers... | mapchete/formats/default/tile_directory.py | def read(
self,
validity_check=False,
indexes=None,
resampling=None,
dst_nodata=None,
gdal_opts=None,
**kwargs
):
"""
Read reprojected & resampled input data.
Parameters
----------
validity_check : bool
vect... | def read(
self,
validity_check=False,
indexes=None,
resampling=None,
dst_nodata=None,
gdal_opts=None,
**kwargs
):
"""
Read reprojected & resampled input data.
Parameters
----------
validity_check : bool
vect... | [
"Read",
"reprojected",
"&",
"resampled",
"input",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/tile_directory.py#L288-L330 | [
"def",
"read",
"(",
"self",
",",
"validity_check",
"=",
"False",
",",
"indexes",
"=",
"None",
",",
"resampling",
"=",
"None",
",",
"dst_nodata",
"=",
"None",
",",
"gdal_opts",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_r... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | extract_contours | Extract contour lines from an array.
Parameters
----------
array : array
input elevation data
tile : Tile
tile covering the array
interval : integer
elevation value interval when drawing contour lines
field : string
output field name containing elevation value
... | mapchete/commons/contours.py | def extract_contours(array, tile, interval=100, field='elev', base=0):
"""
Extract contour lines from an array.
Parameters
----------
array : array
input elevation data
tile : Tile
tile covering the array
interval : integer
elevation value interval when drawing conto... | def extract_contours(array, tile, interval=100, field='elev', base=0):
"""
Extract contour lines from an array.
Parameters
----------
array : array
input elevation data
tile : Tile
tile covering the array
interval : integer
elevation value interval when drawing conto... | [
"Extract",
"contour",
"lines",
"from",
"an",
"array",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/commons/contours.py#L6-L55 | [
"def",
"extract_contours",
"(",
"array",
",",
"tile",
",",
"interval",
"=",
"100",
",",
"field",
"=",
"'elev'",
",",
"base",
"=",
"0",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"levels",
"=",
"_get_contour_values",
"(",
"array",
".",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _get_contour_values | Return a list of values between min and max within an interval. | mapchete/commons/contours.py | def _get_contour_values(min_val, max_val, base=0, interval=100):
"""Return a list of values between min and max within an interval."""
i = base
out = []
if min_val < base:
while i >= min_val:
i -= interval
while i <= max_val:
if i >= min_val:
out.append(i)
... | def _get_contour_values(min_val, max_val, base=0, interval=100):
"""Return a list of values between min and max within an interval."""
i = base
out = []
if min_val < base:
while i >= min_val:
i -= interval
while i <= max_val:
if i >= min_val:
out.append(i)
... | [
"Return",
"a",
"list",
"of",
"values",
"between",
"min",
"and",
"max",
"within",
"an",
"interval",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/commons/contours.py#L58-L69 | [
"def",
"_get_contour_values",
"(",
"min_val",
",",
"max_val",
",",
"base",
"=",
"0",
",",
"interval",
"=",
"100",
")",
":",
"i",
"=",
"base",
"out",
"=",
"[",
"]",
"if",
"min_val",
"<",
"base",
":",
"while",
"i",
">=",
"min_val",
":",
"i",
"-=",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | create | Create an empty Mapchete and process file in a given directory. | mapchete/cli/default/create.py | def create(
mapchete_file,
process_file,
out_format,
out_path=None,
pyramid_type=None,
force=False
):
"""Create an empty Mapchete and process file in a given directory."""
if os.path.isfile(process_file) or os.path.isfile(mapchete_file):
if not force:
raise IOError("f... | def create(
mapchete_file,
process_file,
out_format,
out_path=None,
pyramid_type=None,
force=False
):
"""Create an empty Mapchete and process file in a given directory."""
if os.path.isfile(process_file) or os.path.isfile(mapchete_file):
if not force:
raise IOError("f... | [
"Create",
"an",
"empty",
"Mapchete",
"and",
"process",
"file",
"in",
"a",
"given",
"directory",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/cli/default/create.py#L49-L91 | [
"def",
"create",
"(",
"mapchete_file",
",",
"process_file",
",",
"out_format",
",",
"out_path",
"=",
"None",
",",
"pyramid_type",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"process_file",
")",
"or",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.tiles_exist | Check whether output tiles of a tile (either process or output) exists.
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
output_tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
... | mapchete/formats/base.py | def tiles_exist(self, process_tile=None, output_tile=None):
"""
Check whether output tiles of a tile (either process or output) exists.
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
output_tile : ``BufferedTil... | def tiles_exist(self, process_tile=None, output_tile=None):
"""
Check whether output tiles of a tile (either process or output) exists.
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
output_tile : ``BufferedTil... | [
"Check",
"whether",
"output",
"tiles",
"of",
"a",
"tile",
"(",
"either",
"process",
"or",
"output",
")",
"exists",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/base.py#L216-L239 | [
"def",
"tiles_exist",
"(",
"self",
",",
"process_tile",
"=",
"None",
",",
"output_tile",
"=",
"None",
")",
":",
"if",
"process_tile",
"and",
"output_tile",
":",
"raise",
"ValueError",
"(",
"\"just one of 'process_tile' and 'output_tile' allowed\"",
")",
"if",
"proce... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.get_path | Determine target file path.
Parameters
----------
tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
path : string | mapchete/formats/base.py | def get_path(self, tile):
"""
Determine target file path.
Parameters
----------
tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
path : string
"""
return os.path.join(*[
self.path,
... | def get_path(self, tile):
"""
Determine target file path.
Parameters
----------
tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
path : string
"""
return os.path.join(*[
self.path,
... | [
"Determine",
"target",
"file",
"path",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/base.py#L256-L274 | [
"def",
"get_path",
"(",
"self",
",",
"tile",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"*",
"[",
"self",
".",
"path",
",",
"str",
"(",
"tile",
".",
"zoom",
")",
",",
"str",
"(",
"tile",
".",
"row",
")",
",",
"str",
"(",
"tile",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.prepare_path | Create directory and subdirectory if necessary.
Parameters
----------
tile : ``BufferedTile``
must be member of output ``TilePyramid`` | mapchete/formats/base.py | def prepare_path(self, tile):
"""
Create directory and subdirectory if necessary.
Parameters
----------
tile : ``BufferedTile``
must be member of output ``TilePyramid``
"""
makedirs(os.path.dirname(self.get_path(tile))) | def prepare_path(self, tile):
"""
Create directory and subdirectory if necessary.
Parameters
----------
tile : ``BufferedTile``
must be member of output ``TilePyramid``
"""
makedirs(os.path.dirname(self.get_path(tile))) | [
"Create",
"directory",
"and",
"subdirectory",
"if",
"necessary",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/base.py#L276-L285 | [
"def",
"prepare_path",
"(",
"self",
",",
"tile",
")",
":",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"self",
".",
"get_path",
"(",
"tile",
")",
")",
")"
] | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.output_is_valid | Check whether process output is allowed with output driver.
Parameters
----------
process_data : raw process output
Returns
-------
True or False | mapchete/formats/base.py | def output_is_valid(self, process_data):
"""
Check whether process output is allowed with output driver.
Parameters
----------
process_data : raw process output
Returns
-------
True or False
"""
if self.METADATA["data_type"] == "raster":
... | def output_is_valid(self, process_data):
"""
Check whether process output is allowed with output driver.
Parameters
----------
process_data : raw process output
Returns
-------
True or False
"""
if self.METADATA["data_type"] == "raster":
... | [
"Check",
"whether",
"process",
"output",
"is",
"allowed",
"with",
"output",
"driver",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/base.py#L318-L336 | [
"def",
"output_is_valid",
"(",
"self",
",",
"process_data",
")",
":",
"if",
"self",
".",
"METADATA",
"[",
"\"data_type\"",
"]",
"==",
"\"raster\"",
":",
"return",
"(",
"is_numpy_or_masked_array",
"(",
"process_data",
")",
"or",
"is_numpy_or_masked_array_with_tags",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.output_cleaned | Return verified and cleaned output.
Parameters
----------
process_data : raw process output
Returns
-------
NumPy array or list of features. | mapchete/formats/base.py | def output_cleaned(self, process_data):
"""
Return verified and cleaned output.
Parameters
----------
process_data : raw process output
Returns
-------
NumPy array or list of features.
"""
if self.METADATA["data_type"] == "raster":
... | def output_cleaned(self, process_data):
"""
Return verified and cleaned output.
Parameters
----------
process_data : raw process output
Returns
-------
NumPy array or list of features.
"""
if self.METADATA["data_type"] == "raster":
... | [
"Return",
"verified",
"and",
"cleaned",
"output",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/base.py#L338-L357 | [
"def",
"output_cleaned",
"(",
"self",
",",
"process_data",
")",
":",
"if",
"self",
".",
"METADATA",
"[",
"\"data_type\"",
"]",
"==",
"\"raster\"",
":",
"if",
"is_numpy_or_masked_array",
"(",
"process_data",
")",
":",
"return",
"process_data",
"elif",
"is_numpy_o... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.extract_subset | Extract subset from multiple tiles.
input_data_tiles : list of (``Tile``, process data) tuples
out_tile : ``Tile``
Returns
-------
NumPy array or list of features. | mapchete/formats/base.py | def extract_subset(self, input_data_tiles=None, out_tile=None):
"""
Extract subset from multiple tiles.
input_data_tiles : list of (``Tile``, process data) tuples
out_tile : ``Tile``
Returns
-------
NumPy array or list of features.
"""
if self.ME... | def extract_subset(self, input_data_tiles=None, out_tile=None):
"""
Extract subset from multiple tiles.
input_data_tiles : list of (``Tile``, process data) tuples
out_tile : ``Tile``
Returns
-------
NumPy array or list of features.
"""
if self.ME... | [
"Extract",
"subset",
"from",
"multiple",
"tiles",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/base.py#L359-L387 | [
"def",
"extract_subset",
"(",
"self",
",",
"input_data_tiles",
"=",
"None",
",",
"out_tile",
"=",
"None",
")",
":",
"if",
"self",
".",
"METADATA",
"[",
"\"data_type\"",
"]",
"==",
"\"raster\"",
":",
"mosaic",
"=",
"create_mosaic",
"(",
"input_data_tiles",
")... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData._read_as_tiledir | Read reprojected & resampled input data.
Parameters
----------
validity_check : bool
vector file: also run checks if reprojected geometry is valid,
otherwise throw RuntimeError (default: True)
indexes : list or int
raster file: a list of band numbers... | mapchete/formats/base.py | def _read_as_tiledir(
self,
out_tile=None,
td_crs=None,
tiles_paths=None,
profile=None,
validity_check=False,
indexes=None,
resampling=None,
dst_nodata=None,
gdal_opts=None,
**kwargs
):
"""
Read reprojected & res... | def _read_as_tiledir(
self,
out_tile=None,
td_crs=None,
tiles_paths=None,
profile=None,
validity_check=False,
indexes=None,
resampling=None,
dst_nodata=None,
gdal_opts=None,
**kwargs
):
"""
Read reprojected & res... | [
"Read",
"reprojected",
"&",
"resampled",
"input",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/base.py#L400-L446 | [
"def",
"_read_as_tiledir",
"(",
"self",
",",
"out_tile",
"=",
"None",
",",
"td_crs",
"=",
"None",
",",
"tiles_paths",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"validity_check",
"=",
"False",
",",
"indexes",
"=",
"None",
",",
"resampling",
"=",
"Non... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | calculate_slope_aspect | Calculate slope and aspect map.
Return a pair of arrays 2 pixels smaller than the input elevation array.
Slope is returned in radians, from 0 for sheer face to pi/2 for
flat ground. Aspect is returned in radians, counterclockwise from -pi
at north around to pi.
Logic here is borrowed from hillsha... | mapchete/commons/hillshade.py | def calculate_slope_aspect(elevation, xres, yres, z=1.0, scale=1.0):
"""
Calculate slope and aspect map.
Return a pair of arrays 2 pixels smaller than the input elevation array.
Slope is returned in radians, from 0 for sheer face to pi/2 for
flat ground. Aspect is returned in radians, counterclock... | def calculate_slope_aspect(elevation, xres, yres, z=1.0, scale=1.0):
"""
Calculate slope and aspect map.
Return a pair of arrays 2 pixels smaller than the input elevation array.
Slope is returned in radians, from 0 for sheer face to pi/2 for
flat ground. Aspect is returned in radians, counterclock... | [
"Calculate",
"slope",
"and",
"aspect",
"map",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/commons/hillshade.py#L42-L92 | [
"def",
"calculate_slope_aspect",
"(",
"elevation",
",",
"xres",
",",
"yres",
",",
"z",
"=",
"1.0",
",",
"scale",
"=",
"1.0",
")",
":",
"z",
"=",
"float",
"(",
"z",
")",
"scale",
"=",
"float",
"(",
"scale",
")",
"height",
",",
"width",
"=",
"elevati... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | hillshade | Return hillshaded numpy array.
Parameters
----------
elevation : array
input elevation data
tile : Tile
tile covering the array
z : float
vertical exaggeration factor
scale : float
scale factor of pixel size units versus height units (insert 112000
when h... | mapchete/commons/hillshade.py | def hillshade(elevation, tile, azimuth=315.0, altitude=45.0, z=1.0, scale=1.0):
"""
Return hillshaded numpy array.
Parameters
----------
elevation : array
input elevation data
tile : Tile
tile covering the array
z : float
vertical exaggeration factor
scale : floa... | def hillshade(elevation, tile, azimuth=315.0, altitude=45.0, z=1.0, scale=1.0):
"""
Return hillshaded numpy array.
Parameters
----------
elevation : array
input elevation data
tile : Tile
tile covering the array
z : float
vertical exaggeration factor
scale : floa... | [
"Return",
"hillshaded",
"numpy",
"array",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/commons/hillshade.py#L95-L129 | [
"def",
"hillshade",
"(",
"elevation",
",",
"tile",
",",
"azimuth",
"=",
"315.0",
",",
"altitude",
"=",
"45.0",
",",
"z",
"=",
"1.0",
",",
"scale",
"=",
"1.0",
")",
":",
"azimuth",
"=",
"float",
"(",
"azimuth",
")",
"altitude",
"=",
"float",
"(",
"a... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | BufferedTilePyramid.tile | Return ``BufferedTile`` object of this ``BufferedTilePyramid``.
Parameters
----------
zoom : integer
zoom level
row : integer
tile matrix row
col : integer
tile matrix column
Returns
-------
buffered tile : ``BufferedT... | mapchete/tile.py | def tile(self, zoom, row, col):
"""
Return ``BufferedTile`` object of this ``BufferedTilePyramid``.
Parameters
----------
zoom : integer
zoom level
row : integer
tile matrix row
col : integer
tile matrix column
Returns... | def tile(self, zoom, row, col):
"""
Return ``BufferedTile`` object of this ``BufferedTilePyramid``.
Parameters
----------
zoom : integer
zoom level
row : integer
tile matrix row
col : integer
tile matrix column
Returns... | [
"Return",
"BufferedTile",
"object",
"of",
"this",
"BufferedTilePyramid",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/tile.py#L42-L60 | [
"def",
"tile",
"(",
"self",
",",
"zoom",
",",
"row",
",",
"col",
")",
":",
"tile",
"=",
"self",
".",
"tile_pyramid",
".",
"tile",
"(",
"zoom",
",",
"row",
",",
"col",
")",
"return",
"BufferedTile",
"(",
"tile",
",",
"pixelbuffer",
"=",
"self",
".",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | BufferedTilePyramid.tiles_from_bounds | Return all tiles intersecting with bounds.
Bounds values will be cleaned if they cross the antimeridian or are
outside of the Northern or Southern tile pyramid bounds.
Parameters
----------
bounds : tuple
(left, bottom, right, top) bounding values in tile pyramid CR... | mapchete/tile.py | def tiles_from_bounds(self, bounds, zoom):
"""
Return all tiles intersecting with bounds.
Bounds values will be cleaned if they cross the antimeridian or are
outside of the Northern or Southern tile pyramid bounds.
Parameters
----------
bounds : tuple
... | def tiles_from_bounds(self, bounds, zoom):
"""
Return all tiles intersecting with bounds.
Bounds values will be cleaned if they cross the antimeridian or are
outside of the Northern or Southern tile pyramid bounds.
Parameters
----------
bounds : tuple
... | [
"Return",
"all",
"tiles",
"intersecting",
"with",
"bounds",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/tile.py#L62-L82 | [
"def",
"tiles_from_bounds",
"(",
"self",
",",
"bounds",
",",
"zoom",
")",
":",
"for",
"tile",
"in",
"self",
".",
"tiles_from_bbox",
"(",
"box",
"(",
"*",
"bounds",
")",
",",
"zoom",
")",
":",
"yield",
"self",
".",
"tile",
"(",
"*",
"tile",
".",
"id... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | BufferedTilePyramid.tiles_from_bbox | All metatiles intersecting with given bounding box.
Parameters
----------
geometry : ``shapely.geometry``
zoom : integer
zoom level
Yields
------
intersecting tiles : generator
generates ``BufferedTiles`` | mapchete/tile.py | def tiles_from_bbox(self, geometry, zoom):
"""
All metatiles intersecting with given bounding box.
Parameters
----------
geometry : ``shapely.geometry``
zoom : integer
zoom level
Yields
------
intersecting tiles : generator
... | def tiles_from_bbox(self, geometry, zoom):
"""
All metatiles intersecting with given bounding box.
Parameters
----------
geometry : ``shapely.geometry``
zoom : integer
zoom level
Yields
------
intersecting tiles : generator
... | [
"All",
"metatiles",
"intersecting",
"with",
"given",
"bounding",
"box",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/tile.py#L84-L100 | [
"def",
"tiles_from_bbox",
"(",
"self",
",",
"geometry",
",",
"zoom",
")",
":",
"for",
"tile",
"in",
"self",
".",
"tile_pyramid",
".",
"tiles_from_bbox",
"(",
"geometry",
",",
"zoom",
")",
":",
"yield",
"self",
".",
"tile",
"(",
"*",
"tile",
".",
"id",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | BufferedTilePyramid.tiles_from_geom | Return all tiles intersecting with input geometry.
Parameters
----------
geometry : ``shapely.geometry``
zoom : integer
zoom level
Yields
------
intersecting tiles : ``BufferedTile`` | mapchete/tile.py | def tiles_from_geom(self, geometry, zoom):
"""
Return all tiles intersecting with input geometry.
Parameters
----------
geometry : ``shapely.geometry``
zoom : integer
zoom level
Yields
------
intersecting tiles : ``BufferedTile``
... | def tiles_from_geom(self, geometry, zoom):
"""
Return all tiles intersecting with input geometry.
Parameters
----------
geometry : ``shapely.geometry``
zoom : integer
zoom level
Yields
------
intersecting tiles : ``BufferedTile``
... | [
"Return",
"all",
"tiles",
"intersecting",
"with",
"input",
"geometry",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/tile.py#L102-L117 | [
"def",
"tiles_from_geom",
"(",
"self",
",",
"geometry",
",",
"zoom",
")",
":",
"for",
"tile",
"in",
"self",
".",
"tile_pyramid",
".",
"tiles_from_geom",
"(",
"geometry",
",",
"zoom",
")",
":",
"yield",
"self",
".",
"tile",
"(",
"*",
"tile",
".",
"id",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | BufferedTilePyramid.intersecting | Return all BufferedTiles intersecting with tile.
Parameters
----------
tile : ``BufferedTile``
another tile | mapchete/tile.py | def intersecting(self, tile):
"""
Return all BufferedTiles intersecting with tile.
Parameters
----------
tile : ``BufferedTile``
another tile
"""
return [
self.tile(*intersecting_tile.id)
for intersecting_tile in self.tile_pyra... | def intersecting(self, tile):
"""
Return all BufferedTiles intersecting with tile.
Parameters
----------
tile : ``BufferedTile``
another tile
"""
return [
self.tile(*intersecting_tile.id)
for intersecting_tile in self.tile_pyra... | [
"Return",
"all",
"BufferedTiles",
"intersecting",
"with",
"tile",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/tile.py#L119-L131 | [
"def",
"intersecting",
"(",
"self",
",",
"tile",
")",
":",
"return",
"[",
"self",
".",
"tile",
"(",
"*",
"intersecting_tile",
".",
"id",
")",
"for",
"intersecting_tile",
"in",
"self",
".",
"tile_pyramid",
".",
"intersecting",
"(",
"tile",
")",
"]"
] | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | BufferedTilePyramid.to_dict | Return dictionary representation of pyramid parameters. | mapchete/tile.py | def to_dict(self):
"""
Return dictionary representation of pyramid parameters.
"""
return dict(
grid=self.grid.to_dict(),
metatiling=self.metatiling,
tile_size=self.tile_size,
pixelbuffer=self.pixelbuffer
) | def to_dict(self):
"""
Return dictionary representation of pyramid parameters.
"""
return dict(
grid=self.grid.to_dict(),
metatiling=self.metatiling,
tile_size=self.tile_size,
pixelbuffer=self.pixelbuffer
) | [
"Return",
"dictionary",
"representation",
"of",
"pyramid",
"parameters",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/tile.py#L133-L142 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"grid",
"=",
"self",
".",
"grid",
".",
"to_dict",
"(",
")",
",",
"metatiling",
"=",
"self",
".",
"metatiling",
",",
"tile_size",
"=",
"self",
".",
"tile_size",
",",
"pixelbuffer",
"=",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | BufferedTile.get_children | Get tile children (intersecting tiles in next zoom level).
Returns
-------
children : list
a list of ``BufferedTiles`` | mapchete/tile.py | def get_children(self):
"""
Get tile children (intersecting tiles in next zoom level).
Returns
-------
children : list
a list of ``BufferedTiles``
"""
return [BufferedTile(t, self.pixelbuffer) for t in self._tile.get_children()] | def get_children(self):
"""
Get tile children (intersecting tiles in next zoom level).
Returns
-------
children : list
a list of ``BufferedTiles``
"""
return [BufferedTile(t, self.pixelbuffer) for t in self._tile.get_children()] | [
"Get",
"tile",
"children",
"(",
"intersecting",
"tiles",
"in",
"next",
"zoom",
"level",
")",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/tile.py#L239-L248 | [
"def",
"get_children",
"(",
"self",
")",
":",
"return",
"[",
"BufferedTile",
"(",
"t",
",",
"self",
".",
"pixelbuffer",
")",
"for",
"t",
"in",
"self",
".",
"_tile",
".",
"get_children",
"(",
")",
"]"
] | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | BufferedTile.get_neighbors | Return tile neighbors.
Tile neighbors are unique, i.e. in some edge cases, where both the left
and right neighbor wrapped around the antimeridian is the same. Also,
neighbors ouside the northern and southern TilePyramid boundaries are
excluded, because they are invalid.
-------... | mapchete/tile.py | def get_neighbors(self, connectedness=8):
"""
Return tile neighbors.
Tile neighbors are unique, i.e. in some edge cases, where both the left
and right neighbor wrapped around the antimeridian is the same. Also,
neighbors ouside the northern and southern TilePyramid boundaries ar... | def get_neighbors(self, connectedness=8):
"""
Return tile neighbors.
Tile neighbors are unique, i.e. in some edge cases, where both the left
and right neighbor wrapped around the antimeridian is the same. Also,
neighbors ouside the northern and southern TilePyramid boundaries ar... | [
"Return",
"tile",
"neighbors",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/tile.py#L260-L289 | [
"def",
"get_neighbors",
"(",
"self",
",",
"connectedness",
"=",
"8",
")",
":",
"return",
"[",
"BufferedTile",
"(",
"t",
",",
"self",
".",
"pixelbuffer",
")",
"for",
"t",
"in",
"self",
".",
"_tile",
".",
"get_neighbors",
"(",
"connectedness",
"=",
"connec... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | BufferedTile.is_on_edge | Determine whether tile touches or goes over pyramid edge. | mapchete/tile.py | def is_on_edge(self):
"""Determine whether tile touches or goes over pyramid edge."""
return (
self.left <= self.tile_pyramid.left or # touches_left
self.bottom <= self.tile_pyramid.bottom or # touches_bottom
self.right >= self.tile_pyramid.right or # touches... | def is_on_edge(self):
"""Determine whether tile touches or goes over pyramid edge."""
return (
self.left <= self.tile_pyramid.left or # touches_left
self.bottom <= self.tile_pyramid.bottom or # touches_bottom
self.right >= self.tile_pyramid.right or # touches... | [
"Determine",
"whether",
"tile",
"touches",
"or",
"goes",
"over",
"pyramid",
"edge",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/tile.py#L291-L298 | [
"def",
"is_on_edge",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"left",
"<=",
"self",
".",
"tile_pyramid",
".",
"left",
"or",
"# touches_left",
"self",
".",
"bottom",
"<=",
"self",
".",
"tile_pyramid",
".",
"bottom",
"or",
"# touches_bottom",
"self... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.