gms_preprocessing.algorithms package¶
Submodules¶
gms_preprocessing.algorithms.L1A_P module¶
-
class
gms_preprocessing.algorithms.L1A_P.
L1A_object
(image_type='', satellite='', sensor='', subsystem='', sensormode='', acq_datetime=None, entity_ID='', scene_ID=- 9999, filename='', dataset_ID=- 9999, proc_status='', **kwargs)[source]¶ Bases:
gms_preprocessing.model.gms_object.GMS_object
Features input reader and raster-/metadata homogenization.
:param : instance of gms_object.GMS_object or None
-
add_rasterInfo_to_MetaObj
(custom_rasObj=None)[source]¶ Add the attributes ‘rows’,’cols’,’bands’,’map_info’,’projection’ and ‘physUnit’ to self.MetaObj
-
calc_TOARadRefTemp
(subset=None)[source]¶ Convert DN, Rad or TOA_Ref data to TOA Reflectance, to Radiance or to Surface Temperature (depending on CFG.target_radunit_optical and target_radunit_thermal). The function can be executed by a L1A_object representing a full scene or a tile. To process a file from disk in tiles, provide an item of self.tile_pos as the ‘subset’ argument.
-
calc_corner_positions
()[source]¶ Get true corner positions in the form [UL, UR, LL, LR] as [(ULrow,ULcol),(URrow,URcol),…],[(ULLon,ULLat),(URLon,URLat),..]
-
calc_mean_VAA
()[source]¶ Calculates mean viewing azimuth angle using sensor flight line derived from full scene corner coordinates.
-
import_metadata
()[source]¶ Reads metainformation of the given file from the given ASCII metafile. Works for: RapidEye (metadata.xml),SPOT(metadata.dim),LANDSAT(mtl.txt),ASTER(downloaded coremetadata), ALOS(summary.txt & Leader file)
- Returns
-
reference_data
(out_CS='UTM')[source]¶ Perform georeferencing of self.arr or the corresponding data on disk respectively. Method is skipped if self.GeoAlign_ok and self.GeoTransProj_ok evaluate to ‘True’. All attributes connected with the georeference of self.arr are automatically updated.
-
gms_preprocessing.algorithms.L1B_P module¶
Level 1B Processor:
Detection of global/local geometric displacements.
-
class
gms_preprocessing.algorithms.L1B_P.
L1B_object
(L1A_obj=None)[source]¶ Bases:
gms_preprocessing.algorithms.L1A_P.L1A_object
:param : instance of gms_object.GMS_object or None
-
correct_spatial_shifts
(cliptoextent=True, clipextent=None, clipextent_prj=None, v=False)[source]¶ Corrects the spatial shifts calculated by self.compute_global_shifts().
- Parameters
cliptoextent (
bool
) – whether to clip the output to the given extentclipextent (
Optional
[list
]) – list of XY-coordinate tuples giving the target extent (if not given and cliptoextent is True, the ‘trueDataCornerLonLat’ attribute of the GMS object is usedclipextent_prj (
Optional
[any
]) – WKT projection string or EPSG code of the projection for the coordinates in clipextentv (
bool
) –
- Return type
- Returns
-
get_opt_bands4matching
(target_cwlPos_nm=550)[source]¶ Automatically determines the optimal bands used für fourier shift theorem matching
- Parameters
target_cwlPos_nm – the desired wavelength used for matching
-
property
spatRef_available
¶
-
-
class
gms_preprocessing.algorithms.L1B_P.
Scene_finder
(src_boundsLonLat, src_AcqDate, src_prj, src_footprint_poly, sceneID_excluded=None, min_overlap=20, min_cloudcov=0, max_cloudcov=20, plusminus_days=30, plusminus_years=10, logger=None)[source]¶ Bases:
object
Scene_finder class to query the postgreSQL database to find a suitable reference scene for co-registration.
Initialize Scene_finder.
- Parameters
src_boundsLonLat (list) –
src_AcqDate (datetime) –
src_prj (str) –
src_footprint_poly (Polygon) –
sceneID_excluded (int) –
min_overlap (int) – minimum overlap of reference scene in percent
min_cloudcov (int) – minimum cloud cover of reference scene in percent
max_cloudcov (int) – maximum cloud cover of reference scene in percent
plusminus_days (int) – maximum time interval between target and reference scene in days
plusminus_years (int) – maximum time interval between target and reference scene in years
gms_preprocessing.algorithms.L1C_P module¶
Level 1C Processor: Atmospheric correction of TOA-reflectance data.
-
class
gms_preprocessing.algorithms.L1C_P.
AtmCorr
(*L1C_objs, reporting=False)[source]¶ Bases:
object
Wrapper around atmospheric correction by Andre Hollstein, GFZ Potsdam
Creates the input arguments for atmospheric correction from one or multiple L1C_object instance(s) belonging to the same scene ID, performs the atmospheric correction and returns the atmospherically corrected L1C object(s).
- Parameters
L1C_objs – one or more instances of L1C_object belonging to the same scene ID
-
property
GSDs
¶ Returns a list of spatial samplings within the input GMS objects, e.g. [10,20,60].
-
property
band_spatial_sampling
¶ - Returns
e.g. {‘B01’: 60.0,
’B02’: 10.0, ‘B03’: 10.0, ‘B04’: 10.0, ‘B05’: 20.0, ‘B06’: 20.0, ‘B07’: 20.0, ‘B08’: 10.0, ‘B09’: 60.0, ‘B10’: 60.0, ‘B11’: 20.0, ‘B12’: 20.0, ‘B8A’: 20.0}
-
property
data
¶ - Returns
___ attribute: data, type:<class ‘dict’> ______ key:B05, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] 085998540.0803833 ]] ______ key:B01, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] 131225590.13208008]] ______ key:B06, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] .14965820.13977051]] ______ key:B11, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] .11492920.10192871]] ______ key:B02, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] 104187010.10308838]] ______ key:B10, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] 013099670.01300049]] ______ key:B08, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] .16857910.15783691]] ______ key:B04, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] 065490720.06228638]] ______ key:B03, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] 082702640.08148193]] ______ key:B12, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] 068420410.06060791]] ______ key:B8A, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] 192138670.17553711]] ______ key:B09, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] .09600830.09887695]] ______ key:B07, value_type:<class ‘numpy.ndarray’>, repr: [[nan nan nan …,0. [..] 173339840.15600586]]
-
property
logger
¶
-
property
metadata
¶ - Returns
___ attribute: metadata, type:<class ‘dict’> ______ key:spatial_samplings _________ key:60.0 ____________ key:ULY, value_type:<class ‘int’>, repr: 4900020 ____________ key:NCOLS, value_type:<class ‘int’>, repr: 1830 ____________ key:XDIM, value_type:<class ‘int’>, repr: 60 ____________ key:ULX, value_type:<class ‘int’>, repr: 600000 ____________ key:NROWS, value_type:<class ‘int’>, repr: 1830 ____________ key:YDIM, value_type:<class ‘int’>, repr: -60 _________ key:10.0 ____________ key:ULY, value_type:<class ‘int’>, repr: 4900020 ____________ key:NCOLS, value_type:<class ‘int’>, repr: 10980 ____________ key:XDIM, value_type:<class ‘int’>, repr: 10 ____________ key:ULX, value_type:<class ‘int’>, repr: 600000 ____________ key:NROWS, value_type:<class ‘int’>, repr: 10980 ____________ key:YDIM, value_type:<class ‘int’>, repr: -10 _________ key:20.0 ____________ key:ULY, value_type:<class ‘int’>, repr: 4900020 ____________ key:NCOLS, value_type:<class ‘int’>, repr: 5490 ____________ key:XDIM, value_type:<class ‘int’>, repr: 20 ____________ key:ULX, value_type:<class ‘int’>, repr: 600000 ____________ key:NROWS, value_type:<class ‘int’>, repr: 5490 ____________ key:YDIM, value_type:<class ‘int’>, repr: -20 ______ key:SENSING_TIME, value_type:<class ‘datetime.datetime’>, repr: 2016-03-26 10:34:06.538000+00:00
-
property
nodata
¶ - Returns
___ attribute: nodata, type:<class ‘dict’> ______ key:60.0, value_type:<class ‘numpy.ndarray’>, repr: [[ TrueTrueTrue …, [..] False False False]] ______ key:10.0, value_type:<class ‘numpy.ndarray’>, repr: [[ TrueTrueTrue …, [..] False False False]] ______ key:20.0, value_type:<class ‘numpy.ndarray’>, repr: [[ TrueTrueTrue …, [..] False False False]]
-
run_atmospheric_correction
(dump_ac_input=False)[source]¶ Collects all input data for atmospheric correction, runs the AC and returns the corrected L1C objects containing surface reflectance.
-
property
tile_name
¶ Returns S2A tile name. NOTE: this is only needed if no DEM is passed to ac_gms
- Returns
e.g. ‘32UMA’
-
class
gms_preprocessing.algorithms.L1C_P.
L1C_object
(L1B_obj=None)[source]¶ Bases:
gms_preprocessing.algorithms.L1B_P.L1B_object
:param : instance of gms_object.GMS_object or None
-
property
RAA_arr
¶ Get relative azimuth angle.
- Returns
-
property
SAA_arr
¶ Get solar azimuth angle.
- Returns
-
property
SZA_arr
¶ Get solar zenith angle.
- Returns
-
property
VAA_arr
¶ Get viewing azimuth angle.
- Returns
-
property
VZA_arr
¶ Get viewing zenith angle.
- Returns
-
property
lonlat_arr
¶ Calculates pixelwise 2D-array with longitude and latitude coordinates.
- Returns
-
property
gms_preprocessing.algorithms.L2A_P module¶
Level 2A Processor: Spatial homogenization
-
class
gms_preprocessing.algorithms.L2A_P.
L2A_object
(L1C_obj=None)[source]¶ Bases:
gms_preprocessing.algorithms.L1C_P.L1C_object
:param : instance of gms_object.GMS_object or None
gms_preprocessing.algorithms.L2B_P module¶
Level 2B Processor: Spectral homogenization
-
class
gms_preprocessing.algorithms.L2B_P.
L2B_object
(L2A_obj=None)[source]¶ Bases:
gms_preprocessing.algorithms.L2A_P.L2A_object
:param : instance of gms_object.GMS_object or None
gms_preprocessing.algorithms.L2C_P module¶
Level 2C Processor: Quality layers
-
class
gms_preprocessing.algorithms.L2C_P.
AccuracyCube
(GMS_obj)[source]¶ Bases:
geoarray.baseclasses.GeoArray
Get an instance of GeoArray.
- Parameters
path_or_array – a numpy.ndarray or a valid file path
geotransform – GDAL geotransform of the given array or file on disk
projection – projection of the given array or file on disk as WKT string (only needed if GeoArray is instanced with an array)
bandnames – names of the bands within the input array, e.g. [‘mask_1bit’, ‘mask_clouds’], (default: [‘B1’, ‘B2’, ‘B3’, …])
nodata – nodata value
progress – show progress bars (default: True)
q – quiet mode (default: False)
-
property
layers
¶ - Return type
-
class
gms_preprocessing.algorithms.L2C_P.
L2C_object
(L2B_obj=None)[source]¶ Bases:
gms_preprocessing.algorithms.L2B_P.L2B_object
:param : instance of gms_object.GMS_object or None
gms_preprocessing.algorithms.cloud_masking module¶
-
class
gms_preprocessing.algorithms.cloud_masking.
Cloud_Mask_Creator
(GMS_object, algorithm, target_res=None, tempdir_root=None)[source]¶ Bases:
object
A class for creating cloud masks.
- Parameters
GMS_object – instance or subclass instance of model.gms_object.GMS_object
algorithm – ‘FMASK’ or ‘Classical Bayesian
target_res – target resolution of the computed cloud mask (if not given, the appropriate resolution needed for atmospheric correction is chosen)
-
class
gms_preprocessing.algorithms.cloud_masking.
FMASK_Runner_Landsat
(path_providerArchive, satellite, TOARef=None, opticalDNs=None, thermalDNs=None, tempdir_root=None)[source]¶ Bases:
gms_preprocessing.algorithms.cloud_masking._FMASK_Runner
FMASK wrapper class for Landsat 4-8.
- Parameters
path_providerArchive – file path of the provider .tar.gz archive
satellite – name of the satellite: ‘Landsat-4’, ‘Landsat-5’, ‘Landsat-7’, ‘Landsat-8’
TOARef – file path or GeoArray instance of top-of-atmosphere reflectance data scaled from 0 to 10000 (optional -> generated from archive if not given)
opticalDNs – file path or GeoArray instance of optical data (digital numbers)
thermalDNs – file path or GeoArray instance of thermal data (digital numbers)
tempdir_root – directory to write intermediate data (auto-determined if not given)
-
property
TOARef
¶
-
property
angles_stack
¶
-
property
metaFile
¶
-
property
optical_stack
¶
-
property
saturationmask
¶
-
property
thermal_stack
¶
-
class
gms_preprocessing.algorithms.cloud_masking.
FMASK_Runner_Sentinel2
(path_providerArchive, satellite, scene_ID=None, granule_ID='', target_res=20, TOARef=None, extract_archive=False, tempdir_root=None)[source]¶ Bases:
gms_preprocessing.algorithms.cloud_masking._FMASK_Runner
FMASK wrapper class for Sentinel-2.
- Parameters
path_providerArchive – file path of the provider .zip archive
satellite – name of the satellite: ‘Sentinel-2A’ or ‘Sentinel-2B’
scene_ID – the GeoMultiSens scene ID of the given scene (needed if granule_ID is not given)
granule_ID – the Sentinel-2 granule ID
target_res – target spatial resolution of the cloud mask (default: 20m)
TOARef – file path or GeoArray instance of top-of-atmosphere reflectance data scaled from 0 to 10000 (optional -> read from archive if not given)
extract_archive – whether to extract the archive to disk or to read from the archive directly (default: False); NOTE: There is no remarkable speed difference.
tempdir_root – directory to write intermediate data (auto-determined if not given)
-
property
TOARef
¶
-
property
angles_stack
¶
-
property
granule_ID
¶ Gets the Sentinel-2 granule ID from the database using the scene ID in case the granule ID has not been given.
-
property
metaFile
¶
gms_preprocessing.algorithms.geoprocessing module¶
GEOPROCESSING OBJECT “GIS operations to manipulate spatial data. Takes an input dataset, performs an operation on that dataset and returns the result of the operation as an output dataset.
-
gms_preprocessing.algorithms.geoprocessing.
DN2DegreesCelsius_fastforward
(ndarray, offsets, gains, K1, K2, emissivity=0.95, inFill=None, inZero=None, inSaturated=None)[source]¶ Convert thermal DNs to temperatures in degrees Celsius by calculating TOARadiance and applying the inverse of the Planck function.
- Parameters
ndarray – <np.ndarray> array of DNs to be converted into Degrees Celsius
offsets –
gains –
K1 –
K2 –
emissivity –
inFill –
inZero –
inSaturated –
-
gms_preprocessing.algorithms.geoprocessing.
DN2Rad
(ndarray, offsets, gains, inFill=None, inZero=None, inSaturated=None, cutNeg=True)[source]¶ Convert DN to Radiance [W * m-2 * sr-1 * micrometer-1].
NOTE: InputGains and Offsets should be in [W * m-2 * sr-1 * micrometer-1]!!!
- Parameters
ndarray (
ndarray
) – <np.ndarray> array of DNs to be converted into radianceoffsets (
list
) – [W * m-2 * sr-1 * micrometer-1]: list that includes the offsets of the individual rasterbands [offset_band1, offset_band2, … ,offset_bandn] or optional input as number if Dataset has only 1 Bandgains (
list
) – [W * m-2 * sr-1 * micrometer-1]: list that includes the gains of the individual rasterbands [gain_band1, gain_band2, … , gain_bandn] or optional input as number if Dataset has only 1 BandinFill (
Optional
[int
]) – pixelvalues allocated to background/dummy/fill pixelsinZero (
Optional
[int
]) – pixelvalues allocated to zero radianceinSaturated (
Optional
[int
]) – pixelvalues allocated to saturated pixelscutNeg (
bool
) – cutNegvalues -> all negative values set to 0
- Return type
ndarray
-
gms_preprocessing.algorithms.geoprocessing.
DN2TOARef
(ndarray, offsets, gains, irradiances, zenith, earthSunDist, inFill=None, inZero=None, inSaturated=None, cutNeg=True)[source]¶ Converts DN data to TOA Reflectance.
- Parameters
ndarray (
ndarray
) – <np.ndarray> array of DNs to be converted into TOA reflectanceoffsets (
list
) – list: of offsets of each rasterband [W * m-2 * sr-1 * micrometer-1] [offset_band1, offset_band2, … ,offset_bandn] or optional as number if Dataset has only 1 Bandgains (
list
) – list: of gains of each rasterband [W * m-2 * sr-1 * micrometer-1] [gain_band1, gain_band2, … ,gain_bandn] or optional as number if Dataset has only 1 Bandirradiances (
list
) – list: of irradiance of each band [W * m-2 * micrometer-1] [irradiance_band1, irradiance_band2, … ,irradiance_bandn]zenith (
float
) – number: sun zenith angleearthSunDist (
float
) – earth-sun- distance for a certain dayinFill (
Optional
[int
]) – number: pixelvalues allocated to background/dummy/fill pixelsinZero (
Optional
[int
]) – number: pixelvalues allocated to zero radianceinSaturated (
Optional
[int
]) – number: pixelvalues allocated to saturated pixlescutNeg (
bool
) – bool: if true. all negative values turned to zero. default: True
- Return type
ndarray
- Returns
Int16 TOA_Reflectance in [0-10000]
-
class
gms_preprocessing.algorithms.geoprocessing.
GEOPROCESSING
(geodata, logger, workspace=None, subset=None, v=None)[source]¶ Bases:
object
-
add_GeoTransform_Projection_using_MetaData
(CornerTieP_LonLat, CS_EPSG=None, CS_TYPE=None, CS_DATUM=None, CS_UTM_ZONE=None, gResolution=None, shape_fullArr=None)[source]¶ Method assumes that north is up. Map rotations are not respected.
- Parameters
CornerTieP_LonLat –
CS_EPSG –
CS_TYPE –
CS_DATUM –
CS_UTM_ZONE –
gResolution –
shape_fullArr –
-
calc_mask_data_nodata
(array=None, custom_nodataVal=- 9999)[source]¶ Berechnet den Bildbereich, der von allen Kanälen abgedeckt wird.
- Parameters
array – input numpy array to be used for mask calculation (otherwise read from disk)
custom_nodataVal –
-
gdalinfo
()[source]¶ get properties of the Inputdatasets via gdalinfo
(die Infos die er hier ausschreibt in subrocess.Popen können einer variable als Text übergeben werden. Aus diesem Text kann ich dann die Infos als Attribute ausschreiben. als ersatz für die jetzige Attributerzeugung Muss die Attributerzeugung wirklich sein? kann ich nicht alle irgendwie über das GDAL-objekt abfragen! bis jetzt hab ich aber nur die Infos die oben stehen als Abfrage ermöglichen können
-
georeference_by_TieP_or_inherent_GCPs
(use_inherent_GCPs=False, TieP=None, dst_EPSG_code=None, dst_CS='UTM', dst_CS_datum='WGS84', mode='GDAL', use_workspace=True, inFill=None)[source]¶ Warp image to new Projection.
- Parameters
use_inherent_GCPs –
TieP – Corner Tie Points - always LonLat.
dst_EPSG_code – EPSG-Code defines LonLat or UTM coordinates.
dst_CS –
dst_CS_datum –
mode –
use_workspace –
inFill –
-
get_corner_coordinates
(targetProj)[source]¶ Returns corner coordinates of the entire GEOP object in lon/lat or UTM.
- ATTENTION: coordinates represent PIXEL CORNERS:
UL=UL-coordinate of (0,0) UR=UR-coordinate of (0,self.cols-1) => lonlat_arr always contains UL-coordinate of each pixel
- Parameters
targetProj – ‘LonLat’ or ‘UTM’
-
tondarray
(direction=1, startpix=None, extent=None, UL=None, LR=None, v=0)[source]¶ Convert gdalobject to 3dimensional ndarray stack ([x,y,z]).
- Parameters
direction –
- 1: shape: [bands, rows, cols]
-> same as theres read envi structure ([band1],[band2],..[bandn])
2: shape: [rows, bands, cols] 3: shape: [rows, cols, bands]
-> Structure used in PIL and IDL for example ([pixband1,pixband2,..,pixbandn],[pixband1,pixband2,..,pixbandn],…)
startpix – [x,y] pixels->UL:pixelcoordinates for subset generation
extent – [cols, rows] -> number of pixels in x and y-direction
UL – [x,y] map coordinates -> UL map coordinates for subset generation
LR – [x,y] map coordinates -> LR map coordinates for subset generation
v –
-
-
gms_preprocessing.algorithms.geoprocessing.
TOARad2Kelvin_fastforward
(ndarray, K1, K2, emissivity=0.95, inFill=None, inZero=None, inSaturated=None)[source]¶ Convert top-of-atmosphere radiances of thermal bands to temperatures in Kelvin by applying the inverse of the Planck function.
-
gms_preprocessing.algorithms.geoprocessing.
adjust_acquisArrProv_to_shapeFullArr
(arrProv, shapeFullArr, meshwidth=1, subset=None, bandwise=False)[source]¶
-
gms_preprocessing.algorithms.geoprocessing.
calc_AcqTime_array
(shape_fullArr, arr_pos, AcqDate, CenterAcqTime, fullSceneCornerPos, overpassDurationSec, meshwidth=1)[source]¶
-
gms_preprocessing.algorithms.geoprocessing.
calc_RAA_array
(SAA_array, VAA_array, nodata_mask=None, outFill=None)[source]¶ Calculate relative azimuth angle between solar azimuth and viewing azimuth in degrees.
- Parameters
SAA_array –
VAA_array –
nodata_mask –
outFill – the value to be used to fill areas outside the actual image bounds
- Returns
-
gms_preprocessing.algorithms.geoprocessing.
calc_SZA_SAA
(date, lon, lat)[source]¶ Calculates solar zenith and azimuth angle using pyephem.
- Parameters
date –
lon –
lat –
-
gms_preprocessing.algorithms.geoprocessing.
calc_SZA_SAA_array
(shape_fullArr, arr_pos, AcqDate, CenterAcqTime, fullSceneCornerPos, fullSceneCornerLonLat, overpassDurationSec, logger, meshwidth=1, nodata_mask=None, outFill=None, accurracy='coarse', lonlat_arr=None)[source]¶ Calculates solar zenith and azimuth angles for each pixel in the dataset using pyorbital.
- Parameters
shape_fullArr –
arr_pos –
AcqDate –
CenterAcqTime –
fullSceneCornerPos –
fullSceneCornerLonLat – UL, UR, LL, LR
overpassDurationSec –
logger –
meshwidth – <int> defines the density of the mesh used for generating the output (1: full resolution; 10: one point each 10 pixels)
nodata_mask – <numpy array>, used for declaring nodata values in the output SZA/SAA array
outFill – the value that is assigned to nodata area in the output SZA/SAA array
accurracy –
‘fine’ or ‘coarse’ - ‘fine’ : pixelwise acquisition time is used to calculate SZA/SAA
requires lonlat_arr to be specified
- ’coarse: SZA/SAA is calculated for image corners then interpolated by solving
an equation system with 4 variables for each image corner: SZA/SAA = a + b*col + c*row + d*col*row.
lonlat_arr –
-
gms_preprocessing.algorithms.geoprocessing.
calc_VAA_using_fullSceneCornerLonLat
(fullSceneCornerLonLat, orbit_params)[source]¶ Calculates the Viewing azimuth angle (defined as 90 degrees from the flight line), e.g. if flight line is 8 degrees from North -> VAA will be 98 degrees.
-
gms_preprocessing.algorithms.geoprocessing.
calc_VZA_array
(shape_fullArr, arr_pos, fullSceneCornerPos, viewing_angle, FOV, logger, meshwidth=1, nodata_mask=None, outFill=None)[source]¶ Calculate viewing zenith angles for each pixel in the dataset.
By solving an equation system with 4 variables for each image corner: VZA = a + b*col + c*row + d*col*row.
- Parameters
shape_fullArr –
arr_pos –
fullSceneCornerPos –
viewing_angle –
FOV –
logger –
meshwidth – <int> defines the density of the mesh used for generating the output (1: full resolution; 10: one point each 10 pixels)
nodata_mask – <numpy array>, used for declaring nodata values in the output VZA array
outFill – the value that is assigned to nodata area in the output VZA array
-
gms_preprocessing.algorithms.geoprocessing.
clip_array_using_mapBounds
(array, bounds, im_prj, im_gt, fillVal=0)[source]¶ - Parameters
array –
bounds –
im_prj –
im_gt –
fillVal –
-
gms_preprocessing.algorithms.geoprocessing.
convertGdalNumpyDataType
(dType)[source]¶ - input:
dType: GDALdataType string or numpy dataType
- output:
corresponding dataType
-
gms_preprocessing.algorithms.geoprocessing.
get_common_extent
(list_extentcoords, alg='outer', return_box=True)[source]¶ Returns the common extent coordinates of all given coordinate extents. NOTE: this function asserts that all input coordinates belong to the same projection!
- Parameters
list_extentcoords – a list of coordinate sets, e.g. [ [ULxy1,URxy1,LRxy1,LLxy1], ULxy2,URxy2,LRxy2,LLxy2],]
alg – ‘outer’: return the outer Polygon extent ‘inner’: return the inner Polygon extent
return_box – whether to return a coordinate box/envelope of the output Polygon
- Returns
[ULxy,URxy,LRxy,LLxy]
-
gms_preprocessing.algorithms.geoprocessing.
get_lonlat_coord_array
(shape_fullArr, arr_pos, geotransform, projection, meshwidth=1, nodata_mask=None, outFill=None)[source]¶ Returns numpy array containing longitude pixel coordinates (band 0) and latitude pixel coordinates (band 1).
- Parameters
shape_fullArr –
arr_pos –
geotransform –
projection –
meshwidth – <int> defines the density of the mesh used for generating the output (1: full resolution; 10: one point each 10 pixels)
nodata_mask – <numpy array>, used for declaring nodata values in the output lonlat array
outFill – the value that is assigned to nodata area in the output lonlat array
-
gms_preprocessing.algorithms.geoprocessing.
get_subsetProps_from_shapeFullArr_arrPos
(shape_fullArr, arr_pos)[source]¶ Returns array dims with respect to possible subsetting.
-
gms_preprocessing.algorithms.geoprocessing.
get_subsetProps_from_subsetArg
(shape_fullArr, subset)[source]¶
-
gms_preprocessing.algorithms.geoprocessing.
is_granule
(trueCornerPos)[source]¶ Idee: testen, ob es sich um Granule handelt oder um die volle Szene - dazu Winkel der Kanten zu Nord oder Ost berechnen
-
gms_preprocessing.algorithms.geoprocessing.
ndarray2gdal
(ndarray, outPath=None, importFile=None, direction=1, GDAL_Type='ENVI', geotransform=None, projection=None, v=0)[source]¶ Converts a numpy array to a Georasterdataset (default envi bsq).
bis jetzt nur georeferenzierung und projectionszuweisung durch import aus anderem file möglich
- Parameters
ndarray – [bands, rows, cols]
outPath – Path were to store the outputFile
importFile – path of a file, where to import the projection and mapinfos
direction –
GDAL_Type –
geotransform – gdal list for geotransformation [originX, pixelWidth, rot1, originY, pixelHeight, rot2]
projection – a gdal compatible projection string -> if importFile is not availabele geotransform and projection need to be set, otherwise a gdaldata set without coordinate system will be created
v –
- Returns
GDAL data File