CoordinateGrid

class vspec_vsm.CoordinateGrid

Bases: object

Base class for all coordinate grids.

Attributes:
area

Get the area of each point as a fraction of the unit sphere.

Methods

cos_angle_from_disk_center(lat0, lon0)

Get the cosine of the angle from disk center.

display_grid(nlat, nlon, data)

Resample the data to a rectangular grid.

grid()

Get a grid of latitudes and longitudes.

new(grid_params)

Create an instance of a coordinate grid subclass from a set of parameters.

zeros([dtype])

Get an array of zeros.

Attributes Summary

area

Get the area of each point as a fraction of the unit sphere.

Methods Summary

cos_angle_from_disk_center(lat0, lon0)

Get the cosine of the angle from disk center.

display_grid(nlat, nlon, data)

Resample the data to a rectangular grid.

grid()

Get a grid of latitudes and longitudes.

new(grid_params)

Create an instance of a coordinate grid subclass from a set of parameters.

zeros([dtype])

Get an array of zeros.

Attributes Documentation

area

Get the area of each point as a fraction of the unit sphere.

Returns:

The area of each point.

Return type:

np.ndarray

Methods Documentation

cos_angle_from_disk_center(lat0: astropy.units.Quantity, lon0: astropy.units.Quantity) ndarray

Get the cosine of the angle from disk center.

Parameters:
Returns:

An array of cos(x) where x is the angle from disk center.

Return type:

np.ndarray

Notes

Recall

\[\mu = \cos{x}\]

Where \(x\) is the angle from center of the disk.

display_grid(nlat: int, nlon: int, data: ndarray | astropy.units.Quantity) Tuple[ndarray, ndarray, astropy.units.Quantity]

Resample the data to a rectangular grid.

Parameters:
  • nlat (int) – Number of latitude points to resample to.

  • nlon (int) – Number of longitude points to resample to.

  • data (np.ndarray or astropy.units.Quantity) – The data to display.

Returns:

  • lat (np.ndarray, shape=(nlat,)) – Array of latitudes.

  • lon (np.ndarray, shape=(nlon,)) – Array of longitudes.

  • dat (astropy.units.Quantity, shape=(nlat,nlon)) – The resampled data.

grid() Tuple[astropy.units.Quantity, astropy.units.Quantity]

Get a grid of latitudes and longitudes.

Returns:

  • lat (astropy.units.Quantity) – Array of latitudes.

  • lon (astropy.units.Quantity) – Array of longitudes.

static new(grid_params: int | Tuple[int, int])

Create an instance of a coordinate grid subclass from a set of parameters.

Parameters:

grid_params (int or tuple) – If a tuple, the first element is the number of latitude points and the second is the number of longitude points. If an int, it is the total number of points.

Returns:

grid – An instance of a coordinate grid subclass. If grid_params is a tuple, the grid is a RectangularGrid. If grid_params is an int, the grid is a SpiralGrid.

Return type:

SpiralGrid or RectangularGrid

Raises:

TypeError – If grid_params is not an int or a tuple.

zeros(dtype: str = 'float32') ndarray

Get an array of zeros.

Parameters:

dtype (str, default='float32') – Data type to pass to np.zeros.

Returns:

An array of zeros.

Return type:

np.ndarray