Skip to content

Commit a97760b

Browse files
committed
Update docs
1 parent d762659 commit a97760b

File tree

3 files changed

+80
-24
lines changed

3 files changed

+80
-24
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ correctness of the algorithm implementations.
3333
## Example Usage
3434

3535
```julia
36-
julia> using SolarPosition, Dates
36+
julia> using SolarPosition, Dates, TimeZones
3737

3838
# define observer location (latitude, longitude, altitude in meters)
3939
julia> obs = Observer(52.35888, 4.88185, 100.0) # Van Gogh Museum, Amsterdam
4040
Observer(latitude=52.35888°, longitude=4.88185°, altitude=100.0m)
4141

42+
julia> tz = TimeZone("Europe/Brussels")
43+
Europe/Brussels (UTC+1/UTC+2)
44+
4245
# a few hours of timestamps
4346
julia> times = collect(DateTime(2023, 6, 21, 10):Hour(1):DateTime(2023, 6, 21, 15));
4447

@@ -53,6 +56,33 @@ julia> positions = solar_position(obs, times)
5356
SolPos(azimuth=251.77304757136397°, elevation=42.790197455865076°, zenith=47.209802544134924°)
5457
```
5558

59+
### Sunrise and Sunset Calculations
60+
61+
Calculate sunrise, sunset, and solar noon for a specific date with timezone:
62+
63+
```julia
64+
julia> result = transit_sunrise_sunset(obs, ZonedDateTime(2023, 6, 21, tz))
65+
TransitSunriseSunset{ZonedDateTime}(
66+
transit=2023-06-21T13:42:15+02:00,
67+
sunrise=2023-06-21T05:18:05+02:00,
68+
sunset=2023-06-21T22:06:24+02:00
69+
)
70+
```
71+
72+
Find the next sunrise from a specific time in UTC:
73+
74+
```julia
75+
julia> next_sunrise(obs, DateTime(2023, 6, 21, 12, 30))
76+
2023-06-22T03:18:19
77+
```
78+
79+
Find the next sunset in UTC:
80+
81+
```julia
82+
julia> next_sunset(obs, DateTime(2023, 6, 21, 12, 30))
83+
2023-06-21T20:06:24
84+
```
85+
5686
## Solar positioning algorithms
5787

5888
Here we provide an overview of the solar positioning algorithms currently implemented

docs/src/index.md

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ CurrentModule = SolarPosition
66

77
## SolarPosition.jl
88

9+
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliaastro.org/SolarPosition/stable/)
10+
[![Development documentation](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliaastro.org/SolarPosition.jl/dev/)
11+
912
[![Test workflow status](https://github.com/JuliaAstro/SolarPosition.jl/actions/workflows/Test.yml/badge.svg?branch=main)](https://github.com/JuliaAstro/SolarPosition.jl/actions/workflows/Test.yml?query=branch%3Amain)
1013
[![Coverage](https://codecov.io/gh/JuliaAstro/SolarPosition.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaAstro/SolarPosition.jl)
1114
[![Lint workflow Status](https://github.com/JuliaAstro/SolarPosition.jl/actions/workflows/Lint.yml/badge.svg?branch=main)](https://github.com/JuliaAstro/SolarPosition.jl/actions/workflows/Lint.yml?query=branch%3Amain)
1215
[![Docs workflow Status](https://github.com/JuliaAstro/SolarPosition.jl/actions/workflows/Docs.yml/badge.svg?branch=main)](https://github.com/JuliaAstro/SolarPosition.jl/actions/workflows/Docs.yml?query=branch%3Amain)
1316
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
1417
[![tested with JET.jl](https://img.shields.io/badge/%F0%9F%9B%A9%EF%B8%8F_tested_with-JET.jl-233f9a)](https://github.com/aviatesk/JET.jl)
1518

16-
`SolarPosition.jl` provides a simple, unified interface to a collection of validated solar position
19+
SolarPosition.jl provides a simple, unified interface to a collection of validated solar position
1720
algorithms written in pure, performant julia.
1821

1922
Solar positioning algorithms are commonly used to calculate the solar zenith and
@@ -24,32 +27,23 @@ azimuth angles, which are essential for various applications where the sun is im
2427
- Climate studies
2528
- Astronomy
2629

27-
## Extensions
28-
29-
SolarPosition.jl provides package extensions for the following use cases:
30-
31-
- **[ModelingToolkit.jl](https://github.com/SciML/ModelingToolkit.jl)**: Integrate solar position calculations into symbolic modeling workflows. Create composable solar energy system models. A [Dyad](https://juliahub.com/products/dyad) component is also provided. See the [ModelingToolkit Extension](guides/modelingtoolkit.md) guide for details.
32-
33-
- **[Makie.jl](https://github.com/MakieOrg/Makie.jl)**: Plotting recipes for solar position visualization with `sunpathplot` and `sunpathpolarplot` functions. See the plotting guide in the [Makie Extension](guides/plotting.md) for details.
34-
35-
- **[OhMyThreads.jl](https://github.com/JuliaFolds2/OhMyThreads.jl)**: Multithreaded solar position computation using task-based parallelism. Provides parallel implementations of [`solar_position!`](@ref) for efficient batch calculations across multiple timestamps. See the [OhMyThreads Extension](guides/parallel.md) guide for details.
36-
3730
## Acknowledgement
3831

39-
This package is based on the work done by readers in the field of solar photovoltaics
32+
This package is based on the work done by researchers in the field of solar photovoltaics
4033
in the packages [solposx](https://github.com/assessingsolar/solposx) and
4134
[pvlib-python](https://github.com/pvlib/pvlib-python). In particular the positioning and
42-
refraction methods have been adapted from [solposx](https://github.com/assessingsolar/solposx), while
43-
the SPA algorithm and the deltat calculation are ported from [pvlib-python](https://github.com/pvlib/pvlib-python). These packages also provide validation data necessary to ensure
35+
refraction methods have been adapted from [solposx](https://github.com/assessingsolar/solposx),
36+
while the SPA algorithm and the deltat calculation are ported from [pvlib-python](https://github.com/pvlib/pvlib-python). These packages also provide validation data necessary to ensure
4437
correctness of the algorithm implementations.
4538

4639
## Example Usage
4740

48-
```@example
49-
using SolarPosition, Dates
41+
```@example srt
42+
using SolarPosition, Dates, TimeZones
5043
5144
# define observer location (latitude, longitude, altitude in meters)
5245
obs = Observer(52.35888, 4.88185, 100.0) # Van Gogh Museum, Amsterdam
46+
tz = TimeZone("Europe/Brussels")
5347
5448
# a few hours of timestamps
5549
times = collect(DateTime(2023, 6, 21, 10):Hour(1):DateTime(2023, 6, 21, 15));
@@ -58,6 +52,26 @@ times = collect(DateTime(2023, 6, 21, 10):Hour(1):DateTime(2023, 6, 21, 15));
5852
positions = solar_position(obs, times)
5953
```
6054

55+
### Sunrise and Sunset Calculations
56+
57+
Calculate sunrise, sunset, and solar noon for a specific date with timezone:
58+
59+
```@example srt
60+
result = transit_sunrise_sunset(obs, ZonedDateTime(2023, 6, 21, tz))
61+
```
62+
63+
Find the next sunrise from a specific time in UTC:
64+
65+
```@example srt
66+
next_sunrise(obs, DateTime(2023, 6, 21, 12, 30))
67+
```
68+
69+
Find the next sunset in UTC:
70+
71+
```@example srt
72+
next_sunset(obs, DateTime(2023, 6, 21, 12, 30))
73+
```
74+
6175
## Solar positioning algorithms
6276

6377
Here we provide an overview of the solar positioning algorithms currently implemented
@@ -85,6 +99,23 @@ Atmospheric refraction correction algorithms available in SolarPosition.jl.
8599
| [`SG2`](@ref SolarPosition.Refraction.SG2) | [Blanc & Wald, 2012](https://doi.org/10.1016/j.solener.2012.07.018) | Pressure, Temperature ||
86100
| [`SPARefraction`](@ref SolarPosition.Refraction.SPARefraction) | [Reda & Andreas, 2004](https://doi.org/10.1016/j.solener.2003.12.003) | Pressure, Temperature ||
87101

102+
## Extensions
103+
104+
SolarPosition.jl provides optional extensions that are automatically loaded when you
105+
import the corresponding packages:
106+
107+
| Extension | Trigger Package | Features |
108+
| --------------- | --------------------------------------------------------------------- | ------------------------------------------------- |
109+
| Makie | [`Makie.jl`](https://github.com/MakieOrg/Makie.jl) | Plotting recipes for solar position visualization |
110+
| OhMyThreads | [`OhMyThreads.jl`](https://github.com/JuliaFolds2/OhMyThreads.jl) | Parallel computation of solar positions |
111+
| ModelingToolkit | [`ModelingToolkit.jl`](https://github.com/SciML/ModelingToolkit.jl) | Symbolic solar position models for simulations |
112+
113+
!!! note
114+
For more details on the extensions, see:
115+
- [ModelingToolkit Extension](guides/modelingtoolkit.md)
116+
- [Makie Extension](guides/plotting.md)
117+
- [OhMyThreads Extension](guides/parallel.md)
118+
88119
## How to Cite
89120

90121
If you use SolarPosition.jl in your work, please cite using the reference given in [CITATION.cff](https://github.com/JuliaAstro/SolarPosition.jl/blob/main/CITATION.cff).

docs/src/utilities.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Gogh museum in Amsterdam on June 21, 2023:
3333
```@example utilities
3434
using SolarPosition, Dates, TimeZones
3535
36-
tz_amsterdam = TimeZone("Europe/Amsterdam", TimeZones.Class(:LEGACY))
36+
tz_amsterdam = TimeZone("Europe/Brussels")
3737
obs = Observer(52.35888, 4.88185, 100.0)
3838
3939
# Summer solstice
@@ -62,7 +62,7 @@ println("Next Sunset: ", next_sunset_time)
6262

6363
## Plotting the Solar Altitude
6464

65-
To visualize the solar altitude throughout the day, we can use the `solar_position`
65+
To visualize the solar altitude throughout the day, we can use the [`solar_position`](@ref)
6666
function to compute the solar positions at regular intervals and plot the results. We
6767
will make use of [`next_sunrise`](@ref) and [`next_sunset`](@ref) to mark the sunrise
6868
and sunset times on the plot.
@@ -246,11 +246,6 @@ The utility functions accept three different time input types:
246246
Here's an example showing the different input types:
247247

248248
```@example utilities
249-
using SolarPosition, Dates, TimeZones
250-
251-
obs = Observer(52.35888, 4.88185, 100.0) # Amsterdam
252-
tz_amsterdam = TimeZone("Europe/Amsterdam", TimeZones.Class(:LEGACY))
253-
254249
# Using ZonedDateTime (recommended - timezone aware)
255250
zdt = ZonedDateTime(2023, 6, 21, 12, 0, tz_amsterdam)
256251
events_zdt = transit_sunrise_sunset(obs, zdt)

0 commit comments

Comments
 (0)