Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multidimensional Coord #79

Open
alexhad6 opened this issue Apr 28, 2024 · 1 comment
Open

Multidimensional Coord #79

alexhad6 opened this issue Apr 28, 2024 · 1 comment

Comments

@alexhad6
Copy link
Contributor

In Xarray, coordinates can be multidimensional. However, the Coord object currently cannot specify multiple dimensions and therefore requires a multidimensional array.

Solution: Keep the default behavior of Coord (to be 1D and have the name automatically be the dimension), but add the ability to specify multiple dimensions separately from the name.

@alexhad6
Copy link
Contributor Author

alexhad6 commented Apr 28, 2024

Example from Mo:

from datalogs import Logger, Coord, DataVar
import numpy as np

node_logger = Logger("logs")
time = np.linspace(0, 100, 11)
voltage = np.linspace(0, 10, 21)
times, voltages = np.meshgrid(time, voltage)
signal = np.cos(2*np.pi*voltages*times/200)
node_logger.log_data(
    "q1_spec_signal",
    [Coord("x", data=times, long_name="Time", units="s"), Coord("y", data = voltages, long_name = "Voltage", units = "V")],
    [DataVar("signal", dims=("x","y"), data=signal, long_name="Signal", units="a.u.")],
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant