Skip to content

Commit

Permalink
define BMI.get_time_units on model instance
Browse files Browse the repository at this point in the history
  • Loading branch information
visr authored Mar 2, 2023
1 parent fa260a6 commit 5df03aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [unreleased]

### Fixed
- `BMI.get_time_units` now gets called on the model rather than the type, like all other BMI
functions, except `BMI.initialize`.

### Changed

### Added

## v0.6.3 - 2023-03-01

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/bmi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function BMI.get_end_time(model::Model)
datetime2unix(DateTime(model.config.endtime))
end

function BMI.get_time_units(::Type{<:Model})
function BMI.get_time_units(model::Model)
string("seconds since ", unix2datetime(0))
end

Expand Down
2 changes: 1 addition & 1 deletion test/bmi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tomlpath = joinpath(@__DIR__, "sbm_config.toml")
model = BMI.initialize(Wflow.Model, tomlpath)

@testset "initialization and time functions" begin
@test BMI.get_time_units(Wflow.Model) == "seconds since 1970-01-01T00:00:00"
@test BMI.get_time_units(model) == "seconds since 1970-01-01T00:00:00"
@test BMI.get_time_step(model) == 86400.0
@test BMI.get_start_time(model) == 9.467712e8
@test BMI.get_current_time(model) == 9.467712e8
Expand Down

0 comments on commit 5df03aa

Please sign in to comment.