Commit 501c5d9e authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Improved code block style.


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 11b3718e
Pipeline #4325 passed with stages
in 5 minutes and 9 seconds
......@@ -12,31 +12,31 @@ Using conda_, the recommended approach is:
.. code-block:: bash
conda create --name arosics python=3
source activate arosics
$ conda create --name arosics python=3
$ source activate arosics
2. Install some libraries needed for AROSICS:
.. code-block:: bash
conda install -c conda-forge numpy gdal scikit-image matplotlib pyproj rasterio shapely geopandas cmocean
$ conda install -c conda-forge numpy gdal scikit-image matplotlib pyproj rasterio shapely geopandas cmocean
3. Install optional libraries for AROSICS (only needed for some specific functions):
.. code-block:: bash
conda install -c conda-forge basemap pykrige
conda install -c conda-forge pyfftw # Linux and MacOS
conda install -c jesserobertson pyfftw # Windows
$ conda install -c conda-forge basemap pykrige
$ conda install -c conda-forge pyfftw # Linux and MacOS
$ conda install -c jesserobertson pyfftw # Windows
4. Then install AROSICS using the pip installer:
.. code-block:: bash
pip install arosics
$ pip install arosics
This is the preferred method to install arosics, as it will always install the most recent stable release.
......
......@@ -14,15 +14,13 @@ calculate spatial shifts - with input data on disk
.. code-block:: python
from arosics import COREG
>>> from arosics import COREG
im_reference = '/path/to/your/ref_image.bsq'
im_target = '/path/to/your/tgt_image.bsq'
>>> im_reference = '/path/to/your/ref_image.bsq'
>>> im_target = '/path/to/your/tgt_image.bsq'
CR = COREG(im_reference, im_target, wp=(354223, 5805559), ws=(256,256))
CR.calculate_spatial_shifts()
.. code-block:: python
>>> CR = COREG(im_reference, im_target, wp=(354223, 5805559), ws=(256,256))
>>> CR.calculate_spatial_shifts()
Calculating actual data corner coordinates for reference image...
Corner coordinates of reference image:
......@@ -49,30 +47,30 @@ First, create some example input images for AROSICS in-memory
.. code-block:: python
from geoarray import GeoArray
from arosics import COREG
>>> from geoarray import GeoArray
>>> from arosics import COREG
im_reference = '/path/to/your/ref_image.bsq'
im_target = '/path/to/your/tgt_image.bsq'
>>> im_reference = '/path/to/your/ref_image.bsq'
>>> im_target = '/path/to/your/tgt_image.bsq'
# get a sample numpy array with corresponding geoinformation as reference image
geoArr = GeoArray(im_reference)
>>> geoArr = GeoArray(im_reference)
ref_ndarray = geoArr[:] # numpy.ndarray with shape (10980, 10980)
ref_gt = geoArr.geotransform # GDAL geotransform: (300000.0, 10.0, 0.0, 5900040.0, 0.0, -10.0)
ref_prj = geoArr.projection # projection as WKT string ('PROJCS["WGS 84 / UTM zone 33N....')
>>> ref_ndarray = geoArr[:] # numpy.ndarray with shape (10980, 10980)
>>> ref_gt = geoArr.geotransform # GDAL geotransform: (300000.0, 10.0, 0.0, 5900040.0, 0.0, -10.0)
>>> ref_prj = geoArr.projection # projection as WKT string ('PROJCS["WGS 84 / UTM zone 33N....')
# get a sample numpy array with corresponding geoinformation as target image
geoArr = GeoArray(im_target)
>>> geoArr = GeoArray(im_target)
tgt_ndarray = geoArr[:] # numpy.ndarray with shape (10980, 10980)
tgt_gt = geoArr.geotransform # GDAL geotransform: (300000.0, 10.0, 0.0, 5900040.0, 0.0, -10.0)
tgt_prj = geoArr.projection # projection as WKT string ('PROJCS["WGS 84 / UTM zone 33N....')
>>> tgt_ndarray = geoArr[:] # numpy.ndarray with shape (10980, 10980)
>>> tgt_gt = geoArr.geotransform # GDAL geotransform: (300000.0, 10.0, 0.0, 5900040.0, 0.0, -10.0)
>>> tgt_prj = geoArr.projection # projection as WKT string ('PROJCS["WGS 84 / UTM zone 33N....')
# create in-memory instances of GeoArray from the numpy array data, the GDAL geotransform tuple and the WKT
# projection string
geoArr_reference = GeoArray(ref_ndarray, ref_gt, ref_prj)
geoArr_target = GeoArray(tgt_ndarray, tgt_gt, tgt_prj)
>>> geoArr_reference = GeoArray(ref_ndarray, ref_gt, ref_prj)
>>> geoArr_target = GeoArray(tgt_ndarray, tgt_gt, tgt_prj)
Now pass these in-memory :class:`GeoArray<geoarray.GeoArray>` instances to :class:`arosics.COREG`
......@@ -80,11 +78,8 @@ and calculate spatial shifts:
.. code-block:: python
CR = COREG(geoArr_reference, geoArr_target, wp=(354223, 5805559), ws=(256,256))
CR.calculate_spatial_shifts()
.. code-block:: python
>>> CR = COREG(geoArr_reference, geoArr_target, wp=(354223, 5805559), ws=(256,256))
>>> CR.calculate_spatial_shifts()
Calculating actual data corner coordinates for reference image...
Corner coordinates of reference image:
......@@ -116,10 +111,7 @@ numpy array and its corresponding geoinformation.
.. code-block:: python
CR.correct_shifts()
.. code-block:: python
>>> CR.correct_shifts()
OrderedDict([('band', None),
('is shifted', True),
......@@ -166,13 +158,10 @@ Take a look at the keyword arguments of the :class:`arosics.DESHIFTER` class whe
.. code-block:: python
from arosics import DESHIFTER
DESHIFTER(im_target1, CR.coreg_info).correct_shifts()
DESHIFTER(im_target2, CR.coreg_info).correct_shifts()
>>> from arosics import DESHIFTER
.. code-block:: python
>>> DESHIFTER(im_target1, CR.coreg_info).correct_shifts()
>>> DESHIFTER(im_target2, CR.coreg_info).correct_shifts()
OrderedDict([('band', None),
('is shifted', True),
......@@ -213,11 +202,11 @@ The help instructions of the console interface can be accessed like this:
.. code-block:: bash
python arosics_cli.py -h
$ python arosics_cli.py -h
Follow these instructions to run AROSICS from a shell console. For example, the most simple call for a global
co-registration would look like this:
.. code-block:: bash
python arosics_cli.py global /path/to/your/ref_image.bsq /path/to/your/tgt_image.bsq
$ python arosics_cli.py global /path/to/your/ref_image.bsq /path/to/your/tgt_image.bsq
......@@ -14,23 +14,20 @@ detect and correct local shifts - with input data on disk
.. code-block:: python
from arosics import COREG_LOCAL
>>> from arosics import COREG_LOCAL
im_reference = '/path/to/your/ref_image.bsq'
im_target = '/path/to/your/tgt_image.bsq'
kwargs = {
'grid_res' : 200,
'window_size' : (64,64),
'path_out' : 'auto',
'projectDir' : 'my_project',
'q' : False,
}
>>> im_reference = '/path/to/your/ref_image.bsq'
>>> im_target = '/path/to/your/tgt_image.bsq'
>>> kwargs = {
>>> 'grid_res' : 200,
>>> 'window_size' : (64,64),
>>> 'path_out' : 'auto',
>>> 'projectDir' : 'my_project',
>>> 'q' : False,
>>> }
CRL = COREG_LOCAL(im_reference,im_target,**kwargs)
CRL.correct_shifts()
.. code-block:: python
>>> CRL = COREG_LOCAL(im_reference,im_target,**kwargs)
>>> CRL.correct_shifts()
Calculating actual data corner coordinates for reference image...
Corner coordinates of reference image:
......@@ -86,12 +83,12 @@ class as described above.
.. code-block:: python
from geoarray import GeoArray
>>> from geoarray import GeoArray
CRL = COREG_LOCAL(GeoArray(ref_ndarray, ref_gt, ref_prj),
GeoArray(tgt_ndarray, tgt_gt, tgt_prj),
**kwargs)
CRL.correct_shifts()
>>> CRL = COREG_LOCAL(GeoArray(ref_ndarray, ref_gt, ref_prj),
>>> GeoArray(tgt_ndarray, tgt_gt, tgt_prj),
>>> **kwargs)
>>> CRL.correct_shifts()
visualize tie point grid with INITIAL shifts present in your input target image
......@@ -109,9 +106,7 @@ example, thus the unit is 'meters'.).
.. code-block:: python
CRL.view_CoRegPoints(figsize=(15,15), backgroundIm='ref')
.. code-block:: python
>>> CRL.view_CoRegPoints(figsize=(15,15), backgroundIm='ref')
Note: array has been downsampled to 1000 x 1000 for faster visualization.
......@@ -129,11 +124,8 @@ The remaining shifts after local correction can be calculated and visualized by
.. code-block:: python
CRL_after_corr = COREG_LOCAL(im_reference, CRL.path_out, **kwargs)
CRL_after_corr.view_CoRegPoints(figsize=(15,15),backgroundIm='ref')
.. code-block:: python
>>> CRL_after_corr = COREG_LOCAL(im_reference, CRL.path_out, **kwargs)
>>> CRL_after_corr.view_CoRegPoints(figsize=(15,15),backgroundIm='ref')
Calculating actual data corner coordinates for reference image...
Corner coordinates of reference image:
......@@ -161,7 +153,7 @@ show the points table of the calculated tie point grid
.. code-block:: python
CRL.CoRegPoints_table
>>> CRL.CoRegPoints_table
.. raw:: html
......@@ -1236,7 +1228,7 @@ export tie point grid to an ESRI point shapefile
.. code-block:: python
CRL.tiepoint_grid.to_PointShapefile(path_out='/path/to/your/output_shapefile.shp')
>>> CRL.tiepoint_grid.to_PointShapefile(path_out='/path/to/your/output_shapefile.shp')
----
......@@ -1250,4 +1242,4 @@ co-registration would look like this:
.. code-block:: bash
python arosics_cli.py local /path/to/your/ref_image.bsq /path/to/your/tgt_image.bsq 50
$ python arosics_cli.py local /path/to/your/ref_image.bsq /path/to/your/tgt_image.bsq 50
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment