pytomoatt.attarray

Submodule of xarray.Dataset for handling array data, which can be generated from pytomoatt.module.ATTModel.to_array and pytomoatt.data.ATTData.to_array.

class pytomoatt.attarray.Dataset(data_vars, coords, attrs=None)[source]

Bases: Dataset

Sub class of xarray.Dataset

classmethod from_xarray(dataset)[source]
interp_dep(depth: float, field: str, samp_interval: int | Sequence[int] = 0, rotate: Sequence[float] | None = None) ndarray[source]

Interpolate map view with given depth

Parameters:
  • depth (float) – Depth in km

  • field (str) – Field name in ATT model data

  • samp_interval (int or sequence of int, optional) – Sampling interval, defaults to 0. If a positive integer is provided, the same interval is used for both x/lon and y/lat directions. If a two-element sequence [Nx, Ny] is provided, Nx is used for x/lon and Ny is used for y/lat.

  • rotate – Rotation parameters [central_lat, central_lon, rotation_angle] in degrees. central_lat and central_lon are physical coordinates. When provided, returned longitudes and latitudes are converted to physical coordinates. Defaults to None.

Returns:

xyz data with 3 columns [lon, lat, value]

Return type:

numpy.ndarray

interp_sec(start_point: Sequence[float], end_point: Sequence[float], field: str, val: float = 10.0, flat_earth: bool = False, rotate: Sequence[float] | None = None, section_coord_type: Literal['cal', 'phy'] = 'cal', output_coord_type: Literal['cal', 'phy'] = 'cal') ndarray[source]

Interpolate value along a cross section

Parameters:
  • start_point (list or tuple) – start point with [lon1, lat1]

  • end_point (list or tuple) – end points with [lon2, lat2]

  • field (str) – Field name in ATT model data

  • val (float) – interval between successive points in km

  • flat_earth (bool, optional) – whether to use flat earth model, defaults to False

  • rotate – Rotation parameters [central_lat, central_lon, rotation_angle] in degrees. central_lat and central_lon are physical coordinates. Defaults to None.

  • section_coord_type (str, optional) – Coordinate type of start_point and end_point. Use “cal” for TomoATT computational coordinates or “phy” for physical coordinates. Defaults to “cal”.

  • output_coord_type (str, optional) – Coordinate type of longitude and latitude in the returned array. Use “cal” for TomoATT computational coordinates or “phy” for physical coordinates. Defaults to “cal”.

Returns:

xyz data with 5 columns [lon, lat, dis, dep, value]

Return type:

numpy.ndarray