avni.api.model module#

model api class

class avni.api.model.Model(client)[source]#

Bases: object

listModels(args={})[source]#

Fetch a list of available models.

none

result: dictionary containing list of models and model info.

addConfigDescriptions(ModelList={})[source]#

loads kernel, model descriptions from config object

evaluate_points(args_in={})[source]#

Evaluates list of lat/lon/depth points for a given parameter (‘vs’)

args_in: dictionary of arguments:

required args:

‘lat’: latitude in degrees ‘lon’: longitude in degrees ‘depth’: depth in km

lat, lon and depth are scalars, lists or numpy arrays. arrays must be 1d, all must be the same size.

optional args (default):

‘model’: model to use, string (‘S362ANI+M’) ‘kernel’: model to use, string (‘BOX25km_PIX1X1’) ‘parameter’: parameter to fetch, string (‘vs’) ‘interpolated’: 1/0 for interpolation with KdTree (1)

model+kernel must match a model file. (see listModels() method)

result: dictionary with scalar/list/numpy array of same size as input

depthProfile(args_in={}, return_numpy=True)[source]#

Evaluates a depth profile centered on provided lat/lon for a given parameter (‘vs’)

args_in: dictionary of arguments:

required args:

‘lat’: latitude in degrees ‘lon’: longitude in degrees

lat, lon and depth are scalars

optional args (default):

‘N_depth’: depth in km, integer (100) ‘depthMin’: min depth, float (0.) ‘depthMax’: max depth, float (2890) ‘model’: model to use, string (‘S362ANI+M’) ‘kernel’: model to use, string (‘BOX25km_PIX1X1’) ‘parameter’: parameter to fetch, string (‘vs’) ‘interpolated’: 1/0 for interpolation with KdTree (1)

model+kernel must match a model file. (see listModels() method)

result: dictionary with numpy array of parameter, depth

crossSection(args={})[source]#

Interpolation of cross-section along a great circle path

args: dictionary of arguments:

required args:

‘lat’: starting latitude in degrees, float, ‘lon’: starting longitude in degrees, float, ‘azimuth’: direction to move from starting lat/lon

(degrees clockwise from North, 90=East, 270=West)

‘gcdelta’: great circle distance (degrees) to move along azimuth

optional args (default):

‘model’: model to use, string (‘S362ANI+M’) ‘kernel’: model to use, string (‘BOX25km_PIX1X1’) ‘parameter’: parameter to fetch, string (‘vs’) ‘interpolated’: 1/0 for interpolation with KdTree (1) ‘quickInterp’: 1/0 for quick interpolation (0) ‘includeTopo’: 1/0 for incuding topography along transect (0)

model+kernel must match a model file. (see listModels() method)

result: dictionary of results, including numpy arrays

if args[‘parameter’]=’vs’,

result={‘parameter’:string with parameter name, e.g., ‘vs’

‘vs’: 2d numpy array, ‘depth’: 1d array,depth in km, ‘lat’: 1d array, latitude of surface points, ‘lon’: 1d array, longitude of surface points, ‘theta’: 1d array, angular distance along transect [degrees] ‘topo’: 1d array, topography along transect if includeTopo }

fixedDepth(args={})[source]#

Interpolation at a fixed depth.

args: dictionary of arguments:

required args:

‘depth’: the constant depth to use in km

optional args:

‘lat1’: starting latitude in degrees, float (-90.) ‘lon1’: starting longitude in degrees, float (0.) ‘lat2’: end latitude in degrees, float (90.) ‘lon2’: end longitude in degrees, float (360.) if using any of the optional above args, you must use all of them. The result will be values in a grid formed by taking start and end coordinates are the opposing points of a box with the vertex coordinates (lat2,lon1), (lat2,lon2), (lat1,lon1), (lat1,lon2). If not specifying coordinates, will extract values at a fixed depth for the whole earth.

‘Nlat’: number of latitude points to extract, int (100) ‘Nlon’: number of longitude points to extract, int (200) ‘model’: model to use, string (‘S362ANI+M’) ‘kernel’: model to use, string (‘BOX25km_PIX1X1’) ‘parameter’: parameter to fetch, string (‘vs’) ‘interpolated’: 1/0 for interpolation with KdTree (1) ‘quickInterp’: 1/0 for quick interpolation (0)

model+kernel must match a model file. (see listModels() method)

result: dictionary of results, including numpy arrays

if args[‘parameter’]=’vs’,

result={‘parameter’:string with parameter name, e.g., ‘vs’

‘vs’: 2d numpy array with shape (len(lat),len(lon)), ‘lat’: 1d array, latitude ‘lon’: 1d array, longitude }