s2d2.mapping_input

Module Contents

Functions

read_geo_info(fname)

This function takes as input the geotiff name and the path of the

read_geo_image(fname[, boi, no_dat])

This function takes as input the geotiff name and the path of the

_correct_sun_angle_string(sun_angles)

s2d2.mapping_input.read_geo_info(fname)[source]

This function takes as input the geotiff name and the path of the folder that the images are stored, reads the geographic information of the image

Parameters:

fname (string) – path and file name of a geotiff image

Returns:

  • spatialRef (string) – osr.SpatialReference in well known text

  • geoTransform (tuple, size=(8,1)) – affine transformation coefficients, but also giving the image dimensions

  • targetprj (osgeo.osr.SpatialReference() object) – coordinate reference system (CRS)

  • rows (integer, {x ∈ ℕ | x ≥ 0}) – number of rows in the image, that is its height

  • cols (integer, {x ∈ ℕ | x ≥ 0}) – number of collumns in the image, that is its width

  • bands (integer, {x ∈ ℕ | x ≥ 1}) – number of bands in the image, that is its depth

See also

read_geo_image

basic function to import geographic imagery data

s2d2.mapping_input.read_geo_image(fname, boi=np.array([]), no_dat=None)[source]

This function takes as input the geotiff name and the path of the folder that the images are stored, reads the image and returns the data as an array

Parameters:
  • fname (string) – geotiff file name and path.

  • boi (numpy.array, size=(k,1)) – bands of interest, if a multispectral image is read, a selection can be specified

  • no_dat ({integer,float}) – no data value

Returns:

  • data ({numpy.array, numpy.masked.array}, size=(m,n), ndim=2) – data array of the band

  • spatialRef (string) – osr.SpatialReference in well known text

  • geoTransform (tuple, size=(8,)) – affine transformation coefficients.

  • targetprj (osgeo.osr.SpatialReference() object) – coordinate reference system (CRS)

See also

read_geo_info

basic function to get meta data of geographic imagery

Examples

>>> import os
>>> from s2d2.mapping_input import read_geo_image
>>> fpath = os.path.join(os.getcwd(), "data.jp2" )
>>> I, spatialRef, geoTransform, targetPrj = read_geo_image(fpath)
s2d2.mapping_input._correct_sun_angle_string(sun_angles)[source]