-
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])
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):
...