paint.util

Submodules

Functions

convert_gk_to_lat_lon(→ tuple[float, float])

Convert a Gauss-Kruger coordinate to a latitude / longitude coordinate.

load_and_format_heliostat_axis_data(→ pandas.DataFrame)

Prepare the axis csv for concatenation by changing certain column names and rearranging the order.

load_and_format_heliostat_positions(→ pandas.DataFrame)

Prepare the heliostat positions csv for concatenation by changing certain column names and rearranging the order.

merge_and_sort_df(→ pandas.DataFrame)

Concatenate the heliostat position and heliostat axis data and sort in the correct order.

calculate_azimuth_and_elevation(→ tuple[numpy.ndarray, ...)

Calculate the azimuth and elevation given sun positions.

heliostat_id_to_name(→ str)

Convert a heliostat id to its name.

set_logger_config(→ None)

Set up the logger. Should only need to be done once. Generally, logging should only be done on the master rank.

Package Contents

paint.util.convert_gk_to_lat_lon(right: float, height: float) tuple[float, float]

Convert a Gauss-Kruger coordinate to a latitude / longitude coordinate.

Parameters

rightfloat

The right coordinate from the Gauss-Krueger coordinate system.

heightfloat

The height of the Gauss-Krueger coordinate system.

Returns

float

The converted latitude.

float

The converted longitude.

paint.util.load_and_format_heliostat_axis_data(arguments: argparse.Namespace) pandas.DataFrame

Prepare the axis csv for concatenation by changing certain column names and rearranging the order.

Parameters

argumentsargparse.Namespace

The arguments containing the input and output path.

Returns

pd.DataFrame

The processed axis dataframe.

paint.util.load_and_format_heliostat_positions(arguments: argparse.Namespace) pandas.DataFrame

Prepare the heliostat positions csv for concatenation by changing certain column names and rearranging the order.

Parameters

argumentsargparse.Namespace

The arguments containing the input and output path.

Returns

pd.DataFrame

The processed heliostat positions dataframe.

paint.util.merge_and_sort_df(df_heliostat_positions: pandas.DataFrame, df_axis: pandas.DataFrame) pandas.DataFrame

Concatenate the heliostat position and heliostat axis data and sort in the correct order.

Parameters

df_heliostat_positionspd.DataFrame

The dataframe containing the heliostat positions.

df_axispd.DataFrame

The dataframe containing the heliostat axis data.

Returns

pd.DataFrame

The concatenated and sorted dataframe.

paint.util.calculate_azimuth_and_elevation(df: pandas.DataFrame) tuple[numpy.ndarray, numpy.ndarray]

Calculate the azimuth and elevation given sun positions.

Parameters

dfpd.DataFrame

The pandas dataframe containing the sun positions.

Returns

np.ndarray

The calculated azimuth in degrees.

np.ndarray

The calculated elevation in degrees.

paint.util.heliostat_id_to_name(heliostat_id: int | str) str

Convert a heliostat id to its name.

Parameters

heliostat_idint | str

The heliostat ID to be converted.

Returns

str

The heliostat name derived from the heliostat ID.

paint.util.set_logger_config(level: int = logging.INFO, log_file: str | pathlib.Path | None = None, log_to_stdout: bool = True, colors: bool = True) None

Set up the logger. Should only need to be done once. Generally, logging should only be done on the master rank.

Parameters

levelint

The default level for logging. Default is logging.INFO.

log_filestr | Path, optional

The file to save the log to.

log_to_stdoutbool

A flag indicating if the log should be printed on stdout (Default: True).

colorsbool

A flag for using colored logs (Default: True).