Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "1.4.1"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
NetCDF = "30363a11-5582-574a-97bb-aa9a979735b9"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Expand All @@ -15,8 +16,9 @@ YAXArrays = "c21b50f5-aa40-41ea-b809-c0f5e47bfa5c"
[compat]
CSV = "0.10"
DataFrames = "1"
julia = "1"
JSON = "0.21.4"
NetCDF = "0.11.8"
Statistics = "1.10.0"
StatsBase = "0.33, 0.34"
YAXArrays = "0.5.5"
julia = "1"
20 changes: 17 additions & 3 deletions src/ReefModEngine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ using Base.Filesystem: path_separator
const RME_BASE_GRID_SIZE = Ref(100)
const m2_TO_km2 = 0.000001


macro RME(func)
local m = esc(Meta.parse("@ccall RME.$(func)"))
return quote
local err = $m

if !(typeof(err) <: Cstring) && err != 0 && !(typeof(err) <: Cvoid)
local err_msg = @ccall RME.lastError()::Cstring
throw(ArgumentError("Call to RME failed with message: $(unsafe_string(err_msg))"))
throw(
ArgumentError("Call to RME failed with message: $(unsafe_string(err_msg))")
)
end

if typeof(err) <: Cstring
Expand All @@ -36,6 +37,19 @@ macro getRME(func)
return esc(Meta.parse("@ccall RME.$(func)"))
end

"""
rme_version_info()::@NamedTuple{major::Int64, minor::Int64, patch::Int64}

Get RME version
"""
function rme_version_info()::@NamedTuple{major::Int64, minor::Int64, patch::Int64}
rme_ver = @RME version()::Cstring
rme_ver = parse.(Int64, split(rme_ver, '.'))
return (major=rme_ver[1], minor=rme_ver[2], patch=rme_ver[3])
end

export rme_version_info

include("rme_init.jl")
include("interface.jl")
include("deployment.jl")
Expand All @@ -48,7 +62,7 @@ export

# Convenience/utility methods
export
reef_ids, deployment_area, set_outplant_deployment!,
reef_ids, deployment_area, set_outplant_deployment!, set_enrichment_deployment!,
match_id, match_ids, reef_areas

# IO
Expand Down
Loading