Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for 0.17.0-alpha #265

Merged
merged 8 commits into from
Aug 27, 2024
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
35 changes: 34 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
Expand Down Expand Up @@ -113,7 +115,7 @@ jobs:
run: |
cd ${{ matrix.folder }} && cargo clean && cargo update && cargo build ${{ matrix.opts }}

test:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -196,3 +198,34 @@ jobs:
with:
command: build
args: --all-features --release

release:
name: Release Libraries
runs-on: ubuntu-latest
needs: [linter, build, documentation, windows-build, macos-build]
if: github.ref_type == 'tag'
strategy:
matrix:
include:
- crate: rinex-qc-traits
- crate: rinex
- crate: sp3
- crate: sinex
- crate: rinex-qc
- crate: ublox-rnx
- crate: rnx2crx
- crate: crx2rnx
- crate: rinex-cli
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Publish
env:
TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: |
cargo login $TOKEN
cargo publish -p ${{ matrix.crate }} --allow-dirty
4 changes: 2 additions & 2 deletions crx2rnx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "crx2rnx"
version = "2.3.4"
version = "2.4.0"
license = "MIT OR Apache-2.0"
authors = ["Guillaume W. Bres <guillaume.bressaix@gmail.com>"]
description = "RINEX data decompressor"
Expand All @@ -12,4 +12,4 @@ readme = "README.md"

