Skip to content

Commit

Permalink
Setpt loadncdf extrapolates PT rather than stretching to new grid
Browse files Browse the repository at this point in the history
  • Loading branch information
nichollsh committed Jul 23, 2024
1 parent 7c1bd05 commit 9da8ff6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/setpt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ module setpt

# top
arr_T[1] = ds["tmpl"][1]
arr_P[1] = min(ds["pl"][1],atmos.pl[1]) # extend to lower pressures
arr_P[1] = ds["pl"][1]

# middle
idx::Int = 0
Expand All @@ -158,7 +158,16 @@ module setpt

# bottom
arr_T[end] = ds["tmpl"][end]
arr_P[end] = max(ds["pl"][end], atmos.pl[end]) # extend to higher pressures
arr_P[end] = ds["pl"][end]

# extend with constant values to avoid issues with interpolator
newtop = min(atmos.pl[1], arr_P[1])/2.0
pushfirst!(arr_P,newtop)
pushfirst!(arr_T, ds["tmpl"][1])

newbot = max(atmos.pl[end], arr_P[end])*2.0
push!(arr_P, newbot)
push!(arr_T, ds["tmpl"][end])

# properties
atmos.tmp_surf = ds["tmp_surf"][1]
Expand Down

0 comments on commit 9da8ff6

Please sign in to comment.