pyosp.curvsp package
Submodules
pyosp.curvsp.base_curv module
- class pyosp.curvsp.base_curv.Base_curv(line, raster, width, line_stepsize=None, cross_stepsize=None)
Bases:
object
Abstract class for cuvilinear swath profile.
- Parameters
line (str) – path to baseline shapefile
raster (str) – path to GeoTiff
width (Float) – maximum allowed width of swath profile
line_stepsize (float, optional) – step-size along baseline, defaults to resolution of raster
cross_stepsize (float, optional) – step-size along profilelines, defaults to resolution of raster
- cross_dat(dat=None, start=None, end=None)
Generate cross-swath data.
- Parameters
dat (list, optional) – Swath data passed to calculate cross-swath, defaults to all swath data.
start (float or array-like, optional) – Starting position of cross-swath, defaults to starting point of baseline
end (float or array-like, optional) – Ending position of cross-swath, defaults to ending point of baseline
- Returns
A dict specify distance from the baseline, and corresponding swath data.
- Return type
dict
- cross_plot(start=None, end=None, ax=None, color='navy', points=None, density_scatter=False, **kwargs)
Return the plot of cross-profile.
- Parameters
start (float or array-like, optional) – Starting position of cross-swath, defaults to starting point of baseline
end (float or array-like, optional) – Ending position of cross-swath, defaults to ending point of baseline
ax – matplotlib axes object, defaults to None
color (str, optional) – color of quartiles, defaults to ‘navy’
- density_scatter(distance=None, dat=None, bins=10, start=None, end=None, ax=None, **kwargs)
Plot the density scatter of all collected raster values. Use 2D histogram approach to discretize the space of swath profile. Colors of scatters show the cluster density of collected data points.
- Parameters
distance (optional) – longitudial or cross distance, usually set to None
dat (optional) – longitudial or cross data, usually set to None
bins (int, optional) – number of bin for histogram calculation, defaults to 10
start (float or array-like, optional) – starting point, can be coordinates or distance
end (float or array-like, optional) – ending point, can be coordinates or distance
ax – matplotlib axes object, defaults to None
**kwargs –
**kwargs pass to Matplotlib scatter handle
- hist(dat=None, ax=None, bins=50, **kwargs)
Return a histogram plot
- Parameters
dat (nested list, optional) – Input data, defaults to all swath data
ax – Matplotlib axes object, defaults to None
bins (int, optional) – number of binds, defaults to 50
- Returns
Matplotlib axes object
- out_polygon(start=None, end=None)
Generate output polygon.
- Parameters
start (float or array-like, optional) – starting position of polygon, defaults to starting point of baseline
end (float or array-like, optional) – ending position of polygon, defaults to ending point of baseline
- Returns
polygon of swath area
- out_polylines(start=None, end=None)
Generate output polyline.
- Parameters
start (float or array-like, optional) – starting position of Polyline, defaults to start of baseline
end (float or array-like, optional) – ending position of Polyline, defaults to end of baseline
- Returns
polylines of swath area
- plot(distance, stat, points=None, cross=False, start=None, end=None, ax=None, color='navy', **kwargs)
Summary statistics plot.
- post_elev(min_val=- inf, max_val=inf, start=None, end=None, ax=None, color='navy', cross=False, swath_plot=False, bins=10, density_scatter=False, **kwargs)
Post-processing swath data according to elevation criteria.
- Parameters
min_val (float, optional) – minimal elevation threshold, defaults to float(“-inf”)
max_val (float, optional) – maximal elevation threshold, defaults to float(“inf”)
start (float or array-like, optional) – starting point, can be coordinates or distance
end (float or array-like, optional) – ending point, can be coordinates or distance
ax – matplotlib axes object, defaults to None
color (str, optional) – color of quartiles, defaults to ‘navy’
cross (bool, optional) – processing cross-swath profile, defaults to False
swath_plot (bool, optional) – plot the processed swath profile, defaults to False
bins (int, optional) – number of bin for density scatter, defaults to 10
density_scatter (bool, optional) – plot the processed density scatter, defaults to False
**kwargs –
**kwargs pass to Matplotlib scatter handle
- Returns
a list contain distance and processed elevation data
- Return type
list
- post_slope(min_val=0.0, max_val=90.0, start=None, end=None, ax=None, color='navy', cross=False, swath_plot=False, bins=10, density_scatter=False, **kwargs)
Post-processing swath data according to slope criteria.
- Parameters
min_val (float, optional) – minimal slope threshold, defaults to float(“-inf”)
max_val (float, optional) – maximal slope threshold, defaults to float(“inf”)
start (float or array-like, optional) – starting point, can be coordinates or distance
end (float or array-like, optional) – ending point, can be coordinates or distance
ax – matplotlib axes object, defaults to None
color (str, optional) – color of quartiles, defaults to ‘navy’
cross (bool, optional) – processing cross-swath profile, defaults to False
swath_plot (bool, optional) – plot the processed swath profile, defaults to False
bins (int, optional) – number of bin for density scatter, defaults to 10
density_scatter (bool, optional) – plot the processed density scatter, defaults to False
**kwargs –
**kwargs pass to Matplotlib scatter handle
- Returns
a list contain distance and processed slope data
- Return type
list
- post_tpi(radius, min_val=- inf, max_val=inf, start=None, end=None, ax=None, color='navy', cross=False, swath_plot=False, bins=10, density_scatter=False, **kwargs)
Post-processing swath data according to TPI criteria.
- Parameters
radius (float) – TPI radius
min_val (float, optional) – minimal TPI threshold, defaults to float(“-inf”)
max_val (float, optional) – maximal TPI threshold, defaults to float(“inf”)
start (float or array-like, optional) – starting point, can be coordinates or distance
end (float or array-like, optional) – ending point, can be coordinates or distance
ax – matplotlib axes object, defaults to None
color (str, optional) – color of quartiles, defaults to ‘navy’
cross (bool, optional) – processing cross-swath profile, defaults to False
swath_plot (bool, optional) – plot the processed swath profile, defaults to False
bins (int, optional) – number of bin for density scatter, defaults to 10
density_scatter (bool, optional) – plot the processed density scatter, defaults to False
**kwargs –
**kwargs pass to Matplotlib scatter handle
- Returns
a list contain distance and processed elevation data
- Return type
list
- profile_plot(start=None, end=None, ax=None, color='navy', points=None, **kwargs)
Plot the swath profile.
- Parameters
start (float or array-like, optional) – starting position of plot, defaults to starting point of baseline
end (float or array-like, optional) – ending position of plot, defaults to ending point of baseline
ax – matplotlib axes object, if not will generate one, default None
color (str, optional) – color shading of percentile, defaults to ‘navy’
points (str, optional) – path to points shapefile that are meant to be plotted with SP, defaults to None
**kwargs –
**kwargs pass to Matplotlib scatter handle
- profile_stat(z)
Return a list of summary statistics along each profileline
- slice_hist(loc, bins=50)
Plot the histogram of slice.
- Parameters
loc (float or array-like) – location of slice, can be coordinate or distance from starting.
bins (int, optional) – number of bins, defaults to 50
- slice_plot(loc, ax=None)
plot cross-section of swath data.
- Parameters
loc (float or array-like.) – location of slice, can be coordinate or distance from starting.
ax – matplotlib axes, defaults to None
- swath_data()
Return a list of elevation data along each profileline
pyosp.curvsp.elev_curv module
- class pyosp.curvsp.elev_curv.Elev_curv(line, raster, width, min_elev=- inf, max_elev=inf, line_stepsize=None, cross_stepsize=None)
Bases:
pyosp.curvsp.base_curv.Base_curv
Elevation-based swath profile characterization.
- Parameters
line (str) – path to baseline shapefile
raster (str) – path to GeoTiff
width (float) – maximum allowed width of swath profile
min_elev (float, optional) – minimal elevation threshold, defaults to float(“-inf”)
max_elev (float, optional) – maximal elevation threshold, defaults to float(“inf”)
line_stepsize (float, optional) – step-size along baseline, defaults to resolution of raster
cross_stepsize (float, optional) – step-size along profilelines, defaults to resolution of raster
pyosp.curvsp.orig_curv module
- class pyosp.curvsp.orig_curv.Orig_curv(line, raster, width, line_stepsize=None, cross_stepsize=None)
Bases:
pyosp.curvsp.base_curv.Base_curv
Original swath method.
- Parameters
line (str) – path to baseline shapefile
raster (str) – path to GeoTiff
width (float) – maximum allowed width of swath profile
line_stepsize (float, optional) – step-size along baseline, defaults to resolution of raster
cross_stepsize (float, optional) – step-size along profilelines, defaults to resolution of raster
pyosp.curvsp.slope_curv module
- class pyosp.curvsp.slope_curv.Slope_curv(line, raster, width, min_slope=0.0, max_slope=90.0, line_stepsize=None, cross_stepsize=None)
Bases:
pyosp.curvsp.base_curv.Base_curv
Slope-based swath profile characterization.
- Parameters
line (str) – path to baseline shapefile
raster (str) – path to GeoTiff
width (float) – maximum allowed width of swath profile
min_slope (float, optional) – minimal slope threshold, defaults to 0
max_slope (float, optional) – maximal slope threshold, defaults to 90
line_stepsize (float, optional) – step-size along baseline, defaults to resolution of raster
cross_stepsize (float, optional) – step-size along profilelines, defaults to resolution of raster
pyosp.curvsp.tpi_curv module
- class pyosp.curvsp.tpi_curv.Tpi_curv(line, raster, width, tpi_radius, min_tpi=- inf, max_tpi=inf, line_stepsize=None, cross_stepsize=None)
Bases:
pyosp.curvsp.base_curv.Base_curv
TPI-based swath profile characterization.
- Parameters
line (str) – path to baseline shapefile
raster (str) – path to GeoTiff
width (float) – maximum allowed width of swath profile
tpi_radius (float) – radius of TPI window
min_tpi (float, optional) – minimal TPI threshold, defaults to float(“-inf”)
max_tpi (float, optional) – maximal TPI threshold, defaults to float(“inf”)
line_stepsize (float, optional) – step-size along baseline, defaults to resolution of raster
cross_stepsize (float, optional) – step-size along profilelines, defaults to resolution of raster
Module contents
- class pyosp.curvsp.Base_curv(line, raster, width, line_stepsize=None, cross_stepsize=None)
Bases:
object
Abstract class for cuvilinear swath profile.
- Parameters
line (str) – path to baseline shapefile
raster (str) – path to GeoTiff
width (Float) – maximum allowed width of swath profile
line_stepsize (float, optional) – step-size along baseline, defaults to resolution of raster
cross_stepsize (float, optional) – step-size along profilelines, defaults to resolution of raster
- cross_dat(dat=None, start=None, end=None)
Generate cross-swath data.
- Parameters
dat (list, optional) – Swath data passed to calculate cross-swath, defaults to all swath data.
start (float or array-like, optional) – Starting position of cross-swath, defaults to starting point of baseline
end (float or array-like, optional) – Ending position of cross-swath, defaults to ending point of baseline
- Returns
A dict specify distance from the baseline, and corresponding swath data.
- Return type
dict
- cross_plot(start=None, end=None, ax=None, color='navy', points=None, density_scatter=False, **kwargs)
Return the plot of cross-profile.
- Parameters
start (float or array-like, optional) – Starting position of cross-swath, defaults to starting point of baseline
end (float or array-like, optional) – Ending position of cross-swath, defaults to ending point of baseline
ax – matplotlib axes object, defaults to None
color (str, optional) – color of quartiles, defaults to ‘navy’
- density_scatter(distance=None, dat=None, bins=10, start=None, end=None, ax=None, **kwargs)
Plot the density scatter of all collected raster values. Use 2D histogram approach to discretize the space of swath profile. Colors of scatters show the cluster density of collected data points.
- Parameters
distance (optional) – longitudial or cross distance, usually set to None
dat (optional) – longitudial or cross data, usually set to None
bins (int, optional) – number of bin for histogram calculation, defaults to 10
start (float or array-like, optional) – starting point, can be coordinates or distance
end (float or array-like, optional) – ending point, can be coordinates or distance
ax – matplotlib axes object, defaults to None
**kwargs –
**kwargs pass to Matplotlib scatter handle
- hist(dat=None, ax=None, bins=50, **kwargs)
Return a histogram plot
- Parameters
dat (nested list, optional) – Input data, defaults to all swath data
ax – Matplotlib axes object, defaults to None
bins (int, optional) – number of binds, defaults to 50
- Returns
Matplotlib axes object
- out_polygon(start=None, end=None)
Generate output polygon.
- Parameters
start (float or array-like, optional) – starting position of polygon, defaults to starting point of baseline
end (float or array-like, optional) – ending position of polygon, defaults to ending point of baseline
- Returns
polygon of swath area
- out_polylines(start=None, end=None)
Generate output polyline.
- Parameters
start (float or array-like, optional) – starting position of Polyline, defaults to start of baseline
end (float or array-like, optional) – ending position of Polyline, defaults to end of baseline
- Returns
polylines of swath area
- plot(distance, stat, points=None, cross=False, start=None, end=None, ax=None, color='navy', **kwargs)
Summary statistics plot.
- post_elev(min_val=- inf, max_val=inf, start=None, end=None, ax=None, color='navy', cross=False, swath_plot=False, bins=10, density_scatter=False, **kwargs)
Post-processing swath data according to elevation criteria.
- Parameters
min_val (float, optional) – minimal elevation threshold, defaults to float(“-inf”)
max_val (float, optional) – maximal elevation threshold, defaults to float(“inf”)
start (float or array-like, optional) – starting point, can be coordinates or distance
end (float or array-like, optional) – ending point, can be coordinates or distance
ax – matplotlib axes object, defaults to None
color (str, optional) – color of quartiles, defaults to ‘navy’
cross (bool, optional) – processing cross-swath profile, defaults to False
swath_plot (bool, optional) – plot the processed swath profile, defaults to False
bins (int, optional) – number of bin for density scatter, defaults to 10
density_scatter (bool, optional) – plot the processed density scatter, defaults to False
**kwargs –
**kwargs pass to Matplotlib scatter handle
- Returns
a list contain distance and processed elevation data
- Return type
list
- post_slope(min_val=0.0, max_val=90.0, start=None, end=None, ax=None, color='navy', cross=False, swath_plot=False, bins=10, density_scatter=False, **kwargs)
Post-processing swath data according to slope criteria.
- Parameters
min_val (float, optional) – minimal slope threshold, defaults to float(“-inf”)
max_val (float, optional) – maximal slope threshold, defaults to float(“inf”)
start (float or array-like, optional) – starting point, can be coordinates or distance
end (float or array-like, optional) – ending point, can be coordinates or distance
ax – matplotlib axes object, defaults to None
color (str, optional) – color of quartiles, defaults to ‘navy’
cross (bool, optional) – processing cross-swath profile, defaults to False
swath_plot (bool, optional) – plot the processed swath profile, defaults to False
bins (int, optional) – number of bin for density scatter, defaults to 10
density_scatter (bool, optional) – plot the processed density scatter, defaults to False
**kwargs –
**kwargs pass to Matplotlib scatter handle
- Returns
a list contain distance and processed slope data
- Return type
list
- post_tpi(radius, min_val=- inf, max_val=inf, start=None, end=None, ax=None, color='navy', cross=False, swath_plot=False, bins=10, density_scatter=False, **kwargs)
Post-processing swath data according to TPI criteria.
- Parameters
radius (float) – TPI radius
min_val (float, optional) – minimal TPI threshold, defaults to float(“-inf”)
max_val (float, optional) – maximal TPI threshold, defaults to float(“inf”)
start (float or array-like, optional) – starting point, can be coordinates or distance
end (float or array-like, optional) – ending point, can be coordinates or distance
ax – matplotlib axes object, defaults to None
color (str, optional) – color of quartiles, defaults to ‘navy’
cross (bool, optional) – processing cross-swath profile, defaults to False
swath_plot (bool, optional) – plot the processed swath profile, defaults to False
bins (int, optional) – number of bin for density scatter, defaults to 10
density_scatter (bool, optional) – plot the processed density scatter, defaults to False
**kwargs –
**kwargs pass to Matplotlib scatter handle
- Returns
a list contain distance and processed elevation data
- Return type
list
- profile_plot(start=None, end=None, ax=None, color='navy', points=None, **kwargs)
Plot the swath profile.
- Parameters
start (float or array-like, optional) – starting position of plot, defaults to starting point of baseline
end (float or array-like, optional) – ending position of plot, defaults to ending point of baseline
ax – matplotlib axes object, if not will generate one, default None
color (str, optional) – color shading of percentile, defaults to ‘navy’
points (str, optional) – path to points shapefile that are meant to be plotted with SP, defaults to None
**kwargs –
**kwargs pass to Matplotlib scatter handle
- profile_stat(z)
Return a list of summary statistics along each profileline
- slice_hist(loc, bins=50)
Plot the histogram of slice.
- Parameters
loc (float or array-like) – location of slice, can be coordinate or distance from starting.
bins (int, optional) – number of bins, defaults to 50
- slice_plot(loc, ax=None)
plot cross-section of swath data.
- Parameters
loc (float or array-like.) – location of slice, can be coordinate or distance from starting.
ax – matplotlib axes, defaults to None
- swath_data()
Return a list of elevation data along each profileline
- class pyosp.curvsp.Elev_curv(line, raster, width, min_elev=- inf, max_elev=inf, line_stepsize=None, cross_stepsize=None)
Bases:
pyosp.curvsp.base_curv.Base_curv
Elevation-based swath profile characterization.
- Parameters
line (str) – path to baseline shapefile
raster (str) – path to GeoTiff
width (float) – maximum allowed width of swath profile
min_elev (float, optional) – minimal elevation threshold, defaults to float(“-inf”)
max_elev (float, optional) – maximal elevation threshold, defaults to float(“inf”)
line_stepsize (float, optional) – step-size along baseline, defaults to resolution of raster
cross_stepsize (float, optional) – step-size along profilelines, defaults to resolution of raster
- class pyosp.curvsp.Orig_curv(line, raster, width, line_stepsize=None, cross_stepsize=None)
Bases:
pyosp.curvsp.base_curv.Base_curv
Original swath method.
- Parameters
line (str) – path to baseline shapefile
raster (str) – path to GeoTiff
width (float) – maximum allowed width of swath profile
line_stepsize (float, optional) – step-size along baseline, defaults to resolution of raster
cross_stepsize (float, optional) – step-size along profilelines, defaults to resolution of raster
- class pyosp.curvsp.Slope_curv(line, raster, width, min_slope=0.0, max_slope=90.0, line_stepsize=None, cross_stepsize=None)
Bases:
pyosp.curvsp.base_curv.Base_curv
Slope-based swath profile characterization.
- Parameters
line (str) – path to baseline shapefile
raster (str) – path to GeoTiff
width (float) – maximum allowed width of swath profile
min_slope (float, optional) – minimal slope threshold, defaults to 0
max_slope (float, optional) – maximal slope threshold, defaults to 90
line_stepsize (float, optional) – step-size along baseline, defaults to resolution of raster
cross_stepsize (float, optional) – step-size along profilelines, defaults to resolution of raster
- class pyosp.curvsp.Tpi_curv(line, raster, width, tpi_radius, min_tpi=- inf, max_tpi=inf, line_stepsize=None, cross_stepsize=None)
Bases:
pyosp.curvsp.base_curv.Base_curv
TPI-based swath profile characterization.
- Parameters
line (str) – path to baseline shapefile
raster (str) – path to GeoTiff
width (float) – maximum allowed width of swath profile
tpi_radius (float) – radius of TPI window
min_tpi (float, optional) – minimal TPI threshold, defaults to float(“-inf”)
max_tpi (float, optional) – maximal TPI threshold, defaults to float(“inf”)
line_stepsize (float, optional) – step-size along baseline, defaults to resolution of raster
cross_stepsize (float, optional) – step-size along profilelines, defaults to resolution of raster