Skip to content

Commit dc9b6bc

Browse files
chore(deps): bump solar-positioning from 0.6.1 to 0.7.0 in /backend (#1064)
* chore(deps): bump solar-positioning from 0.6.1 to 0.7.0 in /backend Bumps [solar-positioning](https://github.com/klausbrunner/solarpositioning-rs) from 0.6.1 to 0.7.0. - [Changelog](https://github.com/klausbrunner/solarpositioning-rs/blob/main/CHANGELOG.md) - [Commits](klausbrunner/solarpositioning-rs@v0.6.1...v0.7.0) --- updated-dependencies: - dependency-name: solar-positioning dependency-version: 0.7.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix(backend): port sun position to solar-positioning 0.7 SolarPositions API --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eetu Sutinen <eetu.sutinen@gmail.com>
1 parent 4e8176e commit dc9b6bc

3 files changed

Lines changed: 16 additions & 13 deletions

File tree

‎backend/Cargo.lock‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎backend/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ chrono = { version = "0.4", features = ["serde"] }
2525
chrono-tz = "0.10"
2626
quick-xml = "0.42"
2727
sun = "0.3"
28-
solar-positioning = "0.6"
28+
solar-positioning = "0.7"
2929
hmac = "0.13.0"
3030
sha1 = "0.11.0"
3131
md5 = "0.8.0"

‎backend/src/pv/forecast/solar.rs‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! zenith is degrees from vertical.
66
77
use chrono::{DateTime, Datelike, Utc};
8-
use solar_positioning::{spa, RefractionCorrection};
8+
use solar_positioning::{Location, RefractionCorrection, SolarPositions};
99

1010
/// Observer elevation, atmosphere and ΔT used for the sun position. Refraction
1111
/// depends on the first three, but only near the horizon, so standard sea-level
@@ -38,15 +38,18 @@ pub fn sun_state(time: DateTime<Utc>, latitude: f64, longitude: f64) -> SunState
3838
let refraction = RefractionCorrection::new(PRESSURE_MBAR, TEMPERATURE_C)
3939
.expect("standard pressure and temperature are in range");
4040

41-
let position = spa::solar_position(
42-
time,
43-
latitude,
44-
longitude,
45-
OBSERVER_ELEVATION_M,
46-
DELTA_T_SECONDS,
47-
Some(refraction),
48-
)
49-
.expect("site coordinates are validated at settings load");
41+
let position = SolarPositions::new()
42+
.at(
43+
&time,
44+
Location {
45+
latitude,
46+
longitude,
47+
},
48+
OBSERVER_ELEVATION_M,
49+
DELTA_T_SECONDS,
50+
Some(refraction),
51+
)
52+
.expect("site coordinates are validated at settings load");
5053

5154
let apparent_zenith = position.zenith_angle();
5255

0 commit comments

Comments
 (0)