~adigitoleo/PlateMotionRequests.jl

c8a303694f8adf074b93fafb6caecf3cecf70df9 — adigitoleo 2 months ago 3814cf6
refactor: Make package version number into a const
1 files changed, 11 insertions(+), 7 deletions(-)

M src/PlateMotionRequests.jl
M src/PlateMotionRequests.jl => src/PlateMotionRequests.jl +11 -7
@@ 23,6 23,13 @@ using NCDatasets
using TypedTables


# https://discourse.julialang.org/t/how-to-find-out-the-version-of-a-package-from-its-module/37755/15
const PACKAGE_VERSION = let
    project = TOML.parsefile(joinpath(pkgdir(@__MODULE__), "Project.toml"))
    VersionNumber(project["version"])
end


"""
    platemotion(lats, lons, heights; kwargs...)
    platemotion(lats, lons; kwargs...)


@@ 109,7 116,7 @@ end
function submit(request)
    return HTTP.post(
        "https://www.unavco.org/software/geodetic-utilities/plate-motion-calculator/plate-motion/model",
        ["User-Agent" => "PlateMotionRequests.jl/$(pkgversion()) (Julia/$VERSION)"],
        ["User-Agent" => "PlateMotionRequests.jl/$PACKAGE_VERSION (Julia/$VERSION)"],
        HTTP.Form(request),
    )
end


@@ 323,7 330,9 @@ function write_netcdf(file, table)
        "title" => "Tectonic plate motions",
        "institution" => "https://www.unavco.org/",
        "source" => join(unique(table.model), ",\n "),
        "history" => "[$(now())]: Created by PlateMotionRequests.jl $(pkgversion())\n",
        "history" => "[$(now())]: Created by PlateMotionRequests.jl $PACKAGE_VERSION\n",

        \n",
        "references" => "See <https://www.unavco.org/software/geodetic-utilities/plate-motion-calculator/plate-motion-calculator.html#references>",
        "comment" => "Produced using https://git.sr.ht/~adigitoleo/PlateMotionRequests.jl\n",
    )


@@ 490,9 499,4 @@ function read_platemotion(file)
end


function pkgversion()
    return VersionNumber(TOML.parsefile("$(@__DIR__)/../Project.toml")["version"])
end


end # module PlateMotionRequests