Documentation overhaul

This fixes a bunch of sidebar issues caused by inconsistent
headers.
This commit is contained in:
Sean C. Gillies 2018-04-23 15:53:41 -06:00
parent cb55493d75
commit aece4fb60c
72 changed files with 493 additions and 220 deletions

View File

@ -1,37 +1,6 @@
rasterio package
================
Submodules
----------
Python API Reference
====================
.. toctree::
rasterio.compat
rasterio.coords
rasterio.crs
rasterio.drivers
rasterio.dtypes
rasterio.enums
rasterio.env
rasterio.errors
rasterio.features
rasterio.fill
rasterio.io
rasterio.mask
rasterio.merge
rasterio.plot
rasterio.profiles
rasterio.sample
rasterio.transform
rasterio.vfs
rasterio.vrt
rasterio.warp
rasterio.windows
Module contents
---------------
.. automodule:: rasterio
:members:
:undoc-members:
:show-inheritance:
rasterio

7
docs/api/modules.rst Normal file
View File

@ -0,0 +1,7 @@
rasterio
========
.. toctree::
:maxdepth: 4
rasterio

View File

@ -0,0 +1,7 @@
rasterio.\_base module
======================
.. automodule:: rasterio._base
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_crs module
=====================
.. automodule:: rasterio._crs
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_env module
=====================
.. automodule:: rasterio._env
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_err module
=====================
.. automodule:: rasterio._err
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_example module
=========================
.. automodule:: rasterio._example
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_features module
==========================
.. automodule:: rasterio._features
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_fill module
======================
.. automodule:: rasterio._fill
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_gdal1 module
=======================
.. automodule:: rasterio._gdal1
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_io module
====================
.. automodule:: rasterio._io
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_shim module
======================
.. automodule:: rasterio._shim
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_shim1 module
=======================
.. automodule:: rasterio._shim1
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_shim20 module
========================
.. automodule:: rasterio._shim20
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_shim21 module
========================
.. automodule:: rasterio._shim21
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.\_warp module
======================
.. automodule:: rasterio._warp
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.control module
=======================
.. automodule:: rasterio.control
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.blocks module
==========================
.. automodule:: rasterio.rio.blocks
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.bounds module
==========================
.. automodule:: rasterio.rio.bounds
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.calc module
========================
.. automodule:: rasterio.rio.calc
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.clip module
========================
.. automodule:: rasterio.rio.clip
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.convert module
===========================
.. automodule:: rasterio.rio.convert
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.edit\_info module
==============================
.. automodule:: rasterio.rio.edit_info
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.env module
=======================
.. automodule:: rasterio.rio.env
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.gcps module
========================
.. automodule:: rasterio.rio.gcps
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.helpers module
===========================
.. automodule:: rasterio.rio.helpers
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.info module
========================
.. automodule:: rasterio.rio.info
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.insp module
========================
.. automodule:: rasterio.rio.insp
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.main module
========================
.. automodule:: rasterio.rio.main
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.mask module
========================
.. automodule:: rasterio.rio.mask
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.merge module
=========================
.. automodule:: rasterio.rio.merge
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.options module
===========================
.. automodule:: rasterio.rio.options
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.overview module
============================
.. automodule:: rasterio.rio.overview
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.rasterize module
=============================
.. automodule:: rasterio.rio.rasterize
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.rm module
======================
.. automodule:: rasterio.rio.rm
:members:
:undoc-members:
:show-inheritance:

39
docs/api/rasterio.rio.rst Normal file
View File

@ -0,0 +1,39 @@
rasterio.rio package
====================
Submodules
----------
.. toctree::
rasterio.rio.blocks
rasterio.rio.bounds
rasterio.rio.calc
rasterio.rio.clip
rasterio.rio.convert
rasterio.rio.edit_info
rasterio.rio.env
rasterio.rio.gcps
rasterio.rio.helpers
rasterio.rio.info
rasterio.rio.insp
rasterio.rio.main
rasterio.rio.mask
rasterio.rio.merge
rasterio.rio.options
rasterio.rio.overview
rasterio.rio.rasterize
rasterio.rio.rm
rasterio.rio.sample
rasterio.rio.shapes
rasterio.rio.stack
rasterio.rio.transform
rasterio.rio.warp
Module contents
---------------
.. automodule:: rasterio.rio
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.sample module
==========================
.. automodule:: rasterio.rio.sample
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.shapes module
==========================
.. automodule:: rasterio.rio.shapes
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.stack module
=========================
.. automodule:: rasterio.rio.stack
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.transform module
=============================
.. automodule:: rasterio.rio.transform
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.rio.warp module
========================
.. automodule:: rasterio.rio.warp
:members:
:undoc-members:
:show-inheritance:

