Skip to content

model2netcf.SIPNET: Check logic for out_day #3624

@infotroph

Description

@infotroph

Current code:

out_day <- sum(
      sipnet_output$year == simulation_years[1] &
        sipnet_output$day == unique(sipnet_output$day)[1],
      na.rm = TRUE
    ) # switched to day 2 in case first day is partial

My comment in #3622 (comment) :

Another one for a separate PR: The comment about "day 2" seems out of sync with the code and makes me wonder if there are more edge cases hiding here in cases of (1) incomplete first day as commented; (2) uneven output time steps.

Should it be unique(sipnet_output$day)[2]? Or probably better, should it check all days instead of assuming any one is authoritative?

When thinking through this, also consider whether this needs to support timesteps of 1x/day or less -- I bet not, but might be wise to check for that and error loudly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions