-
Notifications
You must be signed in to change notification settings - Fork 4
Data component
The first step to run an inversion with VMOD is to declare a Data object. The user should load the locations of data points (add_xs and add_ys) and the components for the data type.
For example the class that represents the GNSS data type (Gnss) has methods to add the east (add_uxs), north (add_uys), and vertical (add_uzs) components. Here we show an example on how to declare a GNSS object:
from vmod.data import Gnss
#Create Gnss object
obs=Gnss()
#Add the names of the stations
obs.add_names(names)
#Add the x and y coordinates of the stations
obs.add_xs(xs)
obs.add_ys(ys)
#Add deformation dataset in east (uxs), north (uys) and vertical (uzs)
obs.add_ux(uxs)
obs.add_uy(uys)
obs.add_uz(uzs)
#Add uncertainties in east (euxs), north (euys) and vertical (euzs)
obs.add_errx(euxs)
obs.add_erry(euys)
obs.add_errz(euzs)
Alternatively, the user can declare the Gnss object and arrange the GNSS data in a csv file and import the information into the object.
from vmod.data import Gnss
#Create Gnss object
obs=Gnss()
#Import csv into the observation object
obs.importcsv('examples/gps/unimak_gnss_NOAM.txt')
The text file should be arrange in the following way: Station name, longitude, latitude, east velocity, north velocity, vertical velocity, uncertainty in east, uncertainty in north and uncertainty in vertical.
%Name Lon Lat ux uy uz eux euy euz
AB06 -163.42345400042757 54.885322999350095 -0.0031118 -0.0010642 0.0015522 0.0000297 0.0000349 0.0000780
AC10 -164.88672999983683 54.522579999242880 -0.0068234 -0.0007091 0.0041480 0.0000378 0.0000401 0.0001143
The InSAR datasets can be import it into Insar objects. It is necessary to load the Line-Of-Sight observations (add_los), the azimuth and incidence angles (add_vecs).
from vmod.data import Insar
#Create Insar object
obs=Insar()
#Add the x and y coordinates of the stations
obs.add_xs(xs)
obs.add_ys(ys)
#Add azimuth and incidence angles.
obs.add_vecs(azs,lks)
#Add deformation dataset
obs.add_los(los)
VMOD has auxiliary libraries to downsample the InSAR datasets using a quadtree algorithm. The function get_quadtree expects a matrix with the LOS observations (los), the azimuth angle(s) (az), the incidence angle(s) (inc), an array that contains the extent of the image (extent), a variance threshold (th) and the name of the file (name) with the quadtree output.
from vmod import util
util.quadtree_var(los,az,inc,extent,th,name)
Similarly, as with the Gnss objects the information for the Insar object can be import it from a text file.
from vmod.data import Insar
csvfile_ref='examples/insar/unimak_des_ref.csv'
obs=Insar()
obs.importcsv(csvfile_ref,ori=[-164.5,54.7])
The first line of the text file should have the header with that has the location of the reference pixel, the dimensions of the interferogram, and the spatial extent. Then the following lines should be arrange as: longitude, latitude for the pixels or data points, azimuth angle, incidence angle, LOS velocity and the uncertainty in the LOS observations. The last two columns are optional to indicate how many pixels each data point represent (after the downsampling).
Reference (Lon,Lat): -164.3750557302111,54.52915370772697, Dimensions: 491,770, Extent: -164.96499666450117,-164.12175031191683,54.38552515474153,54.92376750745494
-164.591 54.726 -11.058264 34.954952 -0.000517 0.000000270 0 245 0 385
-164.922 54.593 -11.243279 33.936565 0.001856 0.000004178 275 306 0 48
This is the output of the auxiliary libraries to downsample the interferogram. Additionally, VMOD has auxiliary functions to read and change the reference pixel of the interferogram. The expected input formats are h5 files from MintPy. You can explore these functions in the notebook for the DVD exercise using the InSAR dataset.
The Tilt datasets can be import it into Tilt objects in a similar way as the Gnss objects. It is necessary to load the names of the stations, the locations (longitudes and latitudes, add_lls), the tilt displacements in the east (add_dx), tilt displacements in the north (add_dy) and the uncertainties for the observations (add_err).
from vmod.data import Tilt
names=np.array(['AV36','AV37','AV39'])
lons=np.array([-164.1268,-163.9972,-163.9985])
lats=np.array([54.7718,54.7094,54.8113])
dxs=np.array([0.0000,0.3368*1e-6,0.2976*1e-6])
dys=np.array([0.0000,1.0366*1e-6,-1.0382*1e-6])
errx=np.array([5e-7]*3)
erry=np.array([5e-7]*3)
tilt=Tilt()
tilt.add_names(names)
tilt.add_lls(lons,lats,ori=[-163.970,54.756])
tilt.add_dx(dxs)
tilt.add_dy(dys)
tilt.add_err(errx,erry)
Users wishing to include a new datatype should clone the source repository and create a new file in the data folder. This file should contain a new class that inherit from the 'Data' class and that has the functions to initialize the attributes, adding the components belonging to the datatype and a function to derive the components from 3d displacements. For example, in the Insar class we defined the following functions:
class Insar(Data):
def __init__():
...
def add_los(self, los):
...
def from_model3d(self, func):
...