ost.helpers.raster

Helper functions for raster data

Functions

calc_max

calc_min

combine_timeseries

convert_to_db

Convert array of SAR power to decibel

create_rgb_jpeg

param filelist

create_timeseries_animation

create_tscan_vrt

fill_internal_nans

Function that fills no-data values with interpolation

get_max

get_min

image_bounds

Function to create a polygon of image boundary

mask_by_shape

Mask a raster layer with a vector file (including data conversions)

norm

Normalize array by its min/max or 2- and 98 percentile

outline

Generates a vector file with the valid areas of a raster file

polygonize_bounds

Polygonize a raster mask based on a mask value

polygonize_ls

rescale_to_float

Re-convert a previously converted integer array back to float

scale_to_int

Convert a float array to integer by linear scaling between min and max

stretch_to_8bit

visualise_rgb

param filepath

ost.helpers.raster.calc_max(band, stretch='minmax')[source]
ost.helpers.raster.calc_min(band, stretch='minmax')[source]
ost.helpers.raster.combine_timeseries(processing_dir, config_dict, timescan=True)[source]
ost.helpers.raster.convert_to_db(pow_array)[source]

Convert array of SAR power to decibel

Parameters

pow_array

Returns

ost.helpers.raster.create_rgb_jpeg(filelist, outfile=None, shrink_factor=1, resampling_factor=5, plot=False, date=None, filetype=None)[source]
Parameters
  • filelist

  • outfile

  • shrink_factor

  • resampling_factor – 5 is average

  • plot

  • date

  • filetype

Returns

ost.helpers.raster.create_timeseries_animation(timeseries_folder, product_list, out_folder, shrink_factor=1, resampling_factor=5, duration=1, add_dates=False, prefix=False)[source]
ost.helpers.raster.create_tscan_vrt(timescan_dir, config_file)[source]
ost.helpers.raster.fill_internal_nans(array)[source]

Function that fills no-data values with interpolation

Parameters

array

Returns

ost.helpers.raster.get_max(file, dtype='float32')[source]
ost.helpers.raster.get_min(file, dtype='float32')[source]
ost.helpers.raster.image_bounds(data_dir)[source]

Function to create a polygon of image boundary

This function for all files within a dimap data directory

Parameters

data_dir

Returns

ost.helpers.raster.mask_by_shape(infile, outfile, vector, to_db=False, datatype='float32', rescale=True, min_value=1e-06, max_value=1, ndv=None, description=True)[source]

Mask a raster layer with a vector file (including data conversions)

Parameters
  • infile

  • outfile

  • vector

  • to_db

  • datatype

  • rescale

  • min_value

  • max_value

  • ndv

  • description

Returns

ost.helpers.raster.norm(array, percentile=False)[source]

Normalize array by its min/max or 2- and 98 percentile

Parameters
  • array

  • percentile

Returns

ost.helpers.raster.outline(infile, outfile, ndv=0, less_then=False, driver='GeoJSON')[source]

Generates a vector file with the valid areas of a raster file

Parameters
  • infile – input raster file

  • outfile – output shapefile

  • ndv – no-data-value

  • less_then

  • driver

Returns

ost.helpers.raster.polygonize_bounds(infile, outfile, mask_value=1, driver='GeoJSON')[source]

Polygonize a raster mask based on a mask value

Parameters
  • infile

  • outfile

  • mask_value (int/float, optional) –

  • driver (str, optional) –

Returns

ost.helpers.raster.polygonize_ls(infile, outfile, driver='GeoJSON')[source]
ost.helpers.raster.rescale_to_float(int_array, data_type)[source]

Re-convert a previously converted integer array back to float

Parameters
  • int_array

  • data_type

Returns

ost.helpers.raster.scale_to_int(float_array, min_value, max_value, data_type)[source]

Convert a float array to integer by linear scaling between min and max

Parameters
  • float_array

  • min_value

  • max_value

  • data_type

Returns

ost.helpers.raster.stretch_to_8bit(file, layer, dtype, aut_stretch=False)[source]
ost.helpers.raster.visualise_rgb(filepath, shrink_factor=25)[source]
Parameters
  • filepath

  • shrink_factor

Returns