Skip to content

Commit

Permalink
doc: simplify code example
Browse files Browse the repository at this point in the history
  • Loading branch information
klausbrunner authored Jul 5, 2024
1 parent 60da7ac commit 41465e9
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,19 @@ The API is intentionally "flat", comprising a handful of static methods and simp
To get refraction-corrected topocentric coordinates:

```java
import net.e175.klaus.solarpositioning.*;

import java.time.ZonedDateTime;

public class App {
public static void main(String[] args) {
var dateTime = new ZonedDateTime.now();

// replace SPA with Grena3 as needed
var position = SPA.calculateSolarPosition(
dateTime,
48.21, // latitude (degrees)
16.37, // longitude (degrees)
190, // elevation (m)
DeltaT.estimate(dateTime.toLocalDate()), // delta T (s)
1010, // avg. air pressure (hPa)
11); // avg. air temperature (°C)

System.out.println(position);
}
}
var dateTime = new ZonedDateTime.now();

// replace SPA with Grena3 as needed
var position = SPA.calculateSolarPosition(
dateTime,
48.21, // latitude (degrees)
16.37, // longitude (degrees)
190, // elevation (m)
DeltaT.estimate(dateTime.toLocalDate()), // delta T (s)
1010, // avg. air pressure (hPa)
11); // avg. air temperature (°C)

System.out.println(position);
```

The SPA class includes methods to calculate the times of sunrise, sun transit, and sunset in one fell swoop. The actual
Expand Down

0 comments on commit 41465e9

Please sign in to comment.