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

Waterflow routing algorithm #131

Merged
merged 20 commits into from
Jul 3, 2024
Merged

Waterflow routing algorithm #131

merged 20 commits into from
Jul 3, 2024

Conversation

boriskaus
Copy link
Member

@boriskaus boriskaus commented Jul 1, 2024

This adds a water flow routing algorithm to a topographic dataset imported with import_topo, and retrieves catchment areas and upstream area. We use the package WhereTheWaterFlows.jl by Mauro Werner for this:

Usage:

julia> using GeophysicalModelGenerator, GMT, GLMakie
julia> Topo = import_topo([6.5,7.3,50.2,50.6], file="@earth_relief_03s");

# Flow the water through the area:
julia> Topo_water, sinks, pits, bnds  = waterflows(Topo)
julia> Topo_water
GeoData 
  size      : (961, 481, 1)
  lon       ϵ [ 6.5 : 7.3]
  lat       ϵ [ 50.2 : 50.59999999999999]
  depth     ϵ [ 0.045 : 0.724]
  fields    : (:Topography, :area, :slen, :dir, :nout, :nin, :c, :cellarea_m2, :catchment_large, :log10_area, :largest_catchment, :largest_area)

julia> log10_area_largest_catchment = log10.(Topo_water.fields.largest_area);
julia> fig, ax, hm = heatmap(Topo_water, log10_area_largest_catchment)
julia> ax.title="Ahr catchment area"
julia> Colorbar(fig[1,2], hm, label="log10(upsteam area)")
julia> fig
Screenshot 2024-07-03 at 12 03 23

@boriskaus boriskaus requested a review from aelligp July 1, 2024 19:23
Copy link
Collaborator

@aelligp aelligp left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for implementing this

src/WaterFlow.jl Outdated Show resolved Hide resolved
src/WaterFlow.jl Outdated Show resolved Hide resolved
src/WaterFlow.jl Outdated Show resolved Hide resolved
src/WaterFlow.jl Show resolved Hide resolved
@boriskaus boriskaus mentioned this pull request Jul 3, 2024
Copy link
Member

@albert-de-montserrat albert-de-montserrat left a comment

Choose a reason for hiding this comment

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

Looks good to me! Just a random dot that could be removed

src/WaterFlow.jl Show resolved Hide resolved
@boriskaus boriskaus merged commit 2878771 into main Jul 3, 2024
23 checks passed
@boriskaus boriskaus deleted the bk-waterflow branch July 3, 2024 19:01
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.

3 participants