Skip to content

Commit

Permalink
add new 'time_variable' to stitchee function signature for ordering d…
Browse files Browse the repository at this point in the history
…atasets
  • Loading branch information
danielfromearth committed Jul 2, 2024
1 parent f2d3cce commit 9f2fefb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion concatenator/stitchee.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import xarray as xr

import concatenator
from concatenator.attribute_handling import flatten_string_with_groups
from concatenator.dataset_and_group_handling import (
flatten_grouped_dataset,
regroup_flattened_dataset,
Expand All @@ -39,6 +40,7 @@ def stitchee(
concat_method: str | None = "xarray-concat",
concat_dim: str = "",
concat_kwargs: dict | None = None,
time_variable: str = "geolocation/time",
history_to_append: str | None = None,
copy_input_files: bool = False,
overwrite_output_file: bool = False,
Expand Down Expand Up @@ -136,7 +138,10 @@ def stitchee(
decode_coords=False,
drop_variables=coord_vars,
)
first_value = xrds[concatenator.group_delim + concat_dim].values.flatten()[0]

# Determine value for later dataset sorting.
first_value = xrds[flatten_string_with_groups(time_variable)].values.flatten()[0]
# first_value = xrds[concatenator.group_delim + concat_dim].values.flatten()[0]
concat_dim_order.append(first_value)

benchmark_log["flattening"] = time.time() - start_time
Expand Down

0 comments on commit 9f2fefb

Please sign in to comment.