LiCSAR proc
LiCSAR unwrapping module
Here we document the python tool lics_unwrap.py
. Note this is early attempt for the documentation.
LiCSAR Decompose
Module with some useful InSAR decomposition functions, not as great as approach of Dr. Andrew Watson.
- decompose_framencs(framencs, extract_cum=False, medianfix=False, annual=False, annual_buffer_months=0, selperiods=None)[source]
will decompose frame licsbas results the basenames in framencs should contain frame id, followed by ‘.’, e.g.: framencs = [‘062D_07629_131313.nc’, ‘172A_07686_131012.nc’]
- Parameters:
framencs (list) – licsbas nc result files, named by their frame id
extract_cum (bool) – if True, will use the first frame and convert to pseudo vertical
annual (bool) – if True, will estimate and decompose annual velocities
annual_buffer_months (int) – adds extra months for annual velocities
calculate_annual_vels (selperiods ... see)
- Returns:
xr.Dataset with U, E, [cum_vert] arrays
- custom_annual_resample(cube, buffermonths=6, buffer_from_midyear=False)[source]
Gets annual data resampled per year +- buffermonths if buffer_from_midyear, it will set buffermonths from the mid-year (June) rather than from Jan and Dec
- calculate_annual_vels(cube, commonyears=None, buffermonths=0, selperiods=None)[source]
Will calculate annual velocities from LiCSBAS results
- Parameters:
cube (xr.Dataset) – loaded netcdf file, extracted using e.g. LiCSBAS_out2nc.py
commonyears (list) – list of years to decompose
buffermonths (int) – extend selection of annual data by a number of +-buffermonths months (experimental)
selperiods (list or None) – override the selection by providing list as [[np.datetime64(‘2014-01-01’), np.datetime64(‘2024-01-01’)]]
- Returns:
vel_annual
- Return type:
xr.Dataset with new dataarray
- decompose_dask(cube, blocklen=5, num_workers=5)[source]
Simple parallel decomposition of dec. datacube (must have asc,desc,asc_inc,desc_inc, asc_heading, desc_heading arrays)
- decompose_xr(asc, desc, heading_asc, heading_desc, inc_asc, inc_desc, beta=0)[source]
Perform simple decomposition for two frames in asc and desc. inputs are xr.dataarrays - this will also check/interpolate them to fit
- decompose_np(vel_asc, vel_desc, aschead, deschead, ascinc, descinc, beta=0, do_velUN=True)[source]
Decomposes values from ascending and descending np (or xr) arrays, using heading and inc. angle (these might be arrays of same size of just float values)
- Parameters:
beta (float) – angle of expected horizontal motion direction, clockwise from the E, in degrees
do_velUN (boolean) – if yes, extract v_{UN} instead of v_U, following Qi et al, 2022: doi=10.1029/2F2022JB024176
LiCSInfo query functions
Various functions to query the LiCSInfo database
MySQL database query wrappers for LiCSAR processor
- delete_burst_from_db(bidtanx, onlyprint=False)[source]
Deletes the burst from database if it does not appear in a frame definition. Also cleans burst occurences in other tables, and removes all files related to the burst ID. For admins only!
- Parameters:
bidtanx (str) – LiCSAR Burst ID (e.g. ‘101_IW3_1360’)
onlyprint (bool) – if True, it will only print the parts to be run with SET FOREIGN_KEY_CHECKS=0/1 - not solved
Note: if onlyprint is needed, you may also want to import sys; backout=sys.stdout; sys.stdout = open(‘output.txt’,’wt’); …; sys.stdout=backout; Note for me: this way i created sql file, and then see cat lics_mysql.sh, to do mysql … licsar_live < sqlfile
- delete_file_from_db(ff, col='abs_path')[source]
Deletes all occurences of given file from the DB (including links to jobs and bursts).
- Parameters:
ff (str) – file identifier (specified by ‘col’)
col (str) – specifies the identifier - options: fid, name, abs_path
Note: col name is the filename without the tailing .zip
- clone_frame(frameold, framenew, step=1, oldpolyid=None, newpolyid=None)[source]
copies frame definition to a new name (‘cloning’ of frame). not tested without admin rights… works in two steps: 1, copy the frame records to the new name (and show old and new polyids) 2, use the returned polyids and set the polygons and link bursts (or step 0 to do this automatically… careful…)
- update_bids2S1_missing(onlyprint=False)[source]
Will try linking LiCSAR bursts to S1 burst definitions which are not linked yet
- get_s1burst_from_bidtanx(bidtanx, opass='A', only_geom=False)[source]
Function to match official S1 burst with the LiCSAR burst ID. It includes few checks: rel.orb. can be +-1, while keeping orbit direction, timing tolerance 1.5 s to find most probable matching burst, which centre is within 1 degree from the centre by the LiCSAR burst definition. The tolerance values can be stricter.
- Parameters:
bidtanx (str) – LiCSAR burst ID
opass (str) – orbit direction (‘A’/’D’ for ascending/descending pass)
only_geom (bool) – if True, function will return only polygon (shapely.geometry)
- get_orbdir_from_bidtanx(bidtanx)[source]
Get string ‘A’ or ‘D’ for ascending/descending
- Parameters:
bidtanx (str) – LiCSAR S1 Burst ID (e.g. ‘127_IW1_20509’)
- get_daz(polyid, epoch, getall=False)[source]
Gets values from the ESD database table for given frame and epoch.
- Parameters:
polyid (int) – frame polyid
epoch (str) – epoch, e.g. ‘20211022’
getall (bool) – if True, will return all values, not only azimuth offset
- delete_esds_for_frame(frame, epoch=None, test=True)[source]
In case of removing a frame, ensure the esd values are also purged. (by default, if epoch already exists in esd database, it would not be overwritten)
- Parameters:
frame (str) – frame ID
epoch (str) – epoch, e.g. ‘20210122’
- ingest_esd(frame, epoch, rslc3, daz, ccazi, ccrg, orb, overwrite=False)[source]
Function to import ESD (etc.) values to the database
- Parameters:
frame (str) – frame ID
epoch (str) – epoch, e.g. ‘20210122’
rslc3 (str) – epoch that was used as RSLC3, e.g. ‘20210110’
daz (float) – $Delta a$ [px] offset w.r.t. orbits (i.e. total azimuth offset, sd_daz+icc_daz)
ccazi (float) – $Delta a_{ICC}$ [px] offset from intensity/incoherent cross-correlation (ICC) in azimuth
ccrg (float) – $Delta r_{ICC}$ [px] offset from intensity/incoherent cross-correlation (ICC) in range
orb (str) – orbit file used here (e.g. S1A_POE_…..zip) - special value ‘fixed_as_in_GRL’ means imported from older data and fixed
LiCS Volc DB
Functions to work with volcanoes-related records/tables in the LiCSInfo database