Skip to content

segment_dataframe: return empty if no segments after filtering #4007

Description

@infotroph

Spotted by @divine7022 in #4006 (comment):

we could end up with 1 row segments frame where start_date is set but every other column (end_date, crop_code, site_id, pft) is NA; and that gets returned to write_segment_configs, which then loops over row and tries to build segment configs with NA dates and NA pft. downstream error site is far from the actual problem

Since we already return an empty dataframe if there are zero rows before filtering (row 115 in the version we're discussing today) , it would be consistent to replace this error with a simple return(segments) -- possibly with a warning that no relevant segments were found? Today I lean towards just returning silently (If no segments are relevant to the requested time range, we can simply run the existing unsegmented config and it's not a problem), but am open to counterarguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions