Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions Manifest.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Wflow/src/Wflow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ using Polyester: @batch
using ProgressLogging: @progress
using PropertyDicts: PropertyDict
using StaticArrays: SVector, pushfirst, setindex
using Statistics: mean, median, quantile!, quantile
using TerminalLoggers
using Statistics: mean, median, quantile!
using TerminalLoggers: TerminalLogger
using TOML: TOML

const CFDataset = Union{NCDataset, NCDatasets.MFDataset}
Expand Down Expand Up @@ -238,10 +238,10 @@ include("standard_name/standard_name_sbm.jl")
include("standard_name/standard_name_sediment.jl")

const STANDARD_NAME_MAPS = (
("sbm", Wflow.sbm_standard_name_map, LandHydrologySBM),
("sediment", Wflow.sediment_standard_name_map, SoilLossModel),
("domain", Wflow.domain_standard_name_map, Domain),
("routing", Wflow.routing_standard_name_map, Routing),
("sbm", sbm_standard_name_map, LandHydrologySBM),
("sediment", sediment_standard_name_map, SoilLossModel),
("domain", domain_standard_name_map, Domain),
("routing", routing_standard_name_map, Routing),
)

include("utils.jl")
Expand Down Expand Up @@ -347,7 +347,7 @@ function run!(model::Model; close_files = true)
# option to support running function twice without re-initializing
# and thus opening the netCDF files
if close_files

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe cleaner to rename the keyword argument close_files?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agree it would be cleaner, but it would break API for minimal gain, so I don't think it is worth it?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah yes, good point, I agree that renaming is then not worth it.

Wflow.close_files(model; delete_output = false)
close_files(model; delete_output = false)
end
Comment thread
visr marked this conversation as resolved.

# Write config to dir_output, to archive what settings were used
Expand Down
2 changes: 1 addition & 1 deletion Wflow/src/config_structure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Base.iterate(input_entries::InputEntries, state) = iterate(input_entries.dict, s
_location_maps::PropertyDictType
end

const input_field_names = String.(fieldnames(Wflow.InputSection))
const input_field_names = String.(fieldnames(InputSection))

###
### Output section
Expand Down
2 changes: 1 addition & 1 deletion Wflow/src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ function out_map(output_names_dict, modelmap)
for (par, output_name) in output_names_dict
vector, metadata = get_field_in_model(modelmap, par)
if isnothing(metadata)
@warn "No metadata was found for $par, so the output will be expressed in standard SI units ($(join(Wflow.STANDARD_UNITS, ", "))) and might fail."
@warn "No metadata was found for $par, so the output will be expressed in standard SI units ($(join(STANDARD_UNITS, ", "))) and might fail."
metadata = ParameterMetadata()
end
output_map[output_name] = OutputData(; par, vector, metadata.unit)
Expand Down
2 changes: 1 addition & 1 deletion Wflow/src/routing/surface/surface_process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function kinematic_wave(q_in, q_prev, q_lat, alpha, dt, dx)
# constant_term = (dt/dx)*q_in + alpha*q_prev³ᐟ⁵) + dt*q_lat
# Use q_prev^(3/5) = (q_prev¹ᐟ⁵)^3
# Let [U] = [m³ s⁻¹]¹ᐟ⁵
u_prev = q_prev >= 0.0 ? Wflow.pow(q_prev, 0.2) : 0.0
u_prev = q_prev >= 0.0 ? pow(q_prev, 0.2) : 0.0

# [m²] = [s m⁻¹] * [m³ s⁻¹] + [s³ᐟ⁵ m¹ᐟ⁵] * [U]³ + [s] * [m² s⁻¹]
constant_term = dt_dx * q_in + alpha * u_prev * u_prev * u_prev + dt * q_lat
Expand Down
2 changes: 1 addition & 1 deletion Wflow/src/standard_name/standard_name_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ get_metadata(name::AbstractString, L::Type) = get_standard_name_map(L)[name]

# When no model or model type is specified, search all standard name maps
get_metadata(name::AbstractString; kwargs...) =
get_metadata(name, map(d -> d[3], Wflow.STANDARD_NAME_MAPS)...; kwargs...)
get_metadata(name, map(d -> d[3], STANDARD_NAME_MAPS)...; kwargs...)

function get_field_in_model(model, name::AbstractString; check_allow_dynamic_input = false)
metadata = get_metadata(name; model)
Expand Down
Loading