Skip to content

Conversation

corentincarton
Copy link
Collaborator

No description provided.

elif cfg.calibration_freq == r'daily':
index = pd.to_datetime(pd.date_range(start, end, freq='24H'), format='%d/%m/%Y %H:%M', errors='raise')
else:
raise Exception('Calibration freq {} not supported'.format(cfg.calibration_freq))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doc78 , I'm wondering if it wouldn't be cleaner to put the if statement for the calibration_freq in the config and then use the value to derive directly the step when constructing the time series:
it would give something like:
index = pd.to_datetime(pd.date_range(start, end, freq='{}H'.format(cfg.freq_hours)), format='%d/%m/%Y %H:%M', errors='raise')

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could even put a value in minutes to be more future proof.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree

simulated_streamflow.index = [(datetime.strptime(start, "%d/%m/%Y %H:%M") + timedelta(hours=24*i)).strftime('%d/%m/%Y %H:%M') for i in range(len(simulated_streamflow.index))]
else:
raise Exception('Calibration freq {} not supported'.format(self.cfg.calibration_freq))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, it would give:
simulated_streamflow.index = [(datetime.strptime(start, "%d/%m/%Y %H:%M") + timedelta(hours=cfg.freq_hours*i)).strftime('%d/%m/%Y %H:%M') for i in range(len(simulated_streamflow.index))]

corentincarton pushed a commit that referenced this pull request Jul 5, 2022
Merge in CEFL/lisflood-calibration from damienWorking to develop

* commit '61b118e42b9c390bae325a7fd7c146f2021c142e':
  modified aux scripts (all but CAL_7)
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

Successfully merging this pull request may close these issues.

2 participants