-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
515 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,9 @@ uuid = "03019ade-4524-4ecd-af79-46d4f04a1b56" | |
authors = ["Aaron Kaw <[email protected]> and contributors"] | ||
version = "1.0.0-DEV" | ||
|
||
[deps] | ||
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" | ||
|
||
[compat] | ||
InteractiveUtils = "1.11.0" | ||
julia = "1.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Generic Implementations | ||
|
||
The many implementations in `OceanSonar` | ||
depend on implementations not specific to the field of ocean sonar. | ||
Such generic implementations that are also `export`ed or otherwise `public` | ||
are documented here under Auxiliary. |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Sonar Oceanography | ||
|
||
The field of sonar oceanography concerns itself with | ||
properties and characteristics intrinsic to the ocean environment | ||
as is related to acoustics. | ||
Of significant influence to ocean acoustics | ||
are the ocean boundaries --- that is, the atmosphere and seabed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# The Ocean Volume |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Ocean Sound Speed | ||
|
||
```@docs | ||
sound_speed_profile | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Implementation | ||
|
||
## Repository Contents | ||
|
||
The filesystem for the package code and documentation texts | ||
are organised in such a way as to be added in | ||
alphanumeric folder-then-contents order. | ||
This way, the complicated contents does not have to be | ||
managed by a plethora of `include` call managements for `src/OceanSonar.jl`, | ||
or the `pages` keyword for `docs/make.jl`. | ||
|
||
## `OceanSonar` Modelling Types | ||
|
||
The field of ocean sonar consists of many metrics, | ||
each of which have many alternative contexts and methods for calculation. | ||
For simplicity of usage and the avoidance of namespace overpopulation, | ||
`OceanSonar` implements a collection of types | ||
that do much of the heavy lifting in the background. | ||
|
||
Firstly: | ||
|
||
```@docs | ||
Model | ||
``` | ||
|
||
The implementation of `Model` is such that a basic user will never need to be aware of it. | ||
It is a specialised version of [`Base.Val`](https://docs.julialang.org/en/v1/base/base/#Base.Val) defined specially for this package. | ||
`Model` cooperates with types defined in `OceanSonar` | ||
so users can call models by their name in a string or a symbol. | ||
For example: | ||
|
||
```@repl | ||
using OceanSonar | ||
import OceanSonar: sound_speed_profile | ||
sound_speed_profile(::Model{:MyModel}, z) = 1500 + exp(-z^2) | ||
sound_speed_profile(:MyModel, 1e3) | ||
sound_speed_profile("My Model", 1e3) | ||
``` | ||
|
||
Thus `Model` behaves as both a dispatching tool and a convenience enabler. | ||
For more advanced users, | ||
it is also accessible for easily extending `MetricFunction` instances. | ||
|
||
To [avoid piracy](https://docs.julialang.org/en/v1/manual/style-guide/#Avoid-type-piracy), | ||
this convenience behaviour is only defined for subtypes of `OceanSonar.MetricFunction`: | ||
|
||
```@docs; canonical = false | ||
OceanSonar.MetricFunction | ||
``` | ||
|
||
All metric functions defined by `@implement_metric_function` are listed in `metric_functions`: | ||
|
||
```@docs; canonical = false | ||
OceanSonar.metric_functions | ||
``` | ||
|
||
```@example | ||
using OceanSonar | ||
OceanSonar.metric_functions | ||
``` | ||
|
||
For each `MetricFunction`, you can view the `Model`s implemented for it | ||
by running `listmodels`: | ||
|
||
```@docs | ||
listmodels | ||
``` | ||
|
||
For each `Model` of a `MetricFunction`, you can view its inputs and parameters | ||
with `listarguments`: | ||
|
||
```@docs | ||
listarguments | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
export Model | ||
|
||
""" | ||
``` | ||
Model(name::AbstractString) | ||
Model(name::Symbol) | ||
``` | ||
Return `Model{name}()` | ||
which is used to dispatch functions by model names. | ||
The `name` is stored as a `Symbol` in [`pascaltext`](@ref) style, | ||
i.e. only alphanumerals. | ||
""" | ||
struct Model{M} | ||
function Model(model::AbstractString) | ||
# check = @. isalphanumeric(model) || ismember(model, OceanSonar.textstyleseps |> values) | ||
valids = [ | ||
isalphanumeric(ch) || ch in values(OceanSonar.textstyleseps) | ||
for ch in model | ||
] | ||
|
||
if any(@. !valids) | ||
error("Invalid model name: $model. See the documentation of `Model` for more information.") | ||
end | ||
|
||
return new{ | ||
model |> pascaltext |> Symbol | ||
}() | ||
end | ||
end | ||
|
||
Model(model::Symbol) = Model(model |> string) | ||
|
||
Model(model::Model) = model | ||
|
||
Model{M}() where {M} = Model(M) | ||
|
||
""" | ||
``` | ||
``` | ||
Overload of `Core.Symbol` for `OceanSonar.Model` types and instances. | ||
""" | ||
Symbol(::Type{Model{M}}) where {M} = M::Symbol | ||
Symbol(model::Model) = model |> typeof |> Symbol | ||
|
||
""" | ||
``` | ||
``` | ||
Overload of `Core.Symbol` for `OceanSonar.Model types and instances`. | ||
""" | ||
String(::Type{Model{M}}) where {M} = M |> String | ||
String(model::Model) = model |> typeof |> String | ||
|
||
function textstyle(val::Val, ModelType::Type{Model{M}}; keeptokens = keeptokens) where {M} | ||
return textstyle(val, ModelType |> String; keeptokens = keeptokens) | ||
end | ||
|
||
function textstyle(val::Val, model::Model{M}; keeptokens = keeptokens) where {M} | ||
return textstyle(val, model |> typeof; keeptokens = keeptokens) | ||
end |
Oops, something went wrong.