pyRTX.classes.Planet

Classes

AlbedoGrid(**kwargs)

Represents a planetary albedo grid.

EmissivityGrid(**kwargs)

Represents a planetary emissivity grid.

Planet([fromFile, radius, name, bodyFrame, ...])

Represents a celestial body, such as a planet or moon.

PlanetGrid()

A base class for representing planetary grids, such as albedo, emissivity, and temperature maps.

TemperatureGrid(**kwargs)

Represents a planetary temperature grid.

class pyRTX.classes.Planet.PlanetGrid[source]

A base class for representing planetary grids, such as albedo, emissivity, and temperature maps.

__init__()[source]

Initializes the PlanetGrid object.

property attrs

Returns the attributes of the underlying xarray Dataset.

Returns:

The attributes of the xarray Dataset.

Return type:

dict

property axes

Returns the coordinate axes of the grid.

Returns:

A list of the grid’s coordinate axes.

Return type:

list

property frame

Returns the SPICE reference frame of the grid.

Returns:

The name of the SPICE reference frame.

Return type:

str

property dims

Returns the dimensions of the grid’s data.

Returns:

A tuple of the grid’s dimensions.

Return type:

tuple

property periodicity

Returns the longitudinal periodicity of the grid (180 or 360 degrees).

Returns:

The periodicity of the grid in degrees.

Return type:

int

get_data(epoch=None)[source]

Returns the grid’s data.

Parameters:

epoch (float, optional) – The epoch for which to retrieve the data, if the grid is time-dependent.

Returns:

The grid’s data.

Return type:

numpy.ndarray

__getitem__(idxs)[source]

Allows indexing into the grid to retrieve interpolated values.

Parameters:

idxs (tuple) – A tuple of indices for each dimension of the grid.

Returns:

The interpolated value(s) at the given indices.

Return type:

float or numpy.ndarray

save(filename: str, complev: int = 1)[source]

Saves the grid to a NetCDF file.

Parameters:
  • filename (str) – The path to the output file.

  • complev (int, default 1) – The compression level for the output file.

plot(epoch=None)[source]

Plots the grid data on a 2D map and a 3D sphere.

Parameters:

epoch (float, optional) – The epoch for which to plot the data, if the grid is time-dependent.

class pyRTX.classes.Planet.EmissivityGrid(**kwargs)[source]

Represents a planetary emissivity grid.

__init__(**kwargs)[source]

Initializes the EmissivityGrid object.

Parameters:
  • radius (float, optional) – The radius of the planet.

  • frame (str, optional) – The SPICE reference frame of the grid.

  • planet_name (str, optional) – The name of the planet.

  • axes (list, optional) – A list of the grid’s coordinate axes.

  • from_array (str, optional) – The path to a file (.nc or .npy) from which to load the grid data.

class pyRTX.classes.Planet.AlbedoGrid(**kwargs)[source]

Represents a planetary albedo grid.

__init__(**kwargs)[source]

Initializes the AlbedoGrid object.

Parameters:
  • radius (float, optional) – The radius of the planet.

  • frame (str, optional) – The SPICE reference frame of the grid.

  • planet_name (str, optional) – The name of the planet.

  • axes (list, optional) – A list of the grid’s coordinate axes.

  • from_array (str, optional) – The path to a file (.nc or .npy) from which to load the grid data.

class pyRTX.classes.Planet.TemperatureGrid(**kwargs)[source]

Represents a planetary temperature grid.

__init__(**kwargs)[source]

Initializes the TemperatureGrid object.

Parameters:
  • albedo (AlbedoGrid or float, optional) – The albedo of the planet.

  • base_flux (float, optional) – The base solar flux at 1 AU.

  • radius (float, optional) – The radius of the planet.

  • frame (str, optional) – The SPICE reference frame of the grid.

  • planet_name (str, optional) – The name of the planet.

  • nightside_temp (float, optional) – The nightside temperature of the planet.

  • emissivity (EmissivityGrid or float, optional) – The emissivity of the planet.

  • step (int, optional) – The step size for the grid computation.

  • axes (list, optional) – A list of the grid’s coordinate axes.

  • epochs (list of float, optional) – A list of epochs for which to compute the temperature grid.

  • from_array (str, optional) – The path to a file (.nc or .npy) from which to load the grid data.

get_albedo(epoch, dir)[source]

Retrieves the albedo value for a given direction and epoch.

Parameters:
  • epoch (float) – The epoch for which to retrieve the albedo.

  • dir (numpy.ndarray) – The direction vector for which to retrieve the albedo.

Returns:

The albedo value.

Return type:

float

get_emissivity(epoch, dir)[source]

Retrieves the emissivity value for a given direction and epoch.

Parameters:
  • epoch (float) – The epoch for which to retrieve the emissivity.

  • dir (numpy.ndarray) – The direction vector for which to retrieve the emissivity.

Returns:

The emissivity value.

Return type:

float

compute(epochs, step)[source]

Computes the temperature grid in the sun-fixed frame.

Parameters:
  • epochs (list of float) – A list of epochs for which to compute the temperature grid.

  • step (int) – The latitude and longitude step in degrees.

class pyRTX.classes.Planet.Planet(fromFile=None, radius=0, name='', bodyFrame='', sunFixedFrame='', units='km', subdivs=4)[source]

Represents a celestial body, such as a planet or moon.

__init__(fromFile=None, radius=0, name='', bodyFrame='', sunFixedFrame='', units='km', subdivs=4)[source]

Initializes the Planet object.

Parameters:
  • fromFile (str, optional) – Path to an OBJ file to build the model from. If None, a sphere is created.

  • radius (float, default 0) – The radius of the planet (if creating a sphere).

  • name (str, default '') – The name of the planet.

  • bodyFrame (str, default '') – The SPICE reference frame for the planet’s body.

  • sunFixedFrame (str, default '') – The body-centered, sun-fixed reference frame.

  • units (str, default 'km') – The units for the planet’s dimensions.

  • subdivs (int, default 4) – The number of subdivisions for the icosphere (if creating a sphere).

mesh(translate=None, rotate=None, epoch=None, targetFrame=None)[source]

Returns the planet’s mesh, optionally transformed.

Parameters:
  • translate (list or numpy.ndarray, optional) – A 3-element vector for the translation.

  • rotate (str, optional) – The name of the reference frame to rotate from.

  • epoch (float, optional) – The epoch for the rotation.

  • targetFrame (str, optional) – The name of the reference frame to rotate to.

Returns:

The transformed mesh.

Return type:

trimesh.Trimesh

albedoFaces(epoch, spacecraft_name)[source]

Returns the indices and albedo values of the faces that contribute to the albedo calculation.

Parameters:
  • epoch (float) – The epoch for the calculation.

  • spacecraft_name (str) – The name of the spacecraft.

Returns:

A tuple containing the indices of the albedo faces and their corresponding albedo values.

Return type:

tuple

rot_toSCframe(epoch, scFrame=None)[source]

Returns the rotation matrix from the sun-fixed frame to a spacecraft frame.

Parameters:
  • epoch (float) – The epoch for the rotation.

  • scFrame (str, optional) – The name of the spacecraft frame.

Returns:

The 3x3 rotation matrix.

Return type:

numpy.ndarray

emissivityFaces(epoch, spacecraft_name)[source]

Returns the indices, temperatures, and emissivities of the faces that contribute to the emissivity calculation.

Parameters:
  • epoch (float) – The epoch for the calculation.

  • spacecraft_name (str) – The name of the spacecraft.

Returns:

A tuple containing the indices of the emissive faces, their temperatures, and their emissivities.

Return type:

tuple

getFaceAlbedo(epoch)[source]

Returns the albedo of each face at a given epoch.

Parameters:

epoch (float) – The epoch for the calculation.

Returns:

An array containing the albedo of each face.

Return type:

numpy.ndarray

getFaceTemperatures(epoch)[source]

Returns the temperature of each face at a given epoch.

Parameters:

epoch (float) – The epoch for the calculation.

Returns:

An array containing the temperature of each face.

Return type:

numpy.ndarray

getFaceEmissivity(epoch, sunFixedFrame=False)[source]

Returns the emissivity of each face at a given epoch.

Parameters:
  • epoch (float) – The epoch for the calculation.

  • sunFixedFrame (bool, default False) – If True, the calculation is performed in the sun-fixed frame.

Returns:

An array containing the emissivity of each face.

Return type:

numpy.ndarray

VFNC(epoch, sunFixedFrame=True)[source]

Returns the vertices, faces, normals, and centroids of the planet’s mesh.

Parameters:
  • epoch (float) – The epoch for the calculation.

  • sunFixedFrame (bool, default True) – If True, the mesh is rotated to the sun-fixed frame.

Returns:

A tuple containing the vertices, faces, normals, and centroids.

Return type:

tuple

getScPosSunFixed(epoch, spacecraft_name)[source]

Returns the position of a spacecraft in the sun-fixed frame.

Parameters:
  • epoch (float) – The epoch for the calculation.

  • spacecraft_name (str) – The name of the spacecraft.

Returns:

The position of the spacecraft.

Return type:

numpy.ndarray

pxform_convert(pxform)[source]

Converts a 3x3 SPICE rotation matrix to a 4x4 transformation matrix.

Parameters:

pxform (numpy.ndarray) – The 3x3 rotation matrix.

Returns:

The 4x4 transformation matrix.

Return type:

numpy.ndarray

property dayside_temperature

The dayside temperature of the planet.

property nightside_temperature

The nightside temperature of the planet.

property gridded_temperature

The gridded temperature of the planet.

property albedo

The albedo of the planet.

property albedo_map

The albedo map settings for the planet.

property emissivity

The emissivity of the planet.