Skip to content

Commit db1a26f

Browse files
committed
General proofreading
Simple overhaul of the code: Clarify comments where unclear, clarify code where non-risky. The ruminations are not considered code, and hence not treated here.
1 parent d0a1355 commit db1a26f

37 files changed

+203
-180
lines changed

CHANGELOG.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1414
in coordinate tuple types (Coor4D, Coor3D, Coor2D, Coor32)
1515
- `TriaxialEllpisoid`, mostly as a placeholder
1616

17+
### Fixed
18+
19+
- A large number of linguistic errors and ambiguities
20+
1721
### Changed
1822

1923
- `CoordinateTuple` trait now requires implementation of the constructor
@@ -22,12 +26,14 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2226
and a number of associated traits requiring `EllipsoidBase`.
2327
- Meaning of `EllipsoidBase::aspect_ratio()` switched from *b / a* to the
2428
apparently more common *a / b*
25-
- Major restructuring and clean up of `lib.rs`. Only marignally visible externally,
29+
- Major restructuring and clean up of `lib.rs`. Only marginally visible externally,
2630
if using `use geodesy::prelude::*`
31+
- Moved some_basic_coorNdinates to `crate::test_dat::coorNd`
2732

2833
### Removed
2934

30-
- CHANGES.md
35+
- `CHANGES.md`
36+
- Unused parallel context stup `context/parallel.rs`
3137

3238
## [0.13.0] - 2024-04-06
3339

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ required-features = ["binary"]
6666

6767
[profile.release]
6868
lto = true
69-
strip = true # Automatically strip symbols from the binary.
69+
strip = true
7070

7171
[target.wasm32-unknown-unknown.dependencies]
7272
wasm-bindgen = "0.2"

HOWTO-RELEASE.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# DRAFT: How to release
22

