Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Configurations.jl for configuration #519

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SouthEndMusic
Copy link
Contributor

Issue addressed

Fixes #243.

Additional Notes (optional)

Probably needs to be coordinated with #518.

@SouthEndMusic SouthEndMusic marked this pull request as draft December 11, 2024 10:12
@SouthEndMusic
Copy link
Contributor Author

Example config print:

Wflow Config
        toml    = 
                calendar        = proleptic_gregorian
                starttime       = 2010-07-01T00:00:00
                endtime = 2010-10-01T00:00:00
                time_units      = days since 1900-01-01 00:00:00
                timestepsecs    = 86400.0
                dir_input       = data/input
                dir_output      = data/output
                silent  = false
                loglevel        = info
                path_log        = log.txt
                fews_run        = false
                model   = 
                type    = sbm
                river_routing   = kinematic-wave
                lakes   = false
                masswasting     = true
                snow    = true
                glacier = true
                reinit  = false
                reservoirs      = false
                kin_wave_iteration      = true
                thicknesslayers = [50.0, 100.0, 50.0, 200.0, 800.0]
                min_streamorder_river   = 6
                min_streamorder_land    = 5

                state   = 
                path_input      = instates-piave.nc
                path_output     = outstates-piave.nc
                vertical        =
                satwaterdept    = satwaterdepth
                tsoil   = tsoil
                ustorelayerdepth        = ustorelayerdepth
                snowwater       = snowwater
                canopystorage   = canopystorage
                interception    =
                variables       =
                canopy_storage  = canopystorage


                soil    =
                variables       =
                satwaterdepth   = satwaterdepth
                tsoil   = tsoil
                ustorelayerdepth        = ustorelayerdepth


                glacier =
                variables       =
                glacier_store   = glacierstore


                snow    =
                variables       =
                snow_storage    = snow
                snow_water      = snowwater



                lateral =
                river   =
                variables       =
                q       = q_river
                h       = h_river
                h_av    = h_av_river


                subsurface      =
                variables       =
                ssf     = ssf


                land    =
                variables       =
                q       = q_land
                h       = h_land
                h_av    = h_av_land




                input   =
                path_forcing    = forcing-piave.nc
                path_static     = staticmaps-piave.nc
                gauges  = wflow_gauges
                gauges_grdc     = wflow_gauges_grdc
                ldd     = wflow_ldd
                river_location  = wflow_river
                subcatchment    = wflow_subcatch
                forcing = ["vertical.atmospheric_forcing.precipitation", "vertical.atmospheric_forcing.temperature", "vertical.atmospheric_forcing.potential_evaporation"]
                cyclic  = ["vertical.vegetation_parameter_set.leaf_area_index"]
                vertical        =
                altitude        = wflow_dem
                c       = c
                cf_soil = cf_soil
                cfmax   = Cfmax
                e_r     = EoverR
                infiltcappath   = InfiltCapPath
                infiltcapsoil   = InfiltCapSoil
                kext    = Kext
                kv_0    = KsatVer
                leaf_area_index = LAI
                m       = M
                maxleakage      = MaxLeakage
                pathfrac        = PathFrac
                potential_evaporation   = PET
                precipitation   = P
                rootdistpar     = rootdistpar
                rootingdepth    = RootingDepth
                soilminthickness        = SoilMinThickness
                soilthickness   = SoilThickness
                specific_leaf   = Sl
                storage_wood    = Swood
                temperature     = TEMP
                tt      = TT
                tti     = TTI
                ttm     = TTM
                w_soil  = wflow_soil
                water_holding_capacity  = WHC
                waterfrac       = WaterFrac
                theta_r = thetaR
                theta_s = thetaS
                interception    =
                parameters      =
                e_r     = EoverR


                soil    =
                parameters      =
                alpha_h1        = alpha_h1
                c       = c
                cf_soil = cf_soil
                f       = f
                h1      = h1
                h2      = h2
                h3_high = h3_high
                h3_low  = h3_low
                h4      = h4
                infiltcappath   = InfiltCapPath
                infiltcapsoil   = InfiltCapSoil
                theta_r = thetaR
                theta_s = thetaS
                maxleakage      = MaxLeakage
                pathfrac        = PathFrac
                rootdistpar     = rootdistpar
                soilthickness   = SoilThickness
                kv_0    = KsatVer


                snow    =
                parameters      =
                tt      = TT
                tti     = TTI
                ttm     = TTM
                cfmax   = Cfmax


                glacier =
                parameters      =
                glacier_frac    = wflow_glacierfrac
                g_cfmax = G_Cfmax
                g_ttm   = G_TT
                g_sifrac        = G_SIfrac

                variables       =
                glacier_store   = wflow_glacierstore


                atmospheric_forcing     =
                potential_evaporation   = pet
                precipitation   = precip
                temperature     = temp

                runoff  =
                parameters      =
                waterfrac       = WaterFrac


                vegetation_parameter_set        =
                leaf_area_index = LAI
                kext    = Kext
                storage_specific_leaf   = Sl
                storage_wood    = Swood
                rootingdepth    = RootingDepth
                kc      = crop_factor


                lateral =
                river   =
                length  = wflow_riverlength
                mannings_n      = N_River
                slope   = RiverSlope
                width   = wflow_riverwidth
                bankfull_depth  = RiverDepth

                subsurface      =
                ksathorfrac     = KsatHorFrac

                land    =
                n       = N
                slope   = Slope
                mannings_n      = N



                output  =
                path    = output-piave.nc
                vertical        =
                satwaterdepth   = satwaterdepth
                snow    = snow
                tsoil   = tsoil
                ustorelayerdepth        = ustorelayerdepth
                snowwater       = snowwater
                canopystorage   = canopystorage

                lateral =
                river   =
                variables       =
                q       = q_river
                q_av    = q_river
                h       = h_river
                reservoir       =
                volume  = volume_reservoir



                subsurface      =
                ssf     = ssf

                land    =
                q       = q_land
                h       = h_land



                csv     =
                path    = output-piave.csv
                column  = [Dict("parameter" => "lateral.river.variables.q_av", "header" => "Q", "map" => "gauges"), Dict("parameter" => "lateral.river.variables.q_av", "header" => "Q", "map" => "gauges_grdc")]


        dir     = C:\Users\konin_bt\Repositories\Deltares\Wflow.jl\test

Comment on lines +261 to +273
@option struct Input <: TableOption
path_forcing::String = "."
path_static::String = "."
gauges::String = "wflow_gauges"
gauges_grdc::String = "wflow_gauges_grdc"
ldd::String = "wflow_ldd"
river_location::String = "wflow_river"
subcatchment::String = "wflow_subcatch"
forcing::Vector{String} = String[]
cyclic::Vector{String} = String[]
vertical::InputVertical = InputVertical()
lateral::InputLateral = InputLateral()
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps good to mention here, is that in the input section, we allow users to define their own maps, which can be used to write output (think of different subbasin maps, different types of gauges). So there are a couple of required option (e.g. path_forcing, path_static), it is also a very flexible section).

Same holds for the output sections: this can be any parameter (e.g. lateral.river.q and lateral.river.h, but also vertical.satwaterdepth, etc), so I don't think we would want to explicitly mention all the available options here, because that will become quite messy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. I'm not sure such flexibility is possible within this structure, better ask @evetion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe worth to implement our own structure/methods for this?

Copy link
Member

@evetion evetion Dec 18, 2024

Choose a reason for hiding this comment

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

I guess at least some of the config structure is static and could use Configurations, and for the flexible part you use a dict?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, good point, we could indeed use Configurations for the static part.

Copy link
Member

Choose a reason for hiding this comment

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

Also, what a huge config you guys have. 😁

Copy link
Collaborator

Choose a reason for hiding this comment

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

You pay a certain price for flexibility 😉...

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.

consider using Configurations.jl for Config handling
4 participants