smrf.ipw package

smrf.ipw.ipw module

Created on Apr 7, 2015

Adapted from Roger Lew (rogerlew.gmail.com)isnobal.py

@author: Scott Havens

class smrf.ipw.ipw.Band(nlines, nsamps)[source]

Bases: object

Represents a raster band of geospatial data

class smrf.ipw.ipw.IPW(fname=None, epsg=32611)[source]

Bases: object

Represents a IPW file container

add_geo_hdr(coordinates, d, units, csys, band='all')[source]

Add geo header information to the band

Parameters:
  • coordinates – [u, v] The coordinates of image line 0 and sample 0 in csys are u and v, respectively.
  • d – [dx, dy] The distances between adjacent image lines and samples in csys are du and dv, respectively.
  • units – u, v, du, and dv are specified in units (e.g., “meters”, “km”).
  • csys – The geodetic coordinate system identifier is csys (e.g., “UTM”, “Lambert”). See the manual for mkproj for a list of standard names for coordinate systems.
  • band (optional) – [0,1,4,…] The “geo” header will be applied only to the specified bands (default: all bands).

if ‘all’ for band number then do all, or a subset from array?

# geo self.bline = None self.bsamp = None self.dline = None self.dsamp = None self.geounits = None self.coord_sys_ID = None self.geotransform = None

mkgeoh -o coord,coord -d incr,incr -u units -c csys [-b band,…] [-f] [image]
new_band(data)[source]

Create a new band in IPW that is placed at the end if bands already exist.

read(fname)[source]

Read the IPW file into the various bands Turns the data into a numpy array of float32

read3(fname)[source]

Read the IPW file into the various bands Turns the data into a numpy array of float32 This is meant for Python3 which has different ways of ready binary files than Python2

write(fileName, nbits=8)[source]

Write the IPW data to file

Parameters:
  • - file to write to (fileName) –
  • - number of bits for each band default=8 (nbits) –
smrf.ipw.ipw.int_match(val)[source]

(Devel team is unsure if this is the case. This description is our interpretation of pre-existing code that was re-written to be up-to-date with deprecations. We are confident it behaves the same as it did before.)

IPW writes in the header a integer represented as a float in python without the decimal. So sometimes we have to proactively check and pass a int to the header function.

e.g. float_min == 1.00, IPW writes 1 :param val: an potential int represented as float.

Returns:
the val is casted as int if val is equivalent to itself casted
as an int
Return type:result
smrf.ipw.ipw.map_fn(x, float_min, float_max, int_min, int_max)[source]
smrf.ipw.ipw.readline3(fid)[source]

Read a line from a binary file in Python3 and decode

Module contents