insartimeseries class¶
- class csi.insartimeseries(name, utmzone=None, ellps='WGS84', verbose=True, lon0=None, lat0=None)¶
A class that handles a time series of insar data
- Args:
name : Name of the dataset.
- Kwargs:
utmzone : UTM zone (optional, default=None)
lon0 : Longitude of the center of the UTM zone
lat0 : Latitude of the center of the UTM zone
ellps : ellipsoid (optional, default=’WGS84’)
verbose : Speak to me (default=True)
- buildCd(sigma, lam, function='exp', diagonalVar=False, normalizebystd=False)¶
Builds the full Covariance matrix from values of sigma and lambda.
- If function=’exp’:
\[C_d(i,j) = \sigma^2 e^{-\frac{||i,j||_2}{\lambda}}\]- Elif function=’gauss’:
\[C_d(i,j) = \sigma^2 e^{-\frac{||i,j||_2^2}{2\lambda}}\]- Args:
sigma : Sigma term of the covariance
lam : Caracteristic length of the covariance
- Kwargs:
function : Can be ‘gauss’ or ‘exp’
diagonalVar : Substitute the diagonal by the standard deviation of the measurement squared
normalizebystd : Normalize Cd by the stddeviation (weird idea… why would you do that?)
- cleanProfiles(prefix, xlim=None, zlim=None, verbose=False)¶
Wrapper around cleanProfile of insar. see cleanProfile method of insar class
- dates2time(start=0)¶
Computes a time vector in years, starting from the date #start.
- Kwargs:
start : Index of the starting date.
- Returns:
time, an array of floats
- extractAroundGPS(gps, distance, doprojection=True, reference=False, verbose=False)¶
Returns a gps object with values projected along the LOS around the gps stations included in gps. In addition, it projects the gps displacements along the LOS
- Args:
gps : gps object
distance : distance to consider around the stations
- Kwargs:
doprojection : Projects the gps enu disp into the los as well
reference : if True, removes to the InSAR the average gps displacemnt in the LOS for the points overlapping in time.
verbose : Talk to me
- Returns:
None
- getInsarAtDate(date, verbose=True)¶
Given a datetime instance, returns the corresponding insar instance.
- Args:
date : datetime instance.
- Kwargs:
verbose : talk to me
- Returns:
insar : instance of insar class
- getProfiles(prefix, loncenter, latcenter, length, azimuth, width, verbose=False)¶
Get a profile for each time step for Arguments, check in insar getprofile
- Args:
prefix : Prefix to build the name of the profiles (each profile will be named ‘prefix date’)
loncenter : Longitude of the center of the profile
latcenter : Latitude of the center of the profile
length : length of the profile
azimuth : Azimuth of the profile
width : Width of the profile
- Kwargs:
verbose : talk to me
- Returns:
None. Profiles are stored in the attribute {profiles}
- initializeTimeSeries(time=None, start=None, end=None, increment=None, steps=None, dtype='d')¶
Initializes the time series object using a series of dates. Two modes of input are possible
- Mode 1:
time : List of dates (datetime object)
- Mode 2:
start : Starting date (datetime object)
end : Ending date
increment : Increment of time in days
steps : How many steps
- Returns:
None
- plotProfiles(prefix, figure=124, show=True, norm=None, xlim=None, zlim=None, marker='.', color='k', line=False, linewidth=2, figsize=(20, 20), view=None, markersize=0.1, aspectRatio=1.0)¶
Plots the profiles in 3D plot.
- Args:
prefix : prefix of the profile to plot
- Kwargs:
figure : figure number
show : True/False
norm : tuple of upper and lower limit along the z-axis
xlim : tuple of upper and lower limit along the x-axis (removes the points before plotting)
zlim : tuple of upper and lower limit along the z-axis (removes the points before plotting)
marker : matplotlib marker style
color : matplotlib color style
line : If True, plots a line (default is False)
linewidth : controls the width of the line
view : list of elevation angle and azimuth (default is None)
aspectRatio : aspect of the z-axis with respect to other axis
- Returns:
None
- readFromGIAnT(h5file, setmaster2zero=None, zfile=None, lonfile=None, latfile=None, filetype='f', incidence=None, heading=None, inctype='onefloat', field='recons', keepnan=False, mask=None, readModel=False)¶
Read the output from a typical GIAnT h5 output file.
- Args:
h5file : Input h5file
- Kwargs:
setmaster2zero: If index is provided, master will be replaced by zeros (no substraction)
zfile : File with elevation
lonfile : File with longitudes
latfile : File with latitudes
filetype : type of data in lon, lat and elevation file (default: ‘f’)
incidence : Incidence angle (degree)
heading : Heading angle (degree)
inctype : Type of the incidence and heading values (see insar.py for details). Can be ‘onefloat’, ‘grd’, ‘binary’, ‘binaryfloat’
field : Name of the field in the h5 file.
mask : Adds a common mask to the data. mask is an array the same size as the data with nans and 1. It can also be a tuple with a key word in the h5file, a value and ‘above’ or ‘under’
readModel : Reads the model parameters
- Returns:
None
- readFromKFts(h5file, setmaster2zero=None, zfile=None, lonfile=None, latfile=None, filetype='f', incidence=None, heading=None, inctype='onefloat', closeh5=True, box=None, field='rawts', error='rawts_std', keepnan=False, mask=None, readModel=False)¶
Read the output from a typical GIAnT h5 output file.
- Args:
h5file : Input h5file (phase file)
- Kwargs:
setmaster2zero: If index is provided, master will be replaced by zeros (no substraction)
zfile : File with elevation
lonfile : File with longitudes
latfile : File with latitudes
filetype : type of data in lon, lat and elevation file (default: ‘f’)
incidence : Incidence angle (degree)
box : Crop data (default None), ex: [y0:y1,x0:x1]
heading : Heading angle (degree)
inctype : Type of the incidence and heading values (see insar.py for details). Can be ‘onefloat’, ‘grd’, ‘binary’, ‘binaryfloat’
field : Name of the field in the h5 file.
error : Name of the phase std deviation field.
mask : Adds a common mask to the data. mask is an array the same size as the data with nans and 1. It can also be a tuple with a key word in the h5file, a value and ‘above’ or ‘under’
- Returns:
None
- readFromStamps(tsfile, lonlatfile, datefile, setmaster2zero=None, incidence=None, heading=None, inctype='onefloat', keepnan=False)¶
Read the output from a typical Stamps mat file
- Returns:
None
- readModelFromGIAnT()¶
Read the model parameters from GIAnT after one has read the time series
- Note:
One needs to run the readFromGIAnT method.
- Returns:
None
- reference2area(lon, lat, radius)¶
References the time series to an area. Selects the area and sets all dates to zero at this area.
- Args:
lon : longitude of the center of the area
lat : latitude of the center of the area
radius : Radius of the area
- Returns:
None
- reference2timeseries(gpstimeseries, distance=4.0, verbose=True, parameters=1, daysaround=2, propagate='mean')¶
References the InSAR time series to the GPS time series. We estimate a linear function of range and azimuth on the difference between InSAR and GPS at each insar epoch.
We solve for the a, b, c terms in the equation:
- Args:
gpstimeseries : A gpstimeseries instance.
- Kwargs:
daysaround : How many days around the date do we consider
distance : Diameter of the circle surrounding a gps station to gather InSAR points
verbose : Talk to me
parameters : 1, 3 or 4
propagate : ‘mean’ if no gps data available
- Returns:
sargps : a gpstimeseries instance with the InSAR values around the GPS stations
- referenceProfiles(prefix, xmin, xmax, verbose=False)¶
Removes the mean value of points between xmin and xmax for all the profiles.
- Args:
prefix : Prefix of the profiles
xmin : Minimum x-value
xmax : Maximum x-value
- Kwargs:
verbose : talk to me
- Returns:
None. Directly modifies the profiles in attribute {profiles}
- referenceProfiles2Date(prefix, date)¶
Removes the profile at date ‘date’ to all the profiles in the time series.
- Args:
prefix : Name of the profiles
date : Tuple of 3, (year(int), month(int), day(int)), or 6, (year(int), month(int), day(int), hour(int), min(int), s(float)), numbers for the date
- Returns:
None. Creates a new set of profiles with names starting by “Referenced”
- referenceTimeSeries2Date(date)¶
References the time series to the date given as argument.
- Args:
date : Can a be tuple/list of 3 integers (year, month, day) or a tuple/list of 6 integers (year, month, day, hour, min, sec) or a datetime object.
- Returns:
None. Directly modifies time series
- removeDate(date)¶
Remove one date from the time series.
- Args:
date : tuple of (year, month, day) or (year, month, day ,hour, min,s)
- Returns:
None
- removeDates(dates)¶
Remove a list of dates from the time series.
- Args:
dates : List of dates to be removed. Each date can be a tuple (year, month, day) or (year, month, day, hour, min, sd).
- Returns:
None
- select_pixels(minlon, maxlon, minlat, maxlat)¶
Select the pixels in a box defined by min and max, lat and lon.
- Args:
minlon : Minimum longitude.
maxlon : Maximum longitude.
minlat : Minimum latitude.
maxlat : Maximum latitude.
- Returns:
None. Directly kicks out pixels that are outside the box
- setLonLat(lon, lat, incidence=None, heading=None, elevation=None, dtype='d')¶
Sets the lon and lat array and initialize things.
- Args:
lon : Can be an array or a string.
lat : Can be an array or a string.
- Kwargs:
incidence : Can be an array or a string.
heading : Can be an array or a string.
elevation : Can be an array or a string.
- Returns:
None
- setTimeSeries(timeseries)¶
Sets the values in the time series.
- Args:
timeseries : List of arrays of the right size.
- Returns:
None
- smoothProfiles(prefix, window, verbose=False, method='mean')¶
Runs an simple mean or median filter on all profiles
- Args:
prefix : prefix of the profiles
window : width of the window (km)
- Kwargs:
method : ‘mean’ or ‘median’
verbose : talk to me
- Returns:
None. Creates new profiles in the attribute {profiles} with names starting by “Smoothed”
- write2GRDs(prefix, interp=100, cmd='surface', oversample=1, tension=None, verbose=False, useGMT=False)¶
Write all the dates to GRD files. For arg description, see insar.write2grd
- write2h5file(h5file, field='recons')¶
Writes the time series in a h5file
- Args:
h5file : Output h5file
- Kwargs:
field : name of the field in the h5 file
- Returns:
None
- write2lonlath5(filename, nSamples=None, increments=None, verbose=True)¶
Maps the data onto a geocoded h5file.
- Args:
filename : Output file name
nSamples : number of points along lon and lat (int or tuple of ints)
increments : longitude and latitude increments (float or tuple of floats)
verbose : True/False
- writeProfiles2Files(profileprefix, outprefix, fault=None, verbose=False, smoothed=False)¶
Write all the profiles to a file.
- Args:
profileprefix : prefix of the profiles to write
outprefix : prefix of the output files
- Kwargs:
fault : add intersection with a fault
verbose : talk to me
smoothed : Do we write the smoothed profiles?
- Returns:
None
- writeProfiles2OneFile(profileprefix, filename, verbose=False, smoothed=False)¶
Write the profiles to one file
- Args:
profileprefix : prefix of the profiles to write
filename : output filename
- Kwargs:
verbose : talk to me
smoothed : do we write the smoothed profiles?
- Returns:
None