[dependencies]
clap = { version = "4.4.13", features = ["derive", "color"] }
rinex = { path = "../rinex", version = "=0.16.1", features = ["serde"] }
rinex = { path = "../rinex", version = "=0.17.0-alpha", features = ["serde"] }
2 changes: 1 addition & 1 deletion qc-traits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rinex-qc-traits"
version = "0.1.1"
version = "0.2.0"
license = "MIT OR Apache-2.0"
authors = ["Guillaume W. Bres <guillaume.bressaix@gmail.com>"]
description = "RINEX quality analysis specific traits"
Expand Down
8 changes: 4 additions & 4 deletions rinex-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rinex-cli"
version = "0.11.1"
version = "0.12.0-alpha"
license = "MIT OR Apache-2.0"
authors = ["Guillaume W. Bres <guillaume.bressaix@gmail.com>"]
description = "Command line tool parse and analyze RINEX data"
Expand Down Expand Up @@ -53,6 +53,6 @@ cggtts = { version = "4.1.6", features = ["serde", "scheduler"], optional = true
# cggtts = { path = "../../cggtts/cggtts", features = ["serde", "scheduler"], optional = true }
# cggtts = { git = "https://github.com/gwbres/cggtts", branch = "main", features = ["serde", "scheduler"], optional = true }

rinex = { path = "../rinex", version = "=0.16.1", features = ["full"] }
sp3 = { path = "../sp3", version = "=1.0.8", features = ["serde", "flate2"] }
rinex-qc = { path = "../rinex-qc", version = "=0.1.14", features = ["sp3"] }
rinex = { path = "../rinex", version = "=0.17.0-alpha", features = ["full"] }
sp3 = { path = "../sp3", version = "=1.1.0-alpha", features = ["serde", "flate2"] }
rinex-qc = { path = "../rinex-qc", version = "=0.2.0-alpha", features = ["sp3"] }
10 changes: 6 additions & 4 deletions rinex-cli/src/fops/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ pub fn write_nav_rinex(obs: &Rinex, brdc: &Rinex, path: &Path) -> Result<(), Err
for (sv, _) in svnn.iter() {
let sv_str = sv.to_string();
if let Some((toc, _toe, eph)) = brdc.sv_ephemeris(*sv, *t) {
if let Some((x_ecef_km, y_ecef_km, z_ecef_km)) = eph.kepler2position(*sv, toc, *t) {
if let Some(sv_orbit) = eph.kepler2position(*sv, toc, *t) {
let sv_state = sv_orbit.to_cartesian_pos_vel();
let (x_km, y_km, z_km) = (sv_state[0], sv_state[1], sv_state[2]);
orbit_w.write_record(&[
&t_str,
&sv_str,
&format!("{:.3E}", x_ecef_km),
&format!("{:.3E}", y_ecef_km),
&format!("{:.3E}", z_ecef_km),
&format!("{:.3E}", x_km),
&format!("{:.3E}", y_km),
&format!("{:.3E}", z_km),
])?;
if let Some(correction) = eph.clock_correction(toc, *t, *sv, 8) {
clk_w.write_record(&[
Expand Down
8 changes: 4 additions & 4 deletions rinex-cli/src/positioning/orbit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ impl OrbitSource for Orbits<'_, '_> {
}; //precise

let keplerian = if let Some((toc, _, eph)) = self.eph.borrow_mut().select(t, sv) {
let (x_km, y_km, z_km) = eph.kepler2position(sv, toc, t)?;
let orbit = eph.kepler2position(sv, toc, t)?;
let state = orbit.to_cartesian_pos_vel();
let (x_km, y_km, z_km) = (state[0], state[1], state[2]);
debug!(
"{}({}) keplerian state (ECEF): x={}km,y={}km,z={}km",
t, sv, x_km, y_km, z_km
);
Some(Orbit::from_position(
x_km, y_km, z_km, t, fr, // TODO: convert if need be
))
Some(orbit)
} else {
None
};
Expand Down
8 changes: 4 additions & 4 deletions rinex-qc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rinex-qc"
version = "0.1.14"
version = "0.2.0-alpha"
license = "MIT OR Apache-2.0"
authors = ["Guillaume W. Bres <guillaume.bressaix@gmail.com>"]
description = "RINEX and more broadly, GNSS data processing"
Expand Down Expand Up @@ -49,10 +49,10 @@ plotly = { git = "https://github.com/gwbres/plotly", branch = "scattergeo"}
hifitime = "4.0.0-alpha"
gnss-rs = { version = "2.2.3", features = ["serde"] }

rinex = { path = "../rinex", version = "=0.16.1", features = ["full"] }
rinex-qc-traits = { path = "../qc-traits", version = "=0.1.1", features = ["processing"] }
rinex = { path = "../rinex", version = "=0.17.0-alpha", features = ["full"] }
rinex-qc-traits = { path = "../qc-traits", version = "=0.2.0", features = ["processing"] }

sp3 = { path = "../sp3", version = "=1.0.8", features = ["qc", "processing", "serde"], optional = true }
sp3 = { path = "../sp3", version = "=1.1.0-alpha", features = ["qc", "processing", "serde"], optional = true }

[dev-dependencies]
serde_json = "1"
52 changes: 25 additions & 27 deletions rinex-qc/src/report/orbit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ impl BrdcSp3Report {
fn new(sp3: &SP3, brdc: &Rinex) -> Self {
let mut errors = BTreeMap::<SV, Vec<(Epoch, f64, f64, f64)>>::new();
for (t_sp3, sv_sp3, (sp3_x, sp3_y, sp3_z)) in sp3.sv_position() {
if let Some((brdc_x, brdc_y, brdc_z)) = brdc.sv_position(sv_sp3, t_sp3) {
if let Some(brdc_orb) = brdc.sv_orbit(sv_sp3, t_sp3) {
let brdc_state = brdc_orb.to_cartesian_pos_vel();
let (brdc_x, brdc_y, brdc_z) = (brdc_state[0], brdc_state[1], brdc_state[2]);
let (err_x_m, err_y_m, err_z_m) = (
(brdc_x - sp3_x) * 1000.0,
(brdc_y - sp3_y) * 1000.0,
Expand Down Expand Up @@ -126,7 +128,7 @@ impl Render for BrdcSp3Report {
}
tr {
th class="is-info" {
"X errors"
"Y errors"
}
td {
(self.y_err_plot.render())
Expand Down Expand Up @@ -179,6 +181,8 @@ impl OrbitReport {
#[cfg(feature = "sp3")]
if let Some(sp3) = ctx.sp3() {
for (t, sv_sp3, pos_sp3) in sp3.sv_position() {
let rx_orbit = Orbit::from_position(x0_km, y0_km, z0_km, t, ctx.earth_cef);

let (x_sp3_km, y_sp3_km, z_sp3_km) = (pos_sp3.0, pos_sp3.1, pos_sp3.2);
if let Ok(el_az_range) = Ephemeris::elevation_azimuth_range(
t,
Expand Down Expand Up @@ -208,31 +212,25 @@ impl OrbitReport {
}
if brdc_skyplot {
let brdc = ctx.brdc_navigation().unwrap();
if let Some((x_km, y_km, z_km)) = brdc.sv_position(sv_sp3, t) {
if let Ok(el_az_range) = Ephemeris::elevation_azimuth_range(
t,
&ctx.almanac,
ctx.earth_cef,
(x_km, y_km, z_km),
(x0_km, y0_km, z0_km),
) {
let (el_deg, az_deg) =
(el_az_range.elevation_deg, el_az_range.azimuth_deg);
if let Some(t_brdc) = t_brdc.get_mut(&sv_sp3) {
t_brdc.push(t);
} else {
t_brdc.insert(sv_sp3, vec![t]);
}
if let Some(e) = elev_brdc.get_mut(&sv_sp3) {
e.push(el_deg);
} else {
elev_brdc.insert(sv_sp3, vec![el_deg]);
}
if let Some(a) = azim_brdc.get_mut(&sv_sp3) {
a.push(az_deg);
} else {
azim_brdc.insert(sv_sp3, vec![az_deg]);
}
if let Some(el_az_range) =
brdc.sv_azimuth_elevation_range(sv_sp3, t, rx_orbit, &ctx.almanac)
{
let (el_deg, az_deg) =
(el_az_range.elevation_deg, el_az_range.azimuth_deg);
if let Some(t_brdc) = t_brdc.get_mut(&sv_sp3) {
t_brdc.push(t);
} else {
t_brdc.insert(sv_sp3, vec![t]);
}
if let Some(e) = elev_brdc.get_mut(&sv_sp3) {
e.push(el_deg);
} else {
elev_brdc.insert(sv_sp3, vec![el_deg]);
}
if let Some(a) = azim_brdc.get_mut(&sv_sp3) {
a.push(az_deg);
} else {
azim_brdc.insert(sv_sp3, vec![az_deg]);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions rinex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rinex"
version = "0.16.1"
version = "0.17.0-alpha"
license = "MIT OR Apache-2.0"
authors = ["Guillaume W. Bres <guillaume.bressaix@gmail.com>"]
description = "Package to parse and analyze RINEX data"
Expand Down Expand Up @@ -115,7 +115,7 @@ gnss-rs = { version = "2.2.3", features = ["serde", "domes", "cospar"] }

# RINEX QC dedicated traits
maud = { version = "0.26", optional = true }
rinex-qc-traits = { path = "../qc-traits", version = "=0.1.1", optional = true }
rinex-qc-traits = { path = "../qc-traits", version = "=0.2.0", optional = true }

[dev-dependencies]
serde_json = "1"
Expand Down
25 changes: 15 additions & 10 deletions rinex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2323,22 +2323,27 @@ impl Rinex {
})
}))
}
/// Returns SV Orbital state vector (if we can) at specified [Epoch] `t`.
/// Self must be NAV RINEX. Position is expressed as ECEF coordinates [km].
pub fn sv_position(&self, sv: SV, t: Epoch) -> Option<(f64, f64, f64)> {
/// Returns [SV] [Orbit]al state vector (if we can) at specified [Epoch] `t`.
/// Self must be NAV RINEX.
pub fn sv_orbit(&self, sv: SV, t: Epoch) -> Option<Orbit> {
let (toc, _, eph) = self.sv_ephemeris(sv, t)?;
eph.kepler2position(sv, toc, t)
}
/// Returns SV Orbital state vector and
/// instantaneous velocity (if we can) at specific [Epoch] `t`.
/// Self must be NAV RINEX. All coordinates expressed in ECEF [km] frame.
pub fn sv_position_velocity(
/// Returns [SV] attitude vector (if we can) at specified [Epoch] `t`
/// with respect to specified reference point expressed as an [Orbit].
/// [Self] must be NAV RINEX.
pub fn sv_azimuth_elevation_range(
&self,
sv: SV,
t: Epoch,
) -> Option<((f64, f64, f64), (f64, f64, f64))> {
let (toc, _, eph) = self.sv_ephemeris(sv, t)?;
eph.kepler2position_velocity(sv, toc, t)
rx_orbit: Orbit,
almanac: &Almanac,
) -> Option<AzElRange> {
let sv_orbit = self.sv_orbit(sv, t)?;
let azelrange = almanac
.azimuth_elevation_range_sez(sv_orbit, rx_orbit)
.ok()?;
Some(azelrange)
}
/// Ephemeris selection method. Use this method to select Ephemeris
/// for [SV] at [Epoch], to be used in navigation.
Expand Down
Loading
Loading