Skip to content
Snippets Groups Projects
Commit 5463da78 authored by Rob Moss's avatar Rob Moss
Browse files

Return correct metadata when loading observations

parent 1a14e6c6
Branches
Tags
No related merge requests found
Pipeline #125838 passed
...@@ -450,16 +450,11 @@ class Univariate(Obs): ...@@ -450,16 +450,11 @@ class Univariate(Obs):
# Load the data table. # Load the data table.
fields = [io.time_field(time_col), (value_col, np.float64)] fields = [io.time_field(time_col), (value_col, np.float64)]
df = io.read_fields(time_scale, filename, fields) df = io.read_fields(time_scale, filename, fields)
# Rename the columns to 'time' and 'value'. # Rename the columns to 'time' and 'value', and ensure that the dtype
rename_to = { # metadata is updated to reflect the renamed columns.
time_col: 'time', fields_out = [io.time_field('time'), ('value', np.float64)]
value_col: 'value', dtype_out = io.fields_dtype(time_scale, fields_out)
} return df.astype(dtype_out)
new_names = tuple(
rename_to.get(name, name) for name in df.dtype.names
)
df.dtype.names = new_names
return df
def row_into_obs(self, row): def row_into_obs(self, row):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment