Auxiliary functionality
small helper function to assess whether a GAMMA command shall be executed. |
|
Reader for ISP parameter files of the GAMMA software package |
|
GAMMA file name handler. |
|
Create an ENVI HDR file from a GAMMA PAR file |
|
wrapper function to execute GAMMA commands via module |
|
extract the corner coordinates of a SAR scene |
|
compute multilooking factors and pixel spacings from an ISPPar object for a defined ground range target pixel spacing |
|
convert a gamma parameter file corner coordinate from EQA to UTM |
- class pyroSAR.gamma.auxil.ISPPar(filename)[source]
Bases:
objectReader for ISP parameter files of the GAMMA software package
This class allows to read all information from files in GAMMA’s parameter file format. Each key-value pair is parsed and added as attribute. For instance if the parameter file contains the pair ‘sensor: TSX-1’ an attribute named ‘sensor’ with the value ‘TSX-1’ will be available.
The values are converted to native Python types, while unit identifiers like ‘dB’ or ‘Hz’ are removed. Please see the GAMMA reference manual for further information on the actual file format.
- Parameters:
filename (str) – the GAMMA parameter file
Examples
>>> from pyroSAR.gamma import ISPPar >>> with ISPPar('S1A__IW___A_20141115T181801_VH_grd.par') as par: ... print(par) # print an overview of all available metadata ... print(par.keys) # print all parameter names ... for key, value in par.envidict().items(): ... print('{0}: {1}'.format(key, value)) # print the ENVI HDR compliant metadata
- class pyroSAR.gamma.auxil.Namespace(directory, basename)[source]
Bases:
objectGAMMA file name handler. This improves managing the many files names handled when processing with GAMMA.
- Parameters:
directory (str) – the directory path where files shall be written.
basename (str) – the product basename as returned by
pyroSAR.drivers.ID.outname_base()
Examples
>>> n = Namespace(directory='/path', basename='S1A__IW___A_20180829T170631') >>> print(n.pix_geo) '-' >>> n.appreciate(['pix_geo']) >>> print(n.pix_geo) '/path/S1A__IW___A_20180829T170631_pix_geo'
- class pyroSAR.gamma.auxil.Spacing(par, spacing='automatic')[source]
Bases:
objectcompute multilooking factors and pixel spacings from an ISPPar object for a defined ground range target pixel spacing
- class pyroSAR.gamma.auxil.UTM(parfile)[source]
Bases:
objectconvert a gamma parameter file corner coordinate from EQA to UTM
- Parameters:
parfile (str) – the GAMMA parameter file to read the coordinate from
Example
>>> from pyroSAR.gamma import UTM >>> print(UTM('gamma.par').zone)
- pyroSAR.gamma.auxil.do_execute(par, ids, exist_ok)[source]
small helper function to assess whether a GAMMA command shall be executed.
- pyroSAR.gamma.auxil.par2hdr(parfile, hdrfile, modifications=None, nodata=None)[source]
Create an ENVI HDR file from a GAMMA PAR file
- Parameters:
Examples
>>> from pyroSAR.gamma.auxil import par2hdr >>> par2hdr('dem_seg.par', 'inc.hdr') # write a HDR file for byte data based on a parfile of float data >>> par2hdr('dem_seg.par', 'ls_map.hdr', modifications={'data_type': 1})
- pyroSAR.gamma.auxil.process(cmd, outdir=None, logfile=None, logpath=None, inlist=None, void=True, shellscript=None)[source]
wrapper function to execute GAMMA commands via module
subprocess- Parameters:
outdir (str) – the directory to execute the command in
logfile (str) – a file to write the command log to; overrides parameter logpath
logpath (str) – a directory to write logfiles to; the file will be named {GAMMA command}.log, e.g. gc_map.log; is overridden by parameter logfile
inlist (list) – a list of values, which is passed as interactive inputs via stdin
void (bool) – return the stdout and stderr messages?
shellscript (str) – a file to write the GAMMA commands to in shell format
- Returns:
the stdout and stderr messages if void is False, otherwise None
- Return type: