Currently, Tplot variables are maintained globally, which, despite its convenience, diverges from recommended Pythonic practices that favor encapsulation and modular design. A more structured and Pythonic approach could involve incorporating Tplot variables into an Xarray.Dataset since “Tplot variable” is really just a fancy name for an Xarray.DataArrray object. This integration would not only streamline data management but also align with the principles of effective data structuring and accessibility.
A possible use case: Plot a time-shifted variable and its original variable in a same panel, right now it is possible but troublesome by a deep copy and renaming. In contrast, it would be very straightforward if the variables are locally encapsulated in a Xarray.Dataset.
(P.S.: furthermore, considering that a Tplot variable is fundamentally an xarray.DataArray, there is a compelling case for subclassing xr.DataArray to extend its functionality, making them more versatile and tailored to data manipulation.)
Currently,
Tplot variables
are maintained globally, which, despite its convenience, diverges from recommended Pythonic practices that favor encapsulation and modular design. A more structured and Pythonic approach could involve incorporating Tplot variables into anXarray.Dataset
since “Tplot variable” is really just a fancy name for anXarray.DataArrray
object. This integration would not only streamline data management but also align with the principles of effective data structuring and accessibility.A possible use case: Plot a time-shifted variable and its original variable in a same panel, right now it is possible but troublesome by a deep copy and renaming. In contrast, it would be very straightforward if the variables are locally encapsulated in a
Xarray.Dataset
.(P.S.: furthermore, considering that a Tplot variable is fundamentally an
xarray.DataArray
, there is a compelling case for subclassingxr.DataArray
to extend its functionality, making them more versatile and tailored to data manipulation.)