3+
- `git switch main`
4+
- `just clean-check`
5+
36
- manually check that all [issues](https://github.com/busstoptaktik/geodesy/issues/)
47
assigned to the
58
[milestone for the upcomming release](https://github.com/busstoptaktik/geodesy/issues?q=is%3Aopen+is%3Aissue+milestone%3A0.14.0)
69
are resolved
710
- update `Cargo.toml` with new version id, i.e. `"0.14.0"`
811

9-
- `just clean-check`
1012
- `just changes` (to preview a new `CHANGELOG`)
11-
- update `CHANGELOG.md`
12-
- `just changelog` (to generate a new `CHANGELOG`)
13+
- manually update `CHANGELOG.md` (mostly: change unreleased to 0.14.0)
1314
- `git commit -a -m "CHANGELOG.md for v0.14.0"`
1415
- `git push`
1516
- `git tag v0.14.0`
@@ -25,4 +26,8 @@
2526

2627
Twitter/Mastodon/DiscordGeo:
2728

28-
Rust Geodesy version 0.14.0 just released. 3 months and 36 commits in the making. Get it while it's hot! https://lib.rs/geodesy | https://crates.io/crates/geodesy | https://docs.rs/geodesy/latest/geodesy/
29+
```txt
30+
Rust Geodesy version 0.14.0 just released. X months and Y commits in the making. Get it while it's hot! https://lib.rs/geodesy | https://crates.io/crates/geodesy | https://docs.rs/geodesy/latest/geodesy/
31+
```
32+
33+
Also post new section of Changelog to DiscordGeo

README.md

+34-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ The most important **features** are
1515
The most important **objectives** are
1616

1717
- to support new, and hopefully better, abstractions,
18-
- to use these abstractions to build better, simpler, and more tractable, geospatial **standards, transformations, and software**.
18+
- to use these abstractions to build better, simpler, and more tractable,
19+
geospatial **standards, transformations, and software**.
1920

2021
If any of this resonates with you, read on after this minimal usage example...
2122

@@ -31,7 +32,8 @@ $ cd foo
3132
$ cargo add geodesy
3233
```
3334

34-
Then copy this to the `foo/src/main.rs` file: A minimal example, computing the UTM coordinates of some Scandinavian capitals
35+
Then overwrite the contents of the `foo/src/main.rs` file with this:
36+
A minimal example, computing the UTM coordinates of some Scandinavian capitals
3537

3638
```rust
3739
use geodesy::prelude::*;
@@ -72,11 +74,28 @@ $ cargo r
7274
- Lambert Conformal Conic
7375
- Lambert Azimuthal Equal Area
7476

75-
But fundamentally, *RG* is born as a *geodesy*, rather than *cartography* library. And while PROJ benefits from four decades of *reality hardening*, RG, being a platform for experiments, does not have operational robustness as a main focus. Hence, viewing *RG* as *another PROJ*, or *PROJ [RiiR](https://acronyms.thefreedictionary.com/RIIR)*, will lead to bad disappointment. At best, you may catch a weak mirage of a *potential* [shape of jazz to come](https://en.wikipedia.org/wiki/The_Shape_of_Jazz_to_Come) for the PROJ internal dataflow.
76-
77-
That said, being written in Rust, with all the memory safety guarantees Rust provides, *RG* by design avoids a number of pitfalls that are explicitly worked around in the PROJ code base. So the miniscule size of *RG* compared to PROJ is not just a matter of functional pruning. It is also a matter of development using a tool wonderfully suited for the task at hand.
78-
79-
Also, having the advantage of learning from PROJ experience, both from a user's and a developer's perspective, *RG* is designed to be significantly more extensible than PROJ. So perhaps for a number of applications, and despite its limitations, RG may be sufficient, and perhaps even useful.
77+
But fundamentally, *RG* is born as a *geodesy*, rather than
78+
a *cartography* library. And while PROJ benefits from four
79+
decades of *reality hardening*, RG, being a platform for experiments,
80+
does not have operational robustness as a main focus.
81+
Hence, viewing *RG* as *another PROJ*, or
82+
*PROJ [RiiR](https://acronyms.thefreedictionary.com/RIIR)*,
83+
will lead to bad disappointment.
84+
At best, you may catch a weak mirage of a *potential*
85+
[shape of jazz to come](https://en.wikipedia.org/wiki/The_Shape_of_Jazz_to_Come)
86+
for the PROJ internal dataflow.
87+
88+
That said, being written in Rust, with all the memory safety guarantees Rust provides,
89+
*RG* by design avoids a number of pitfalls that are explicitly worked
90+
around in the PROJ code base. So the miniscule size of *RG* compared to
91+
PROJ is not just a matter of functional pruning. It is also a matter of
92+
development using a tool wonderfully suited for the task at hand.
93+
94+
Also, having the advantage of learning from PROJ experience, both from
95+
a user's and a developer's perspective, *RG* is designed to be
96+
significantly more extensible than PROJ. So perhaps for a number of
97+
applications, and despite its limitations, RG may be sufficient, and
98+
perhaps even useful.
8099

81100
## Aims
82101

@@ -87,7 +106,8 @@ Dataflow experimentation is just one aspect of *RG*. Overall, the aims are (at l
87106
3. Hence, provide easy access to a number of basic geodetic operations, not limited to coordinate operations.
88107
4. Support experiments with data flow and alternative abstractions. Mostly as a tool for aims (1, 2, 3)
89108

90-
All four aims are guided by a wish to amend explicitly identified shortcomings in the existing geodetic system landscape.
109+
All four aims are guided by a wish to amend explicitly identified
110+
shortcomings in the existing geodetic system landscape.
91111

92112
## Documentation
93113

@@ -103,7 +123,8 @@ The documentation is currently limited, but take a look at:
103123

104124
## License
105125

106-
*Rust Geodesy*: Copyright 2020, 2021, 2022, 2023, 2024 by Thomas Knudsen <knudsen.thomas@gmail.com> and contributors.
126+
*Rust Geodesy*: Copyright 2020, 2021, 2022, 2023, 2024 by
127+
Thomas Knudsen <knudsen.thomas@gmail.com> and contributors.
107128

108129
Licensed under either of
109130

@@ -116,4 +137,7 @@ at your option.
116137

117138
## Contribution
118139

119-
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
140+
Unless you explicitly state otherwise, any contribution intentionally
141+
submitted for inclusion in the work by you, as defined in the
142+
Apache-2.0 license, shall be dual licensed as above, without any
143+
additional terms or conditions.

justfile

-4
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ run-all:
6969
changes:
7070
git log --pretty=format:"%as: %s (%an)"
7171

72-
# Update CHANGELOG file
73-
changelog:
74-
git log --pretty=format:"%as: %s (%an)" > CHANGELOG
75-
7672
# Some invisible oddities for general amusement
7773

7874
_sysinfo:

src/bibliography/mod.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,18 @@ pub enum Bibliography {
8383
Kar22,
8484

8585
/// Thomas Knudsen, Kristian Evers, Geir Arne Hjelle,
86-
/// Guðmundur Valsson, Martin Lidberg and Pasi Häkli (2019):
86+
/// Guðmundur Valsson, Martin Lidberg and Pasi Häkli, 2019:
8787
/// *The Bricks and Mortar for Contemporary Reimplementation of Legacy Nordic Transformations*.
8888
/// Geophysica, 54(1), pp. 107–116.
8989
Knu19,
9090

91+
/// R. König and K.H. Weise, 1951:
92+
/// *Mathematische Grundlagen der Höheren Geodäsie und Kartographie:
93+
/// Erster Band: Das Erdsphäroid und Seine Konformen Abbildungen*
94+
/// Berlin: Springer, 540 pp.
95+
/// [URL](https://link.springer.com/book/10.1007/978-3-642-87438-3)
96+
KuW51,
97+
9198
/// L. Krüger (1912). *Konforme Abbildung des Erdellipsoids in der Ebene*.
9299
/// Veröffentlichung des Königlich Preuszischen Geodätischen Instituts:
93100
/// Neue Folge vol. 52, Leipzig: Teubner, 181 pp.
@@ -96,6 +103,13 @@ pub enum Bibliography {
96103
/// [pdf](https://gfzpublic.gfz-potsdam.de/rest/items/item_8827_5/component/file_130038/content).
97104
Kru12,
98105

106+
/// Knud Poder and Karsten Engsager, 1998.
107+
/// *Some Conformal Mappings and Transformations for Geodesy and Topographic Cartography*.
108+
/// Copenhagen, Denmark: Geodetic Division, KMS,
109+
/// Skrifter 4. række, bind 6, 63 pp.
110+
/// [URL](https://ftp.space.dtu.dk/pub/Altimetry/ENGSAGER/SomeConformalMappings.pdf)
111+
Pod98,
112+
99113
/// A. C. Ruffhead (2016): The SMITSWAM method of datum transformations
100114
/// consisting of Standard Molodensky in two stages with applied misclosures,
101115
/// Survey Review, 48:350, pp. 376-384,

src/context/minimal.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ mod tests {
131131
fn basic() -> Result<(), Error> {
132132
let mut ctx = Minimal::new();
133133

134-
// The "stupid way of adding 1" macro from geodesy/macro/stupid_way.macro
134+
// The "stupid way of adding 1" macro from geodesy/resources/stupid.md
135135
ctx.register_resource("stupid:way", "addone | addone | addone inv");
136136
let op = ctx.op("stupid:way")?;
137137

@@ -141,7 +141,7 @@ mod tests {
141141
assert_eq!(steps[1], "addone");
142142
assert_eq!(steps[2], "addone inv");
143143

144-
let mut data = some_basic_coor2dinates();
144+
let mut data = crate::test_data::coor2d();
145145
assert_eq!(data[0].x(), 55.);
146146
assert_eq!(data[1].x(), 59.);
147147

@@ -166,7 +166,7 @@ mod tests {
166166

167167
let op = ctx.op("geo:in | utm zone=32 | neu:out")?;
168168

169-
let mut data = some_basic_coor2dinates();
169+
let mut data = crate::test_data::coor2d();
170170
assert_eq!(data[0].x(), 55.);
171171
assert_eq!(data[1].x(), 59.);
172172

src/context/parallel.rs

-29
This file was deleted.

src/context/plain.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use std::{
1212
/// external grids, and macros.
1313
/// Sufficient for most uses, especially geodetic grid development.
1414
/// May get somewhat clunky when working with large numbers of grids or macros,
15-
/// as each reside in its own file.
1615
#[derive(Debug)]
1716
pub struct Plain {
1817
constructors: BTreeMap<String, OpConstructor>,
@@ -120,7 +119,9 @@ impl Context for Plain {
120119

121120
/// Instantiate an operator. Recognizes PROJ syntax and converts it to Geodesy syntax.
122121
/// Bear in mind, however, that Geodesy does not support all PROJ operators, and that
123-
/// the input/output conventions differ.
122+
/// the input/output conventions differ. This functionality may be a better fit for
123+
/// somewhere between [`token::split_into_steps()`](crate::token::Tokenize::split_into_steps())
124+
/// and [`token::normalize()`](crate::token::Tokenize::normalize())
124125
fn op(&mut self, definition: &str) -> Result<OpHandle, Error> {
125126
// It may be a PROJ string, so we filter it through the PROJ parser
126127
let definition = parse_proj(definition)?;
@@ -311,7 +312,7 @@ mod tests {
311312
let op = ctx.op("stupid:way")?;
312313

313314
// ...and it works as expected?
314-
let mut data = some_basic_coor2dinates();
315+
let mut data = crate::test_data::coor2d();
315316
assert_eq!(data[0].x(), 55.);
316317
assert_eq!(data[1].x(), 59.);
317318

@@ -341,7 +342,7 @@ mod tests {
341342
let op = ctx.op("stupid:way_too")?;
342343

343344
// ...and it works as expected?
344-
let mut data = some_basic_coor2dinates();
345+
let mut data = crate::test_data::coor2d();
345346

346347
ctx.apply(op, Fwd, &mut data)?;
347348
assert_eq!(data[0].x(), 57.);
@@ -352,13 +353,13 @@ mod tests {
352353
assert!(matches!(op, Err(Error::Syntax(_))));
353354

354355
let op = ctx.op("stupid:addthree")?;
355-
let mut data = some_basic_coor2dinates();
356+
let mut data = crate::test_data::coor2d();
356357
ctx.apply(op, Fwd, &mut data)?;
357358
assert_eq!(data[0].x(), 58.);
358359
assert_eq!(data[1].x(), 62.);
359360

360361
let op = ctx.op("stupid:addthree_one_by_one")?;
361-
let mut data = some_basic_coor2dinates();
362+
let mut data = crate::test_data::coor2d();
362363
ctx.apply(op, Fwd, &mut data)?;
363364
assert_eq!(data[0].x(), 58.);
364365
assert_eq!(data[1].x(), 62.);
@@ -373,7 +374,7 @@ mod tests {
373374

374375
// But this classic should work...
375376
let op = ctx.op("geo:in | utm zone=32")?;
376-
let mut data = some_basic_coor2dinates();
377+
let mut data = crate::test_data::coor2d();
377378
ctx.apply(op, Fwd, &mut data)?;
378379
let expected = [691875.6321396609, 6098907.825005002];
379380
assert_float_eq!(data[0].0, expected, abs_all <= 1e-9);

src/coordinate/coor32.rs

+6
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,10 @@ mod tests {
151151
let b = Coor32([4., 3.]);
152152
assert_eq!(a.dot(b), 10.)
153153
}
154+
155+
#[test]
156+
fn crate_test_data() {
157+
let a = crate::test_data::coor32();
158+
assert_eq!(a[0][0], 55.);
159+
}
154160
}

src/coordinate/set.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// CoordinateSet is the fundamental coordinate access interface in ISO-19111.
1+
/// `CoordinateSet` is the fundamental coordinate access interface in ISO-19111.
22
/// Strictly speaking, it is not a set, but (in abstract terms) rather an
33
/// indexed list, or (in more concrete terms): An array.
44
///
@@ -352,7 +352,7 @@ mod tests {
352352
// Test the "impl<const N: usize> CoordinateSet for [Coor4D; N]"
353353
#[test]
354354
fn array() {
355-
let mut operands = some_basic_coor4dinates();
355+
let mut operands = crate::test_data::coor4d();
356356
assert_eq!(operands.len(), 2);
357357
assert!(!operands.is_empty());
358358

@@ -374,7 +374,7 @@ mod tests {
374374
// Test the "impl CoordinateSet for Vec<Coor4D>"
375375
#[test]
376376
fn vector() {
377-
let mut operands = Vec::from(some_basic_coor4dinates());
377+
let mut operands = Vec::from(crate::test_data::coor2d());
378378
assert_eq!(operands.len(), 2);
379379
assert!(!operands.is_empty());
380380

@@ -396,7 +396,7 @@ mod tests {
396396
// Test the "AngularUnits" conversion trait
397397
#[test]
398398
fn angular() {
399-
let operands = some_basic_coor2dinates();
399+
let operands = crate::test_data::coor2d();
400400
let cph = operands.get_coord(0);
401401

402402
// Note the different usage patterns when using the AngularUnits trait with

src/coordinate/tuple.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ all_coord_operators!(Coor2D, Coor2D, coor2d);
107107
all_coord_operators!(Coor2D, Coor32, coor2d);
108108
all_coord_operators!(Coor32, Coor32, coor32);
109109

110-
/// CoordinateTuple is the ISO-19111 atomic spatial/spatiotemporal
110+
/// `CoordinateTuple` is the ISO-19111 atomic spatial/spatiotemporal
111111
/// referencing element. So loosely speaking, a CoordinateSet is a
112112
/// collection of CoordinateTuples.
113113
///
114114
/// Note that (despite the formal name) the underlying data structure
115-
/// need not be a tuple: It can be any item, for which it makes sense
116-
/// to implement the CoordinateTuple trait.
115+
/// need not be a Rust tuple: It can be any item, for which it makes
116+
/// sense to implement the CoordinateTuple trait.
117117
///
118118
/// The CoordinateTuple trait provides a number of convenience accessors
119119
/// for accessing single coordinate elements or tuples of subsets.

src/ellipsoid/biaxial.rs

+10
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ impl Ellipsoid {
5151
return Ok(Ellipsoid::new(ax, f));
5252
}
5353

54+
// Remove optional parenthesis
55+
let mut name = name;
56+
if name.starts_with('(') && name.ends_with(')') {
57+
name = name.strip_prefix('(').unwrap().strip_suffix(')').unwrap();
58+
}
59+
5460
// The "semimajor, reciproque-flattening" form, e.g. "6378137, 298.3"
5561
let a_and_rf = name.split(',').collect::<Vec<_>>();
5662
if a_and_rf.len() == 2_usize {
@@ -88,6 +94,10 @@ mod tests {
8894
assert_eq!(ellps.semimajor_axis(), 6378137.0);
8995
assert_eq!(ellps.flattening(), 1. / 298.25);
9096

97+
let ellps = Ellipsoid::named("(6378137, 298.25)")?;
98+
assert_eq!(ellps.semimajor_axis(), 6378137.0);
99+
assert_eq!(ellps.flattening(), 1. / 298.25);
100+
91101
let ellps = Ellipsoid::named("GRS80")?;
92102
assert_eq!(ellps.semimajor_axis(), 6378137.0);
93103
assert_eq!(ellps.flattening(), 1. / 298.257_222_100_882_7);

0 commit comments

Comments
 (0)