61
docs/api/rasterio.rst Normal file
View File

@ -0,0 +1,61 @@
rasterio package
================
Subpackages
-----------
.. toctree::
rasterio.rio
Submodules
----------
.. toctree::
rasterio._base
rasterio._crs
rasterio._env
rasterio._err
rasterio._example
rasterio._features
rasterio._fill
rasterio._gdal1
rasterio._io
rasterio._shim
rasterio._shim1
rasterio._shim20
rasterio._shim21
rasterio._warp
rasterio.compat
rasterio.control
rasterio.coords
rasterio.crs
rasterio.drivers
rasterio.dtypes
rasterio.enums
rasterio.env
rasterio.errors
rasterio.features
rasterio.fill
rasterio.io
rasterio.mask
rasterio.merge
rasterio.plot
rasterio.profiles
rasterio.sample
rasterio.shutil
rasterio.tools
rasterio.transform
rasterio.vfs
rasterio.vrt
rasterio.warp
rasterio.windows
Module contents
---------------
.. automodule:: rasterio
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.shutil module
======================
.. automodule:: rasterio.shutil
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.tools module
=====================
.. automodule:: rasterio.tools
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
rasterio.vrt module
===================
.. automodule:: rasterio.vrt
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,18 +1,17 @@
========================
Command Line Users Guide
========================
Command Line User Guide
=======================
Rasterio's command line interface is a program named ``rio``.
Rasterio's command line interface (CLI) is a program named "rio" [#]_.
``rio`` allows you to build workflows using shell commands, either
interactively at the command prompt or with a script. Most common
cases are covered by ``rio`` commands and it is often more convenient
The CLI allows you to build workflows using shell commands, either
interactively at the command prompt or with a script. Many common
cases are covered by CLI sub-commands and it is often more convenient
to use a ready-made command as opposed to implementing similar functionality
as a python script.
``rio`` is developed using the `Click <http://click.pocoo.org/>`__ architecture.
Its plugin system allows external modules to share a common namespace and
handling of context variables.
The rio program is developed using the `Click <http://click.pocoo.org/>`__
framwork. Its plugin system allows external modules to share a common
namespace and handling of context variables.
.. code-block:: console
@ -171,10 +170,6 @@ The command above is also an example of a calculation that is far beyond the
design of the calc command and something that could be done much more
efficiently in Python.
.. toctree::
calc
clip
----
@ -689,3 +684,7 @@ Other commands?
---------------
Suggestions for other commands are welcome!
.. [#] In some Linux distributions "rio" may instead refer to the command line
Diamond Rio MP3 player controller. This conflict can be avoided by
installing Rasterio in an isolated Python environment.

View File

@ -5,10 +5,11 @@ Contributing
Additional Information
----------------------
More technical information lives on the wiki.
* https://github.com/mapbox/rasterio/wiki/Development-Guide
* https://github.com/mapbox/rasterio/wiki/Exposing-GDAL-Functionality
* https://github.com/mapbox/rasterio/wiki/Cython-and-GDAL
More technical information lives on the wiki.
The long term goal is to consolidate into this document.
* https://github.com/mapbox/rasterio/wiki/Development-Guide
* https://github.com/mapbox/rasterio/wiki/Exposing-GDAL-Functionality
* https://github.com/mapbox/rasterio/wiki/Cython-and-GDAL
The long term goal is to consolidate into this document.

View File

@ -41,73 +41,18 @@ The output of the program:
Rasterio supports Python versions 2.7 and 3.3 or higher.
User guide
==========
Start here with some background about the project and an introduction to
reading and writing raster datasets.
.. toctree::
:maxdepth: 2
intro
installation
quickstart
switch
Advanced topics
===============
.. toctree::
:maxdepth: 2
topics/color
topics/concurrency
topics/errors
topics/features
topics/fillnodata
topics/georeferencing
topics/image_options
topics/image_processing
topics/masking-by-shapefile
topics/masks
topics/memory-files
topics/migrating-to-v1
topics/nodata
topics/overviews
topics/plotting
topics/reproject
topics/resampling
topics/tags
topics/virtual-warping
topics/vsi
topics/windowed-rw
API documentation
=================
.. toctree::
:maxdepth: 2
api/index
CLI guide
=========
.. toctree::
:maxdepth: 2
cli
Contributor Guide
=================
.. toctree::
:maxdepth: 2
topics/index
api/index
contributing
Indices and tables
Indices and Tables
==================
* :ref:`genindex`

View File

@ -1,9 +1,8 @@
============
Installation
============
Dependencies
============
------------
Rasterio has one C library dependency: ``GDAL >=1.11``. GDAL itself depends on
many of other libraries provided by most major operating systems and also
@ -15,10 +14,10 @@ click, enum34, numpy``.
Development also requires (see requirements-dev.txt) Cython and other packages.
Installing from binaries
========================
------------------------
OS X
----
****
Binary wheels with the GDAL, GEOS, and PROJ4 libraries included are available
for OS X versions 10.7+ starting with Rasterio version 0.17. To install,
@ -34,7 +33,7 @@ Binary wheels for other operating systems will be available in a future
release.
Windows
-------
*******
Binary wheels for rasterio and GDAL are created by Christoph Gohlke and are
available from his website.
@ -52,7 +51,7 @@ this from the downloads folder:
Installing with Anaconda
=========================
-------------------------
To install rasterio on the Anaconda Python distribution, please visit the
`rasterio conda-forge`_ page for install instructions. This build is maintained
@ -60,7 +59,7 @@ separately from the rasterio distribution on PyPi and packaging issues should
be addressed on the `rasterio conda-forge`_ issue tracker.
Installing from the source distribution
=======================================
---------------------------------------
Rasterio is a Python C extension and to build you'll need a working compiler
(XCode on OS X etc). You'll also need Numpy preinstalled; the Numpy headers are
@ -71,7 +70,7 @@ Travis `configuration
guidance.
Linux
-----
*****
The following commands are adapted from Rasterio's Travis-CI configuration.
@ -85,7 +84,7 @@ The following commands are adapted from Rasterio's Travis-CI configuration.
Adapt them as necessary for your Linux system.
OS X
----
****
For a Homebrew based Python environment, do the following.
@ -95,7 +94,7 @@ For a Homebrew based Python environment, do the following.
$ pip install rasterio
Windows
-------
*******
You can download a binary distribution of GDAL from `here
<http://www.gisinternals.com/release.php>`__. You will also need to download

View File

@ -1,4 +1,3 @@
============
Introduction
============

View File

@ -1,23 +0,0 @@
=================================
``rasterio`` Python User's Manual
=================================
This user's manual is for Python developers who want a clean API for accessing raster data.
.. todo::
What does it do, narrative examples
What it does NOT do
For command line tools look to CLI users manual
.. toctree::
:maxdepth: 2
installation
reading
working_with_datasets
writing
topics
osgeo_gdal_migration

View File

@ -1,6 +1,5 @@
==========
Quickstart
==========
Python Quickstart
=================
Reading and writing data files is a spatial data analyst's bread and butter.
This document explains how to use Rasterio to read existing files and to create
@ -10,7 +9,7 @@ but the examples do apply to other raster data formats. It is presumed that
Rasterio has been `installed <./installation>`__.
Opening a dataset in reading mode
=================================
---------------------------------
Consider an "example.tif" file with 16-bit Landsat 8 imagery covering a part
of the United States's Colorado Plateau [#]_. Because the imagery is large (70
@ -46,7 +45,7 @@ attributes as Python file objects.
False
Dataset attributes
==================
------------------
Properties of the raster data stored in "example.tif" can be accessed through
attributes of the ``dataset`` object. Dataset objects have bands and this
@ -87,7 +86,7 @@ The "example.tif" file's sole band contains unsigned 16-bit integer values. The
GeoTIFF format also supports signed integers and floats of different size.
Dataset georeferencing
======================
----------------------
A GIS raster dataset is different from an ordinary image; its elements (or
"pixels") are mapped to regions on the earth's surface. Every pixels of a
@ -183,7 +182,7 @@ Values from the array can be had by their row, column index.
17491
Spatial indexing
================
----------------
Datasets have a method of getting array indices for spatial points. To get the
value for the pixel 100 kilometers east and 50 kilometers south of the
@ -207,7 +206,7 @@ The coordinates of the center of the image can be computed like this.
(476550.0, 4149150.0)
Creating data
=============
-------------
Reading data is only half the story. Using Rasterio dataset objects, arrays of
values can be written to a raster data file and thus shared with other GIS
@ -238,7 +237,7 @@ below.
Opening a dataset in writing mode
=================================
---------------------------------
To save this array along with georeferencing information to a new raster data
file, call ``rasterio.open()`` with a path to the new file to be created,
@ -289,7 +288,7 @@ directly from attributes of the 2-D array, ``Z``. Not all raster formats can
support the 64-bit float values in ``Z``, but the GeoTIFF format can.
Saving raster data
==================
------------------
To save the grid, call the new dataset's ``write()`` method with the grid and
target band number as arguments.

View File

@ -1,12 +1,11 @@
Color
*****
=====
Color interpretation
^^^^^^^^^^^^^^^^^^^^^
--------------------
Color interpretation of raster bands can be read from the dataset
.. code-block:: python
>>> import rasterio
@ -46,10 +45,6 @@ And the resulting raster will be interpretted as RGB.
... src2.colorinterp[1]
<ColorInterp.green: 4>
Colormaps
^^^^^^^^^
Writing colormaps
-----------------
@ -93,4 +88,3 @@ Reading colormaps
As shown above, the ``colormap()`` returns a dict holding the colormap for the
given band index. For TIFF format files, the colormap will have 256 items, and
all but two of those would map to (0, 0, 0, 0) in the example above.

View File

@ -1,5 +1,5 @@
Concurrent processing
*********************
=====================
Rasterio affords concurrent processing of raster data. The Python GIL is
released when calling GDAL's ``GDALRasterIO()`` function, which means that

View File

@ -1,5 +1,5 @@
Error Handling
**************
==============
.. todo::

View File

@ -1,5 +1,5 @@
Vector Features
***************
===============
Rasterio's ``features`` module provides functions to extract shapes of raster
features and to create new features by "burning" shapes into rasters:

View File

@ -1,5 +1,5 @@
Filling nodata areas
********************
====================
.. todo::

View File

@ -1,5 +1,5 @@
Georeferencing
**************
==============
There are two parts to the georeferencing of raster datasets: the definition
of the local, regional, or global system in which a raster's pixels are

View File

@ -1,5 +1,5 @@
Options
*******
=======
GDAL's format drivers have many `configuration options`_.
These options come in two flavors:

View File

@ -1,5 +1,5 @@
Interoperability
****************
================
.. _imageorder:

View File

@ -1,8 +1,8 @@
General Concepts
================
Advanced Topics
===============
.. toctree::
:maxdepth: 2
:maxdepth: 1
color
concurrency

View File

@ -1,5 +1,5 @@
Nodata Masks
************
============
Nodata masks allow you to identify regions of valid data values. In using Rasterio,
you'll encounter two different kinds of masks.

View File

@ -1,5 +1,5 @@
Overviews
*********
=========
Overviews are reduced resolution versions of your dataset that can speed up
rendering when you don't need full resolution. By precomputing the upsampled

View File

@ -1,5 +1,5 @@
Plotting
********
========
Rasterio reads raster data into numpy arrays so plotting a single band as
two dimensional data can be accomplished directly with ``pyplot``.

View File

@ -1,5 +1,5 @@
Reading Datasets
=====================
================
.. todo::

View File

@ -1,5 +1,5 @@
Reprojection
************
============
Rasterio can map the pixels of a destination raster with an associated
coordinate reference system and transform to the pixels of a source image with

View File

@ -1,11 +1,11 @@
Resampling
**********
For details on changing coordinate reference systems, see `Reprojection`.
==========
For details on changing coordinate reference systems, see `Reprojection`.
Up and Downsampling
-------------------
*Resampling* refers to changing the cell values due to changes in the raster cell grid. This can occur during reprojection. Even if the crs is not changing, we may want to change the effective cell size of an existing dataset.
*Upsampling* refers to cases where we are converting to higher resolution/smaller cells.
@ -14,7 +14,8 @@ Up and Downsampling
There are three potential ways to perform up/downsampling.
Use reproject
~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~
~
If you use ``reproject`` but keep the same CRS, you can utilize the underlying GDAL algorithms
to resample your data.
@ -44,7 +45,7 @@ by ``x``, you need to *divide* the affine parameters defining the cell size by `
Use scipy
~~~~~~~~~~~~~
~~~~~~~~~
You can also use `scipy.ndimage.interpolation.zoom`_ to "zoom" with a configurable spline interpolation
that differs from the resampling methods available in GDAL. This may not be appropriate for all data so check the results carefully. You must adjust the affine transform just as we did above.

View File

@ -1,4 +1,3 @@
=====================================
Switching from GDAL's Python bindings
=====================================
@ -10,7 +9,7 @@ between these two Python packages and highlights the features of Rasterio that
can help in switching.
Mutual Incompatibilities
========================
------------------------
Rasterio and GDAL's bindings can contend for global GDAL objects. Unless you
have deep knowledge about both packages, choose exactly one of ``import
@ -32,7 +31,7 @@ writes like C while ``rasterio`` is more Pythonic and don't complement each
other well.
The GDAL Environment
====================
--------------------
GDAL library functions are excuted in a context of format drivers, error
handlers, and format-specific configuration options that this document will
@ -127,7 +126,7 @@ Rasterio achieves this with a single Python statement.
Format Drivers
==============
--------------
``gdal`` provides objects for each of the GDAL format drivers. With Rasterio,
format drivers are represented by strings and are used only as arguments to
@ -140,7 +139,7 @@ functions like ``rasterio.open()``.
Rasterio uses the same format driver names as GDAL does.
Dataset Identifiers
===================
-------------------
Rasterio uses URIs to identify datasets, with schemes for different protocols.
The GDAL bindings have their own special syntax.
@ -171,7 +170,7 @@ format-specific connection strings, too, and dispatch them to the proper format
drivers and protocols.
Dataset Objects
===============
---------------
Rasterio and ``gdal`` each have dataset objects. Not the same classes, of
course, but not radically different ones. In each case, you generally get
@ -184,7 +183,7 @@ the ``close()`` method that ``gdal`` lacks so that you can actively close
dataset connections.
Bands
=====
-----
``gdal`` has band objects. Rasterio does not and thus never has objects with
dangling dataset pointers. With Rasterio, bands are represented by a numerical
@ -236,7 +235,7 @@ Namedtuples are like lightweight classes.
3
Geotransforms
=============
-------------
The ``transform`` attribute of a Rasterio dataset object is comparable to the
``GeoTransform`` attribute of a GDAL dataset, but Rasterio's has more power.
@ -271,7 +270,7 @@ converted to the sequences used by ``gdal``.
(101985.0, 300.0379266750948, 0.0, 2826915.0, 0.0, -300.041782729805)
Coordinate Reference Systems
============================
----------------------------
The ``crs`` attribute of a Rasterio dataset object is an instance of Rasterio's
``CRS`` class and works well with ``pyproj``.
@ -284,7 +283,7 @@ The ``crs`` attribute of a Rasterio dataset object is an instance of Rasterio's
(-8789636.707871985, 2938035.238323653)
Tags
====
----
GDAL metadata items are called "tags" in Rasterio. The tag set for a given GDAL
metadata namespace is represented as a dict.
@ -302,7 +301,7 @@ several namespaces of its own: ``rio_creation_kwds`` and ``rio_overviews``,
each with their own semantics.
Offsets and Windows
===================
-------------------
Rasterio adds an abstraction for subsets or windows of a raster array that
GDAL does not have. A window is a pair of tuples, the first of the pair being
@ -320,7 +319,7 @@ four subset parameters used with ``gdal`` to the class constructor.
subset = src.read(1, window=Window(xoff, yoff, xsize, ysize))
Valid Data Masks
================
----------------
Rasterio provides an array for every dataset representing its valid data mask
using the same indicators as GDAL: ``0`` for invalid data and ``255`` for valid
@ -328,7 +327,7 @@ data.
.. code-block:: pycon
>>> src = rasterio.open('example.tif')
>>> src - rasterio.open('example.tif')
>>> src.dataset_mask()
array([[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
@ -336,14 +335,14 @@ data.
...,
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0]], dtype=uint8)
[0, 0, 0, ..., 0, 0, 0]], dtype-uint8)
Arrays for dataset bands can also be had as a Numpy ``masked_array``.
.. code-block:: pycon
>>> src.read(1, masked=True)
masked_array(data =
>>> src.read(1, masked-True)
masked_array(data -
[[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]
@ -351,7 +350,7 @@ Arrays for dataset bands can also be had as a Numpy ``masked_array``.
[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]],
mask =
mask -
[[ True True True ..., True True True]
[ True True True ..., True True True]
[ True True True ..., True True True]
@ -359,13 +358,13 @@ Arrays for dataset bands can also be had as a Numpy ``masked_array``.
[ True True True ..., True True True]
[ True True True ..., True True True]
[ True True True ..., True True True]],
fill_value = 0)
fill_value - 0)
Where the masked array's ``mask`` is ``True``, the data is invalid and has been
masked "out" in the opposite sense of GDAL's mask.
Errors and Exceptions
=====================
---------------------
Rasterio always raises Python exceptions when an error occurs and never returns
an error code or ``None`` to indicate an error. ``gdal`` takes the opposite

View File

@ -1,5 +1,5 @@
Tagging datasets and bands
**************************
==========================
GDAL's `data model <http://www.gdal.org/gdal_datamodel.html>`__ includes
collections of key, value pairs for major classes. In that model, these are

View File

@ -56,7 +56,7 @@ extract pixels corresponding to its central zoom 9 tile, do the following.
Normalizing Data to a Consistent Grid
=====================================
-------------------------------------
A ``WarpedVRT`` can be used to normalize a stack of images with differing
projections, bounds, cell sizes, or dimensions against a regular grid

View File

@ -1,5 +1,5 @@
Virtual Files
*************
=============
.. todo::
@ -7,7 +7,7 @@ Virtual Files
Relationship to GDAL vsicurl, vsis3 et al.
AWS S3
======
------
.. note::
Requires GDAL 2.1.0

View File

@ -1,7 +1,5 @@
.. _windowrw:
============================
Windowed reading and writing
============================
@ -9,9 +7,8 @@ Beginning in rasterio 0.3, you can read and write "windows" of raster files.
This feature allows you to work on rasters that are larger than your
computers RAM or process chunks of large rasters in parallel.
Windows
=======
-------
A window is a view onto a rectangular subset of a raster dataset and is
described in rasterio by column and row offsets and width and height
@ -42,7 +39,7 @@ and open-ended slices may be used.
Reading
=======
-------
Here is an example of reading a 256 row x 512 column subset of the rasterio
test file.
@ -57,7 +54,7 @@ test file.
(256, 512)
Writing
=======
-------
Writing works similarly. The following creates a blank 500 column x 300 row
GeoTIFF and plops 37,500 pixels with value 127 into a window 30 pixels down from
@ -80,7 +77,7 @@ The result:
:height: 300
Decimation
==========
----------
If the write window is smaller than the data, the data will be decimated.
Below, the window is scaled to one third of the source image.
@ -108,7 +105,7 @@ And the result:
:height: 300
Data windows
============
------------
Sometimes it is desirable to crop off an outer boundary of NODATA values around
a dataset:
@ -118,21 +115,21 @@ a dataset:
from rasterio.windows import get_data_window
with rasterio.open('tests/data/RGB.byte.tif') as src:
window = get_data_window(src.read(1, masked=True))
# window = Window(col_off=13, row_off=3, width=757, height=711)
window - get_data_window(src.read(1, masked-True))
# window - Window(col_off-13, row_off-3, width-757, height-711)
kwargs = src.meta.copy()
kwargs - src.meta.copy()
kwargs.update({
'height': window.height,
'width': window.width,
'transform': rasterio.windows.transform(window, src.transform)})
with rasterio.open('/tmp/cropped.tif', 'w', **kwargs) as dst:
dst.write(src.read(window=window))
dst.write(src.read(window-window))
Window utilities
================
----------------
Basic union and intersection operations are available for windows, to
streamline operations across dynamically created windows for a series of bands
@ -151,7 +148,7 @@ or datasets with the same full extent.
Blocks
======
------
Raster datasets are generally composed of multiple blocks of data and
windowed reads and writes are most efficient when the windows match the