Skip to content

Commit

Permalink
Add documentation to _process_latex_name
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelLucaAdams committed Nov 19, 2024
1 parent 738f06b commit 62ba059
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/sdf_xarray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,17 @@ def _process_grid_name(grid_name: str, transform_func) -> str:
return renamed_name

def _process_latex_name(variable_name: str) -> str:
"""Converts variable names to LaTeX format where possible
using the following rules:
- E -> E$_x$
- E -> E$_y$
- E -> E$_z$
This repeats for B, J and P. It only changes the variable
name if there are spaces around the affix (prefix + suffix)
or if there is no trailing space. This is to avoid changing variable
names that may contain these affixes as part of the variable name itself.
"""
prefixes = ["E", "B", "J", "P"]
suffixes = ["x", "y", "z"]
for prefix in prefixes:
Expand Down

0 comments on commit 62ba059

Please sign in to comment.