From a0fad094e32bfba9d2d2ab161c97f539a24c4838 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Sat, 5 Feb 2022 11:26:20 -0800 Subject: [PATCH] Add src and some profiles --- .github/workflows/CodeCov.yml | 44 +++++++ .github/workflows/CompatHelper.yml | 16 +++ .github/workflows/DocCleanUp.yml | 28 +++++ .github/workflows/TagBot.yml | 67 ++++++++++ .github/workflows/ci.yml | 47 +++++++ .github/workflows/docs.yml | 26 ++++ .gitignore | 5 + Project.toml | 11 ++ README.md | 23 ++++ docs/Project.toml | 10 ++ docs/bibliography.bib | 26 ++++ docs/generate_profile_library.jl | 62 ++++++++++ docs/make.jl | 61 +++++++++ docs/src/References.md | 5 + docs/src/define_save_plots.jl | 53 ++++++++ docs/src/index.md | 41 ++++++ docs/src/plot_profiles.jl | 52 ++++++++ src/AtmosProfileTypes.jl | 0 src/AtmosphericProfilesLibrary.jl | 11 ++ src/profiles/DryBubble.jl | 66 ++++++++++ src/profiles/Rico.jl | 24 ++++ src/profiles/Soares.jl | 21 ++++ src/profiles/TRMM_LBA.jl | 192 +++++++++++++++++++++++++++++ test/Project.toml | 2 + test/runtests.jl | 15 +++ 25 files changed, 908 insertions(+) create mode 100644 .github/workflows/CodeCov.yml create mode 100644 .github/workflows/CompatHelper.yml create mode 100644 .github/workflows/DocCleanUp.yml create mode 100644 .github/workflows/TagBot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/docs.yml create mode 100644 Project.toml create mode 100644 docs/Project.toml create mode 100644 docs/bibliography.bib create mode 100644 docs/generate_profile_library.jl create mode 100644 docs/make.jl create mode 100644 docs/src/References.md create mode 100644 docs/src/define_save_plots.jl create mode 100644 docs/src/index.md create mode 100644 docs/src/plot_profiles.jl create mode 100644 src/AtmosProfileTypes.jl create mode 100644 src/AtmosphericProfilesLibrary.jl create mode 100644 src/profiles/DryBubble.jl create mode 100644 src/profiles/Rico.jl create mode 100644 src/profiles/Soares.jl create mode 100644 src/profiles/TRMM_LBA.jl create mode 100644 test/Project.toml create mode 100644 test/runtests.jl diff --git a/.github/workflows/CodeCov.yml b/.github/workflows/CodeCov.yml new file mode 100644 index 0000000..d8cf6d9 --- /dev/null +++ b/.github/workflows/CodeCov.yml @@ -0,0 +1,44 @@ +name: CodeCov + +on: + push: + branches: + - main + - trying + - staging + tags: '*' + pull_request: + +jobs: + codecov: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2.2.0 + + - name: Set up Julia + uses: julia-actions/setup-julia@latest + with: + version: 1.7.0 + + - name: Test with coverage + env: + JULIA_PROJECT: "@." + run: | + julia --project=@. -e 'using Pkg; Pkg.instantiate()' + julia --project=@. -e 'using Pkg; Pkg.test(coverage=true)' + + - name: Generate coverage file + env: + JULIA_PROJECT: "@." + run: julia --project=@. -e 'using Pkg; Pkg.add("Coverage"); + using Coverage; + LCOV.writefile("coverage-lcov.info", Codecov.process_folder())' + if: success() + + - name: Submit coverage + uses: codecov/codecov-action@v1.0.7 + with: + token: ${{secrets.CODECOV_TOKEN}} + if: success() + diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..bcdb51a --- /dev/null +++ b/.github/workflows/CompatHelper.yml @@ -0,0 +1,16 @@ +name: CompatHelper +on: + schedule: + - cron: '00 00 * * *' + workflow_dispatch: +jobs: + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: Pkg.add("CompatHelper") + run: julia -e 'using Pkg; Pkg.add("CompatHelper")' + - name: CompatHelper.main() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} # optional + run: julia -e 'using CompatHelper; CompatHelper.main()' diff --git a/.github/workflows/DocCleanUp.yml b/.github/workflows/DocCleanUp.yml new file mode 100644 index 0000000..f3d42b6 --- /dev/null +++ b/.github/workflows/DocCleanUp.yml @@ -0,0 +1,28 @@ +name: Doc Preview Cleanup + +on: + pull_request: + types: [closed] + +jobs: + doc-preview-cleanup: + runs-on: ubuntu-latest + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v2 + with: + ref: gh-pages + + - name: Delete preview and history + run: | + git config user.name "Documenter.jl" + git config user.email "documenter@juliadocs.github.io" + git rm -rf "previews/PR$PRNUM" + git commit -m "delete preview" + git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) + env: + PRNUM: ${{ github.event.number }} + + - name: Push changes + run: | + git push --force origin gh-pages-new:gh-pages \ No newline at end of file diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml new file mode 100644 index 0000000..f2bffd0 --- /dev/null +++ b/.github/workflows/TagBot.yml @@ -0,0 +1,67 @@ +name: TagBot +on: + issue_comment: + types: + - created + workflow_dispatch: +jobs: + TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ssh: ${{ secrets.DOCUMENTER_KEY }} + changelog: | + ## {{ package }} {{ version }} + {% if previous_release %} + [Diff since {{ previous_release }}]({{ compare_url }}) + {% endif %} + {% if custom %} + {{ custom }} + {% endif %} + ### 📢 API Changes: + {% if issues %} + {% for issue in issues if 'API' in issue.labels %} + - {{ issue.title }} (#{{ issue.number }}) + {% endfor %} + {% endif %} + {% if pulls %} + {% for pull in pulls if 'API' in pull.labels %} + - {{ pull.title }} (#{{ pull.number }}) (@{{ pull.author.username }}) + {% endfor %} + {% endif %} + ### 🚀 Features + {% if issues %} + {% for issue in issues if 'enhancement' in issue.labels or 'feature' in issue.labels %} + - {{ issue.title }} (#{{ issue.number }}) + {% endfor %} + {% endif %} + {% if pulls %} + {% for pull in pulls if 'enhancement' in pull.labels or 'feature' in pull.labels %} + - {{ pull.title }} (#{{ pull.number }}) (@{{ pull.author.username }}) + {% endfor %} + {% endif %} + ### 📑 Documentation + {% if issues %} + {% for issue in issues if 'documentation' in issue.labels %} + - {{ issue.title }} (#{{ issue.number }}) + {% endfor %} + {% endif %} + {% if pulls %} + {% for pull in pulls if 'documentation' in pull.labels %} + - {{ pull.title }} (#{{ pull.number }}) (@{{ pull.author.username }}) + {% endfor %} + {% endif %} + ### 🐛 Fixes + {% if issues %} + {% for issue in issues if 'bug' in issue.labels or 'bugfix' in issue.labels %} + - {{ issue.title }} (#{{ issue.number }}) + {% endfor %} + {% endif %} + {% if pulls %} + {% for pull in pulls if 'bug' in pull.labels or 'bugfix' in pull.labels %} + - {{ pull.title }} (#{{ pull.number }}) (@{{ pull.author.username }}) + {% endfor %} + {% endif %} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d6d08d1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +name: ci +on: + push: + branches: + - main + - trying + - staging + tags: '*' + pull_request: + +jobs: + test: + name: ci ${{ matrix.version }} - ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - '1.7.0' + os: + - ubuntu-latest + - macOS-latest + - windows-latest + arch: + - x64 + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + # - uses: actions/cache@v1 + # env: + # cache-name: cache-artifacts + # with: + # path: ~/.julia/artifacts + # key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} + # restore-keys: | + # ${{ runner.os }}-test-${{ env.cache-name }}- + # ${{ runner.os }}-test- + # ${{ runner.os }}- + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v1 + with: + file: lcov.info diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..1568517 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,26 @@ +name: Documentation + +on: + push: + branches: + - main + - trying + - staging + tags: '*' + pull_request: + +jobs: + docbuild: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@latest + with: + version: 1.7.0 + - name: Install dependencies + run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' + - name: Build and deploy + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key + run: julia --project=docs/ docs/make.jl \ No newline at end of file diff --git a/.gitignore b/.gitignore index 29126e4..6531f6f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,11 @@ deps/src/ # Build artifacts for creating documentation generated by the Documenter package docs/build/ docs/site/ +# Auto-generated file +docs/src/generated_profile_library.md + +# Data files +*.png # File generated by Pkg, the package manager, based on a corresponding Project.toml # It records a fixed state of all packages used by the project. As such, it should not be diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..e1ccfe3 --- /dev/null +++ b/Project.toml @@ -0,0 +1,11 @@ +name = "AtmosphericProfilesLibrary" +uuid = "86bc3604-9858-485a-bdbe-831ec50de11d" +authors = ["Charles Kawczynski "] +version = "0.1.0" + +[deps] +Dierckx = "39dd38d3-220a-591b-8e3c-4c3a8c710a94" + +[compat] +Dierckx = "0.5" +julia = "1" diff --git a/README.md b/README.md index ba607b2..25ea0a5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ # AtmosphericProfilesLibrary.jl + A library of atmospheric profiles + +||| +|---------------------:|:----------------------------------------------| +| **Docs Build** | [![docs build][docs-bld-img]][docs-bld-url] | +| **Documentation** | [![dev][docs-dev-img]][docs-dev-url] | +| **GHA CI** | [![gha ci][gha-ci-img]][gha-ci-url] | +| **Bors enabled** | [![bors][bors-img]][bors-url] | + +[docs-bld-img]: https://github.com/CliMA/AtmosphericProfilesLibrary.jl/actions/workflows/docs.yml/badge.svg +[docs-bld-url]: https://github.com/CliMA/AtmosphericProfilesLibrary.jl/actions/workflows/docs.yml + +[docs-dev-img]: https://img.shields.io/badge/docs-dev-blue.svg +[docs-dev-url]: https://CliMA.github.io/AtmosphericProfilesLibrary.jl/dev/ + +[gha-ci-img]: https://github.com/CliMA/AtmosphericProfilesLibrary.jl/actions/workflows/ci.yml/badge.svg +[gha-ci-url]: https://github.com/CliMA/AtmosphericProfilesLibrary.jl/actions/workflows/ci.yml + +[bors-img]: https://bors.tech/images/badge_small.svg +[bors-url]: https://app.bors.tech/repositories/41911 + +See our [docs](https://CliMA.github.io/AtmosphericProfilesLibrary.jl/dev/) for usage and how to contribute. + diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..3c2fcdf --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,10 @@ +[deps] +AtmosphericProfilesLibrary = "86bc3604-9858-485a-bdbe-831ec50de11d" +Dierckx = "39dd38d3-220a-591b-8e3c-4c3a8c710a94" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244" +Glob = "c27321d9-0574-5035-807b-f59d2c89b15c" +Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" + +[compat] +Dierckx = "0.5" diff --git a/docs/bibliography.bib b/docs/bibliography.bib new file mode 100644 index 0000000..caa5054 --- /dev/null +++ b/docs/bibliography.bib @@ -0,0 +1,26 @@ +# The citation keys have been formatted as: +# Last author name (titlecase), followed by +# (no characters in-between) the year. + +@article{Grabowski2006, + title = {Daytime convective development over land: A model intercomparison based on LBA observations}, + author = {Grabowski, WW and Bechtold, P and Cheng, A and Forbes, R and Halliwell, C and Khairoutdinov, M and Lang, S and Nasuno, T and Petch, J and Tao, W-K and others}, + journal = {Quarterly Journal of the Royal Meteorological Society: A journal of the atmospheric sciences, applied meteorology and physical oceanography}, + volume = {132}, + number = {615}, + pages = {317--344}, + year = {2006}, + publisher = {Wiley Online Library} +} + +@article{Soares2004, + title = {An eddy-diffusivity/mass-flux parametrization for dry and shallow cumulus convection}, + author = {Soares, PMM and Miranda, PMA and Siebesma, AP and Teixeira, J}, + journal = {Quarterly Journal of the Royal Meteorological Society: A journal of the atmospheric sciences, applied meteorology and physical oceanography}, + volume = {130}, + number = {604}, + pages = {3365--3383}, + year = {2004}, + publisher = {Wiley Online Library}, + doi = {https://doi.org/10.1256/qj.03.223} +} diff --git a/docs/generate_profile_library.jl b/docs/generate_profile_library.jl new file mode 100644 index 0000000..65b132d --- /dev/null +++ b/docs/generate_profile_library.jl @@ -0,0 +1,62 @@ + +# Generate figures: +include(joinpath(@__DIR__, "src", "plot_profiles.jl")) + +prof_lib = joinpath(@__DIR__, "src", "generated_profile_library.md") +open(prof_lib, "w") do io + + println(io, "```@meta") + println(io, "# ****************************************************") + println(io, "# ****************************************************") + println(io, "# THIS FILE IS AUTO-GENERATED, PLEASE DO NOT EDIT.") + println(io, "# ****************************************************") + println(io, "# ****************************************************") + println(io, "```") + + println(io, "# Profile library") + + println(io, "") + println(io, "```@meta") + println(io, "CurrentModule = AtmosphericProfilesLibrary") + println(io, "```") + + println(io, "") + println(io, "```@example") + println(io, "include(joinpath(@__DIR__, \"plot_profiles.jl\"))") + println(io, "```") + println(io, "") + + println(io, "## z-profiles") + for profile in z_profiles + fname = nameof(profile.func) + println(io, "```@docs") + println(io, "$fname") + println(io, "```") + println(io, "![](z_$fname.png)") + println(io, "") + end + + if !isempty(t_profiles) + println(io, "## t-profiles") + for profile in t_profiles + fname = nameof(profile.func) + println(io, "```@docs") + println(io, "$fname") + println(io, "```") + println(io, "![](t_$fname.png)") + println(io, "") + end + end + + println(io, "## tz-profiles") + for profile in tz_profiles + fname = nameof(profile.func) + println(io, "```@docs") + println(io, "$fname") + println(io, "```") + println(io, "![](tz_$fname.png)") + println(io, "") + end +end + +@assert isfile(prof_lib) diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..55e0e19 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,61 @@ +using AtmosphericProfilesLibrary, Documenter +using DocumenterCitations +import Glob + +# https://github.com/jheinen/GR.jl/issues/278#issuecomment-587090846 +ENV["GKSwstype"] = "nul" + +bib = CitationBibliography(joinpath(@__DIR__, "bibliography.bib")) + +include("generate_profile_library.jl") + +#! format: off +pages = Any[ + "Home" => "index.md", + "Profile library" => "generated_profile_library.md", + "References" => "References.md", +] + +mathengine = MathJax(Dict( + :TeX => Dict( + :equationNumbers => Dict(:autoNumber => "AMS"), + :Macros => Dict(), + ), +)) + +format = Documenter.HTML( + prettyurls = get(ENV, "CI", nothing) == "true", + mathengine = mathengine, + collapselevel = 1, +) +#! format: on + +makedocs( + bib, + sitename = "AtmosphericProfilesLibrary.jl", + strict = true, + format = format, + checkdocs = :exports, + clean = true, + doctest = true, + modules = [AtmosphericProfilesLibrary], + pages = pages, +) + +deploydocs( + repo = "github.com/CliMA/AtmosphericProfilesLibrary.jl.git", + target = "build", + push_preview = true, + devbranch = "main", + forcepush = true, +) + +# Remove temp files (e.g., .DS_Store) +for (root, _, files) in Base.Filesystem.walkdir(pkgdir(AtmosphericProfilesLibrary)) + for f in files + file = joinpath(root, f) + if endswith(file, ".DS_Store") + rm(file; force = true) + end + end +end diff --git a/docs/src/References.md b/docs/src/References.md new file mode 100644 index 0000000..b88be23 --- /dev/null +++ b/docs/src/References.md @@ -0,0 +1,5 @@ +# References + +```@bibliography +``` + diff --git a/docs/src/define_save_plots.jl b/docs/src/define_save_plots.jl new file mode 100644 index 0000000..8a51ae6 --- /dev/null +++ b/docs/src/define_save_plots.jl @@ -0,0 +1,53 @@ +import Plots +import Dierckx + +# https://github.com/jheinen/GR.jl/issues/278#issuecomment-587090846 +ENV["GKSwstype"] = "nul" + +scale_time_to_days(t) = t / 86400 +scale_time_to_hours(t) = t / 3600 +scale_z_to_kilometers(t) = t / 10^3 +scale_z_to_meters(t) = t +xlabel(::typeof(scale_time_to_hours)) = "Time [hr]" +xlabel(::typeof(scale_time_to_days)) = "Time [days]" +ylabel(::typeof(scale_z_to_kilometers)) = "Altitude (z) [km]" +ylabel(::typeof(scale_z_to_meters)) = "Altitude (z) [m]" + +function save_tz_profile( + profile; + scale_time = scale_time_to_hours, + scale_z = scale_z_to_kilometers, + units = "", + t_range, + z_range, + ) + prof = profile(Float64) + + # We could alternatively use this + # as it's nicely documenting how + # to use the profiles, but we want + # to scale the altitude + # Plots.contourf(t_range, z_range, (t, z) -> prof(t, z)) + data = prof.(t_range', z_range) + Plots.contourf(scale_time.(t_range), scale_z.(z_range), data; c = :viridis) + Plots.xlabel!(xlabel(scale_time)) + Plots.ylabel!(ylabel(scale_z)) + Plots.title!("$(nameof(profile)) $units") + Plots.savefig("tz_$(nameof(profile)).png") +end + +function save_z_profile( + profile; + xlabel = "", + scale_z = scale_z_to_kilometers, + z_range, + ) + prof = profile(Float64) + # data = (z) -> prof(z) + data = prof.(z_range) + Plots.plot(data, scale_z.(z_range)) + Plots.xlabel!(xlabel) + Plots.ylabel!(ylabel(scale_z)) + Plots.title!("$(nameof(profile))") + Plots.savefig("z_$(nameof(profile)).png") +end diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..f4e029f --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,41 @@ +# AtmosphericProfilesLibrary.jl + +AtmosphericProfilesLibrary.jl is a library of atmospheric profiles with respect to altitude (`z`) and time (`t`), using SI units. + +## Scope of repository + +This repository is meant to serve as a library of static functions in efforts to reduce code duplication and boiler plate. Added profiles should satisfy the following criteria to limit the scope of this library: + + - A single type argument (the float type `FT`) + - For example, `my_new_profile(::Type{FT}) where {FT}` + - No additional arguments + - The return type of the profile should be a type-stable `Function` or callable object. + - For example: + - `prof = z->2*z` callable by `prof(z)` + - `prof = t->2*t` callable by `prof(t)` + - `prof = (t,z) -> z*t` callable by `prof(t, z)` + - `prof = Dierckx.Spline1D(FT[0, 1, 2], FT[0, 2, 4]; k = 1)` callable by `prof(z)` + +## How to contribute + +Contributing to this repo involves 3 parts: + + - Add a reference to `docs/bibliography.bib` + - Add a function, with signature `my_new_profile(::Type{FT}) where {FT}`, to `src/` with a doc string containing the reference + - For example `""" [Grabowski2006](@cite) """`. + - Add the new function to one of the `Vector`s in `docs/plot_profiles.jl`: + - `z_profiles` + - `t_profiles` + - `tz_profiles` + with appriate keyword arguments (e.g., labels and units). + +Your plots should automatically appear in the documentation after finishing these three steps. + +!!! warn + + Plots show units of kilometers and hours for + convenience, but data returned from profiles + should be in SI units (meters and seconds). + For example: + `prof = z->2*z` + should be callable by `prof(z #= z is in meters=#)`. diff --git a/docs/src/plot_profiles.jl b/docs/src/plot_profiles.jl new file mode 100644 index 0000000..06e7d2d --- /dev/null +++ b/docs/src/plot_profiles.jl @@ -0,0 +1,52 @@ +import AtmosphericProfilesLibrary +const APL = AtmosphericProfilesLibrary + +include("define_save_plots.jl") + +const z_range = range(0, stop = 2.5e4, length = 100); +const t_range = range(0, stop = 4e4, length = 100); + +##### +##### z-t profiles +##### +tz_profiles = [ + (; func = APL.TRMM_LBA_radiation, kwargs = (; z_range, t_range)), +] + +##### +##### z profiles +##### +z_profiles = [ + (; func = APL.Soares_q_tot , kwargs = (;z_range, xlabel = "q_tot [1]")), + (; func = APL.Soares_θ_liq_ice , kwargs = (;z_range, xlabel = "θ_liq_ice [K]")), + (; func = APL.Soares_u , kwargs = (;z_range, xlabel = "u [m/s]")), + (; func = APL.Soares_tke , kwargs = (;z_range, xlabel = "tke [m^2/s^2]")), + (; func = APL.TRMM_LBA_p_in , kwargs = (;z_range, xlabel = "p [kPa]")), + (; func = APL.TRMM_LBA_T_in , kwargs = (;z_range, xlabel = "T [K]")), + (; func = APL.TRMM_LBA_RH_in , kwargs = (;z_range, xlabel = "RH [%]")), + (; func = APL.TRMM_LBA_u_in , kwargs = (;z_range, xlabel = "u [m/s]")), + (; func = APL.TRMM_LBA_v_in , kwargs = (;z_range, xlabel = "v [m/s]")), + (; func = APL.Rico_geostrophic_ug , kwargs = (;z_range, xlabel = "u [m/s]")), + (; func = APL.Rico_geostrophic_vg , kwargs = (;z_range, xlabel = "v [m/s]")), + (; func = APL.Rico_dqtdt , kwargs = (;z_range, xlabel = "dqdt [?/s]")), + (; func = APL.Rico_subsidence , kwargs = (;z_range, xlabel = "v [?/s]")), + (; func = APL.DryBubble_θ , kwargs = (;z_range, xlabel = "θ_liq_ice [K]")), +] + +##### +##### t profiles +##### +t_profiles = [] + +for profile in t_profiles + # We don't have t-profiles yet. + # save_t_profile(profile.func; profile.kwargs...) +end +for profile in tz_profiles + save_tz_profile(profile.func; profile.kwargs...) +end +for profile in z_profiles + save_z_profile(profile.func; profile.kwargs...) +end + +nothing \ No newline at end of file diff --git a/src/AtmosProfileTypes.jl b/src/AtmosProfileTypes.jl new file mode 100644 index 0000000..e69de29 diff --git a/src/AtmosphericProfilesLibrary.jl b/src/AtmosphericProfilesLibrary.jl new file mode 100644 index 0000000..43bca60 --- /dev/null +++ b/src/AtmosphericProfilesLibrary.jl @@ -0,0 +1,11 @@ +module AtmosphericProfilesLibrary + +import Dierckx + +# Large data-based profiles +include("profiles/Soares.jl") +include("profiles/TRMM_LBA.jl") +include("profiles/Rico.jl") +include("profiles/DryBubble.jl") + +end # module diff --git a/src/profiles/DryBubble.jl b/src/profiles/DryBubble.jl new file mode 100644 index 0000000..e8a535d --- /dev/null +++ b/src/profiles/DryBubble.jl @@ -0,0 +1,66 @@ +""" :( """ +function DryBubble_θ(::Type{FT}) where {FT} + z_in = FT[ + 25., 75., 125., 175., 225., 275., 325., 375., 425., + 475., 525., 575., 625., 675., 725., 775., 825., 875., + 925., 975., 1025., 1075., 1125., 1175., 1225., 1275., 1325., + 1375., 1425., 1475., 1525., 1575., 1625., 1675., 1725., 1775., + 1825., 1875., 1925., 1975., 2025., 2075., 2125., 2175., 2225., + 2275., 2325., 2375., 2425., 2475., 2525., 2575., 2625., 2675., + 2725., 2775., 2825., 2875., 2925., 2975., 3025., 3075., 3125., + 3175., 3225., 3275., 3325., 3375., 3425., 3475., 3525., 3575., + 3625., 3675., 3725., 3775., 3825., 3875., 3925., 3975., 4025., + 4075., 4125., 4175., 4225., 4275., 4325., 4375., 4425., 4475., + 4525., 4575., 4625., 4675., 4725., 4775., 4825., 4875., 4925., + 4975., 5025., 5075., 5125., 5175., 5225., 5275., 5325., 5375., + 5425., 5475., 5525., 5575., 5625., 5675., 5725., 5775., 5825., + 5875., 5925., 5975., 6025., 6075., 6125., 6175., 6225., 6275., + 6325., 6375., 6425., 6475., 6525., 6575., 6625., 6675., 6725., + 6775., 6825., 6875., 6925., 6975., 7025., 7075., 7125., 7175., + 7225., 7275., 7325., 7375., 7425., 7475., 7525., 7575., 7625., + 7675., 7725., 7775., 7825., 7875., 7925., 7975., 8025., 8075., + 8125., 8175., 8225., 8275., 8325., 8375., 8425., 8475., 8525., + 8575., 8625., 8675., 8725., 8775., 8825., 8875., 8925., 8975., + 9025., 9075., 9125., 9175., 9225., 9275., 9325., 9375., 9425., + 9475., 9525., 9575., 9625., 9675., 9725., 9775., 9825., 9875., + 9925., 9975. + ] + θ_liq_ice_in = FT[ + 299.9834, 299.9836, 299.9841, 299.985 , 299.9864, 299.9883, + 299.9907, 299.9936, 299.9972, 300.0012, 300.0058, 300.011 , + 300.0166, 300.0228, 300.0293, 300.0363, 300.0436, 300.0512, + 300.0591, 300.0672, 300.0755, 300.0838, 300.0921, 300.1004, + 300.1086, 300.1167, 300.1245, 300.132 , 300.1393, 300.1461, + 300.1525, 300.1583, 300.1637, 300.1685, 300.1726, 300.1762, + 300.179 , 300.1812, 300.1826, 300.1833, 300.1833, 300.1826, + 300.1812, 300.179 , 300.1762, 300.1727, 300.1685, 300.1637, + 300.1584, 300.1525, 300.1461, 300.1393, 300.1321, 300.1245, + 300.1167, 300.1087, 300.1005, 300.0922, 300.0838, 300.0755, + 300.0673, 300.0592, 300.0513, 300.0437, 300.0364, 300.0294, + 300.0228, 300.0167, 300.0111, 300.0059, 300.0013, 299.9972, + 299.9937, 299.9908, 299.9884, 299.9865, 299.9851, 299.9842, + 299.9837, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835, + 299.9835, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835, + 299.9835, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835, + 299.9835, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835, + 299.9835, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835, + 299.9835, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835, + 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, + 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, + 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, + 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, + 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, + 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, + 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, + 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, + 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, + 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836, + 299.9836, 299.9836, 299.9836, 299.9836, 299.9837, 299.9837, + 299.9837, 299.9837, 299.9837, 299.9837, 299.9837, 299.9837, + 299.9837, 299.9837, 299.9837, 299.9837, 299.9837, 299.9837, + 299.9837, 299.9837, 299.9837, 299.9837, 299.9837, 299.9837, + 299.9837, 299.9837 + ] + profile = Dierckx.Spline1D(z_in, θ_liq_ice_in; k = 1) + return profile +end diff --git a/src/profiles/Rico.jl b/src/profiles/Rico.jl new file mode 100644 index 0000000..d8dd29e --- /dev/null +++ b/src/profiles/Rico.jl @@ -0,0 +1,24 @@ +""" :( """ +function Rico_geostrophic_ug(::Type{FT}) where {FT} + return z -> FT(-9.9) + FT(2.0e-3) * z +end +""" :( """ +function Rico_geostrophic_vg(::Type{FT}) where {FT} + return z -> FT(-3.8) +end +""" :( """ +function Rico_dqtdt(::Type{FT}) where {FT} + return z -> if z <= 2980.0 + (-1 + FT(1.3456) / FT(2980.0) * z) / FT(86400.0) / 1000 #kg/(kg * s) + else + FT(0.3456) / 86400 / 1000 + end +end +""" :( """ +function Rico_subsidence(::Type{FT}) where {FT} + return z -> if z <= 2260.0 + -(FT(0.005) / FT(2260.0)) * z + else + FT(-0.005) + end +end diff --git a/src/profiles/Soares.jl b/src/profiles/Soares.jl new file mode 100644 index 0000000..3e23c62 --- /dev/null +++ b/src/profiles/Soares.jl @@ -0,0 +1,21 @@ +""" [Soares2004](@cite) """ +Soares_q_tot(::Type{FT}) where {FT} = z -> if z <= 1350.0 + FT(5.0e-3) - FT(3.7e-4) * z / 1000 + else + FT(5.0e-3) - FT(3.7e-4) * FT(1.35) - FT(9.4e-4) * (z - 1350) / 1000 + end +""" [Soares2004](@cite) """ +Soares_θ_liq_ice(::Type{FT}) where {FT} = z -> if z <= 1350.0 + FT(300.0) + else + FT(300) + 2 * (z - 1350) / 1000 + end +""" [Soares2004](@cite) """ +Soares_u(::Type{FT}) where {FT} = z -> FT(0.01) + +""" [Soares2004](@cite) """ +Soares_tke(::Type{FT}) where {FT} = z -> if z <= 1600.0 + FT(0.1) * FT(1.46) * FT(1.46) * (1 - z / 1600) + else + FT(0) + end diff --git a/src/profiles/TRMM_LBA.jl b/src/profiles/TRMM_LBA.jl new file mode 100644 index 0000000..6c134ae --- /dev/null +++ b/src/profiles/TRMM_LBA.jl @@ -0,0 +1,192 @@ +""" [Grabowski2006](@cite) """ +function TRMM_LBA_z_in(::Type{FT}) where {FT} + z_in = FT[0.130, 0.464, 0.573, 1.100, 1.653, 2.216, 2.760, + 3.297, 3.824, 4.327, 4.787, 5.242, 5.686, 6.131, + 6.578, 6.996, 7.431, 7.881, 8.300, 8.718, 9.149, + 9.611, 10.084, 10.573, 11.008, 11.460, 11.966, 12.472, + 12.971, 13.478, 13.971, 14.443, 14.956, 15.458, 16.019, + 16.491, 16.961, 17.442, 17.934, 18.397, 18.851, 19.331, + 19.809, 20.321, 20.813, 21.329, 30.000] .* 1000 .- 130 #LES z is in meters + return z_in +end +""" [Grabowski2006](@cite) """ +function TRMM_LBA_p_in(::Type{FT}) where {FT} + z_in = TRMM_LBA_z_in(FT) + p_in = FT[991.3, 954.2, 942.0, 886.9, 831.5, 778.9, 729.8, + 684.0, 641.7, 603.2, 570.1, 538.6, 509.1, 480.4, + 454.0, 429.6, 405.7, 382.5, 361.1, 340.9, 321.2, + 301.2, 281.8, 263.1, 246.1, 230.1, 213.2, 197.0, + 182.3, 167.9, 154.9, 143.0, 131.1, 119.7, 108.9, + 100.1, 92.1, 84.6, 77.5, 71.4, 65.9, 60.7, + 55.9, 51.3, 47.2, 43.3, 10.3] .* 100 # LES pres is in pasc + return Dierckx.Spline1D(z_in, p_in; k = 1) +end +""" [Grabowski2006](@cite) """ +function TRMM_LBA_T_in(::Type{FT}) where {FT} + z_in = TRMM_LBA_z_in(FT) + T_in = FT[23.70, 23.30, 22.57, 19.90, 16.91, 14.09, 11.13, + 8.29, 5.38, 2.29, -0.66, -3.02, -5.28, -7.42, + -10.34, -12.69, -15.70, -19.21, -21.81, -24.73, -27.76, + -30.93, -34.62, -38.58, -42.30, -46.07, -50.03, -54.67, + -59.16, -63.60, -67.68, -70.77, -74.41, -77.51, -80.64, + -80.69, -80.00, -81.38, -81.17, -78.32, -74.77, -74.52, + -72.62, -70.87, -69.19, -66.90, -66.90] .+ FT(273.15) # LES T is in deg K + return Dierckx.Spline1D(z_in, T_in; k = 1) +end +""" [Grabowski2006](@cite) """ +function TRMM_LBA_RH_in(::Type{FT}) where {FT} + z_in = TRMM_LBA_z_in(FT) + RH_in = FT[98.00, 86.00, 88.56, 87.44, 86.67, 83.67, 79.56, + 84.78, 84.78, 89.33, 94.33, 92.00, 85.22, 77.33, + 80.11, 66.11, 72.11, 72.67, 52.22, 54.67, 51.00, + 43.78, 40.56, 43.11, 54.78, 46.11, 42.33, 43.22, + 45.33, 39.78, 33.78, 28.78, 24.67, 20.67, 17.67, + 17.11, 16.22, 14.22, 13.00, 13.00, 12.22, 9.56, + 7.78, 5.89, 4.33, 3.00, 3.00] + return Dierckx.Spline1D(z_in, RH_in; k = 1) +end +""" [Grabowski2006](@cite) """ +function TRMM_LBA_u_in(::Type{FT}) where {FT} + z_in = TRMM_LBA_z_in(FT) + u_in = FT[0.00, 0.81, 1.17, 3.44, 3.53, 3.88, 4.09, + 3.97, 1.22, 0.16, -1.22, -1.72, -2.77, -2.65, + -0.64, -0.07, -1.90, -2.70, -2.99, -3.66, -5.05, + -6.64, -4.74, -5.30, -6.07, -4.26, -7.52, -8.88, + -9.00, -7.77, -5.37, -3.88, -1.15, -2.36, -9.20, + -8.01, -5.68, -8.83, -14.51, -15.55, -15.36, -17.67, + -17.82, -18.94, -15.92, -15.32, -15.32] + return Dierckx.Spline1D(z_in, u_in; k = 1) +end +""" [Grabowski2006](@cite) """ +function TRMM_LBA_v_in(::Type{FT}) where {FT} + z_in = TRMM_LBA_z_in(FT) + v_in = FT[-0.40, -3.51, -3.88, -4.77, -5.28, -5.85, -5.60, + -2.67, -1.47, 0.57, 0.89, -0.08, 1.11, 2.15, + 3.12, 3.22, 3.34, 1.91, 1.15, 1.01, -0.57, + -0.67, 0.31, 2.97, 2.32, 2.66, 4.79, 3.40, + 3.14, 3.93, 7.57, 2.58, 2.50, 6.44, 6.84, + 0.19, -2.20, -3.60, 0.56, 6.68, 9.41, 7.03, + 5.32, 1.14, -0.65, 5.27, 5.27] + return Dierckx.Spline1D(z_in, v_in; k = 1) +end + +""" [Grabowski2006](@cite) """ +function TRMM_LBA_radiation(::Type{FT}) where {FT} + rad_time = range(FT(10), FT(360); length = 36) .* 60 + z_in = FT[42.5, 200.92, 456.28, 743, 1061.08, 1410.52, 1791.32, 2203.48, 2647,3121.88, 3628.12, + 4165.72, 4734.68, 5335, 5966.68, 6629.72, 7324.12, + 8049.88, 8807, 9595.48, 10415.32, 11266.52, 12149.08, 13063, 14008.28, + 14984.92, 15992.92, 17032.28, 18103, 19205.08, 20338.52, 21503.32, 22699.48] + rad_in = [[-1.386, -1.927, -2.089, -1.969, -1.805, -1.585, -1.406, -1.317, -1.188, -1.106, -1.103, -1.025, + -0.955, -1.045, -1.144, -1.119, -1.068, -1.092, -1.196, -1.253, -1.266, -1.306, -0.95, 0.122, + 0.255, 0.258, 0.322, 0.135, 0, 0, 0, 0, 0], + [ -1.23, -1.824, -2.011, -1.895, -1.729, -1.508, -1.331, -1.241, -1.109, -1.024, -1.018, -0.94, + -0.867, -0.953, -1.046, -1.018, -0.972, -1.006, -1.119, -1.187, -1.209, -1.259, -0.919, 0.122, + 0.264, 0.262, 0.326, 0.137, 0, 0, 0, 0, 0], + [-1.043, -1.692, -1.906, -1.796, -1.63, -1.41, -1.233, -1.142, -1.01, -0.92, -0.911, -0.829, + -0.754, -0.837, -0.923, -0.89, -0.847, -0.895, -1.021, -1.101, -1.138, -1.201, -0.88, 0.131, + 0.286, 0.259, 0.332, 0.14, 0, 0, 0, 0, 0], + [-0.944, -1.613, -1.832, -1.72, -1.555, -1.339, -1.163, -1.068, -0.935, -0.846, -0.835, -0.75, + -0.673, -0.751, -0.833, -0.798, -0.76, -0.817, -0.952, -1.042, -1.088, -1.159, -0.853, 0.138, + 0.291, 0.265, 0.348, 0.136, 0, 0, 0, 0, 0], + [-0.833, -1.526, -1.757, -1.648, -1.485, -1.27, -1.093, -0.998, -0.867, -0.778, -0.761, -0.672, + -0.594, -0.671, -0.748, -0.709, -0.676, -0.742, -0.887, -0.986, -1.041, -1.119, -0.825, 0.143, + 0.296, 0.271, 0.351, 0.138, 0, 0, 0, 0, 0], + [-0.719, -1.425, -1.657, -1.55, -1.392, -1.179, -1.003, -0.909, -0.778, -0.688, -0.667, -0.573, + -0.492, -0.566, -0.639, -0.596, -0.568, -0.647, -0.804, -0.914, -0.981, -1.07, -0.793, 0.151, + 0.303, 0.279, 0.355, 0.141, 0, 0, 0, 0, 0], + [-0.724, -1.374, -1.585, -1.482, -1.328, -1.116, -0.936, -0.842, -0.715, -0.624, -0.598, -0.503, + -0.421, -0.494, -0.561, -0.514, -0.49, -0.58, -0.745, -0.863, -0.938, -1.035, -0.764, 0.171, + 0.291, 0.284, 0.358, 0.144, 0, 0, 0, 0, 0], + [-0.587, -1.28, -1.513, -1.416, -1.264, -1.052, -0.874, -0.781, -0.655, -0.561, -0.532, -0.436, + -0.354, -0.424, -0.485, -0.435, -0.417, -0.517, -0.691, -0.817, -0.898, -1, -0.74, 0.176, + 0.297, 0.289, 0.36, 0.146, 0, 0, 0, 0, 0], + [-0.506, -1.194, -1.426, -1.332, -1.182, -0.972, -0.795, -0.704, -0.578, -0.48, -0.445, -0.347, + -0.267, -0.336, -0.391, -0.337, -0.325, -0.436, -0.62, -0.756, -0.847, -0.96, -0.714, 0.18, + 0.305, 0.317, 0.348, 0.158, 0, 0, 0, 0, 0], + [-0.472, -1.14, -1.364, -1.271, -1.123, -0.914, -0.738, -0.649, -0.522, -0.422, -0.386, -0.287, + -0.207, -0.273, -0.322, -0.267, -0.26, -0.379, -0.569, -0.712, -0.811, -0.931, -0.696, 0.183, + 0.311, 0.32, 0.351, 0.16, 0, 0, 0, 0, 0], + [-0.448, -1.091, -1.305, -1.214, -1.068, -0.858, -0.682, -0.594, -0.469, -0.368, -0.329, -0.229, + -0.149, -0.213, -0.257, -0.2, -0.199, -0.327, -0.523, -0.668, -0.774, -0.903, -0.678, 0.186, + 0.315, 0.323, 0.355, 0.162, 0, 0, 0, 0, 0], + [-0.405, -1.025, -1.228, -1.139, -0.996, -0.789, -0.615, -0.527, -0.402, -0.3, -0.256, -0.156, + -0.077, -0.136, -0.173, -0.115, -0.121, -0.259, -0.463, -0.617, -0.732, -0.869, -0.656, 0.19, + 0.322, 0.326, 0.359, 0.164, 0, 0, 0, 0, 0], + [-0.391, -0.983, -1.174, -1.085, -0.945, -0.739, -0.566, -0.478, -0.354, -0.251, -0.205, -0.105, + -0.027, -0.082, -0.114, -0.056, -0.069, -0.213, -0.42, -0.579, -0.699, -0.84, -0.642, 0.173, + 0.327, 0.329, 0.362, 0.165, 0, 0, 0, 0, 0], + [-0.385, -0.946, -1.121, -1.032, -0.898, -0.695, -0.523, -0.434, -0.307, -0.203, -0.157, -0.057, + 0.021, -0.031, -0.059, -0.001, -0.018, -0.168, -0.381, -0.546, -0.672, -0.819, -0.629, 0.176, + 0.332, 0.332, 0.364, 0.166, 0, 0, 0, 0, 0], + [-0.383, -0.904, -1.063, -0.972, -0.834, -0.632, -0.464, -0.378, -0.251, -0.144, -0.096, 0.001, + 0.079, 0.032, 0.011, 0.069, 0.044, -0.113, -0.332, -0.504, -0.637, -0.791, -0.611, 0.181, + 0.338, 0.335, 0.367, 0.167, 0, 0, 0, 0, 0], + [-0.391, -0.873, -1.016, -0.929, -0.794, -0.591, -0.423, -0.337, -0.212, -0.104, -0.056, 0.043, + 0.121, 0.077, 0.058, 0.117, 0.088, -0.075, -0.298, -0.475, -0.613, -0.772, -0.599, 0.183, + 0.342, 0.337, 0.37, 0.168, 0, 0, 0, 0, 0], + [-0.359, -0.836, -0.976, -0.888, -0.755, -0.554, -0.386, -0.3, -0.175, -0.067, -0.018, 0.081, + 0.16, 0.119, 0.103, 0.161, 0.129, -0.039, -0.266, -0.448, -0.591, -0.755, -0.587, 0.187, + 0.345, 0.339, 0.372, 0.169, 0, 0, 0, 0, 0], + [-0.328, -0.792, -0.928, -0.842, -0.709, -0.508, -0.341, -0.256, -0.131, -0.022, 0.029, 0.128, + 0.208, 0.17, 0.158, 0.216, 0.179, 0.005, -0.228, -0.415, -0.564, -0.733, -0.573, 0.19, + 0.384, 0.313, 0.375, 0.17, 0, 0, 0, 0, 0], + [-0.324, -0.767, -0.893, -0.807, -0.676, -0.476, -0.31, -0.225, -0.101, 0.008, 0.06, 0.159, + 0.239, 0.204, 0.195, 0.252, 0.212, 0.034, -0.203, -0.394, -0.546, -0.719, -0.564, 0.192, + 0.386, 0.315, 0.377, 0.171, 0, 0, 0, 0, 0], + [ -0.31, -0.74, -0.86, -0.775, -0.647, -0.449, -0.283, -0.197, -0.073, 0.036, 0.089, 0.188, + 0.269, 0.235, 0.229, 0.285, 0.242, 0.061, -0.179, -0.374, -0.53, -0.706, -0.556, 0.194, + 0.388, 0.317, 0.402, 0.158, 0, 0, 0, 0, 0], + [-0.244, -0.694, -0.818, -0.73, -0.605, -0.415, -0.252, -0.163, -0.037, 0.072, 0.122, 0.22, + 0.303, 0.273, 0.269, 0.324, 0.277, 0.093, -0.152, -0.35, -0.51, -0.691, -0.546, 0.196, + 0.39, 0.32, 0.403, 0.159, 0, 0, 0, 0, 0], + [-0.284, -0.701, -0.803, -0.701, -0.568, -0.381, -0.225, -0.142, -0.017, 0.092, 0.143, 0.242, + 0.325, 0.298, 0.295, 0.35, 0.3, 0.112, -0.134, -0.334, -0.497, -0.68, -0.54, 0.198, + 0.392, 0.321, 0.404, 0.16, 0, 0, 0, 0, 0], + [-0.281, -0.686, -0.783, -0.68, -0.547, -0.359, -0.202, -0.119, 0.005, 0.112, 0.163, 0.261, + 0.345, 0.321, 0.319, 0.371, 0.319, 0.13, -0.118, -0.321, -0.486, -0.671, -0.534, 0.199, + 0.393, 0.323, 0.405, 0.161, 0, 0, 0, 0, 0], + [-0.269, -0.667, -0.76, -0.655, -0.522, -0.336, -0.181, -0.096, 0.029, 0.136, 0.188, 0.286, + 0.37, 0.346, 0.345, 0.396, 0.342, 0.15, -0.102, -0.307, -0.473, -0.661, -0.528, 0.2, + 0.393, 0.324, 0.405, 0.162, 0, 0, 0, 0, 0], + [-0.255, -0.653, -0.747, -0.643, -0.511, -0.325, -0.169, -0.082, 0.042, 0.149, 0.204, 0.304, + 0.388, 0.363, 0.36 , 0.409, 0.354, 0.164, -0.085, -0.289, -0.457, -0.649, -0.523, 0.193, + 0.394, 0.326, 0.406, 0.162, 0, 0, 0, 0, 0], + [-0.265, -0.65, -0.739, -0.634, -0.5, -0.314, -0.159, -0.072, 0.052, 0.159, 0.215, 0.316, + 0.398, 0.374, 0.374, 0.424, 0.37, 0.181, -0.065, -0.265, -0.429, -0.627, -0.519, 0.18, + 0.394, 0.326, 0.406, 0.162, 0, 0, 0, 0, 0], + [-0.276, -0.647, -0.731, -0.626, -0.492, -0.307, -0.152, -0.064, 0.058, 0.166, 0.227, 0.329, + 0.411, 0.389, 0.39, 0.441, 0.389, 0.207, -0.032, -0.228, -0.394, -0.596, -0.494, 0.194, + 0.376, 0.326, 0.406, 0.162, 0, 0, 0, 0, 0], + [-0.271, -0.646, -0.73, -0.625, -0.489, -0.303, -0.149, -0.061, 0.062, 0.169, 0.229, 0.332, + 0.412, 0.388, 0.389, 0.439, 0.387, 0.206, -0.028, -0.209, -0.347, -0.524, -0.435, 0.195, + 0.381, 0.313, 0.405, 0.162, 0, 0, 0, 0, 0], + [-0.267, -0.647, -0.734, -0.628, -0.49, -0.304, -0.151, -0.062, 0.061, 0.168, 0.229, 0.329, + 0.408, 0.385, 0.388, 0.438, 0.386, 0.206, -0.024, -0.194, -0.319, -0.48, -0.36, 0.318, + 0.405, 0.335, 0.394, 0.162, 0, 0, 0, 0, 0], + [-0.274, -0.656, -0.745, -0.64, -0.5, -0.313, -0.158, -0.068, 0.054, 0.161, 0.223, 0.325, + 0.402, 0.379, 0.384, 0.438, 0.392, 0.221, 0.001, -0.164, -0.278, -0.415, -0.264, 0.445, + 0.402, 0.304, 0.389, 0.157, 0, 0, 0, 0, 0], + [-0.289, -0.666, -0.753, -0.648, -0.508, -0.32, -0.164, -0.073, 0.049, 0.156, 0.22, 0.321, + 0.397, 0.374, 0.377, 0.43, 0.387, 0.224, 0.014, -0.139, -0.236, -0.359, -0.211, 0.475, + 0.4, 0.308, 0.375, 0.155, 0, 0, 0, 0, 0], + [-0.302, -0.678, -0.765, -0.659, -0.517, -0.329, -0.176, -0.085, 0.038, 0.145, 0.208, 0.31, + 0.386, 0.362, 0.366, 0.421, 0.381, 0.224, 0.022, -0.119, -0.201, -0.3, -0.129, 0.572, + 0.419, 0.265, 0.364, 0.154, 0, 0, 0, 0, 0], + [-0.314, -0.696, -0.786, -0.681, -0.539, -0.349, -0.196, -0.105, 0.019, 0.127, 0.189, 0.289, + 0.364, 0.34, 0.346, 0.403, 0.37, 0.222, 0.036, -0.081, -0.133, -0.205, -0.021, 0.674, + 0.383, 0.237, 0.359, 0.151, 0, 0, 0, 0, 0], + [-0.341, -0.719, -0.807, -0.702, -0.558, -0.367, -0.211, -0.12, 0.003, 0.111, 0.175, 0.277, + 0.351, 0.325, 0.331, 0.39, 0.36, 0.221, 0.048, -0.046, -0.074, -0.139, 0.038, 0.726, + 0.429, 0.215, 0.347, 0.151, 0, 0, 0, 0, 0], + [ -0.35, -0.737, -0.829, -0.724, -0.577, -0.385, -0.229, -0.136, -0.011, 0.098, 0.163, 0.266, + 0.338, 0.31, 0.316, 0.378, 0.354, 0.221, 0.062, -0.009, -0.012, -0.063, 0.119, 0.811, + 0.319, 0.201, 0.343, 0.148, 0, 0, 0, 0, 0], + [-0.344, -0.75, -0.856, -0.757, -0.607, -0.409, -0.25, -0.156, -0.033, 0.076, 0.143, 0.246, + 0.316, 0.287, 0.293, 0.361, 0.345, 0.225, 0.082, 0.035, 0.071, 0.046, 0.172, 0.708, + 0.255, 0.21, 0.325, 0.146, 0, 0, 0, 0, 0]] ./ 86400 + + rad_in = hcat(rad_in...)' + profile = Dierckx.Spline2D(rad_time, z_in, rad_in; kx = 1, ky = 1) + return profile +end diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..0c36332 --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,2 @@ +[deps] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/runtests.jl b/test/runtests.jl new file mode 100644 index 0000000..b8fd6c5 --- /dev/null +++ b/test/runtests.jl @@ -0,0 +1,15 @@ +using Test +using AtmosphericProfilesLibrary + +iscallable(f) = !isempty(methods(f)) +@testset "AtmosphericProfilesLibrary" begin + for name in names(AtmosphericProfilesLibrary; all = true) + startswith(string(name), "#") && continue + name == :AtmosphericProfilesLibrary && continue + name == :eval && continue + name == :include && continue + prof = getproperty(AtmosphericProfilesLibrary, name) + iscallable(prof) || @show name + @test iscallable(prof) + end +end